Add some basic spotless formatting rules.

This commit is contained in:
modmuss50 2022-12-18 12:10:22 +00:00
parent d2e4b92984
commit 4c037bd80b
127 changed files with 590 additions and 654 deletions

View file

@ -31,13 +31,11 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.ChatHud;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

View file

@ -37,7 +37,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.joml.Matrix4f;
import org.lwjgl.opengl.GL12;

View file

@ -55,7 +55,7 @@ public class RebornFluidRenderManager implements SimpleSynchronousResourceReload
private static void setupFluidRenderer(RebornFluid fluid) {
// Done lazy as we want to ensure we get the sprite at the correct time,
// but also don't want to be making these calls every time its required.
// but also don't want to be making these calls every time its required.
TemporaryLazy<Sprite[]> sprites = new TemporaryLazy<>(() -> {
FluidSettings fluidSettings = fluid.getFluidSettings();
return new Sprite[]{RenderUtil.getSprite(fluidSettings.getStillTexture()), RenderUtil.getSprite(fluidSettings.getFlowingTexture())};

View file

@ -30,7 +30,6 @@ import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.*;
import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluid;
@ -77,7 +76,7 @@ public class RenderUtil {
}
public static void renderGuiTank(FluidInstance fluid, FluidValue capacity, FluidValue amount, double x, double y, double zLevel,
double width, double height) {
double width, double height) {
if (fluid == null || fluid.getFluid() == null || fluid.getAmount().lessThanOrEqual(FluidValue.EMPTY)) {
return;
}

View file

@ -78,4 +78,4 @@ public class ConfigFluidElement extends ElementBase {
public SlotType getType() {
return type;
}
}
}

View file

@ -131,4 +131,4 @@ public class ConfigSlotElement extends ElementBase {
public int getId() {
return id;
}
}
}

View file

@ -171,14 +171,14 @@ public class FluidConfigPopupElement extends ElementBase {
}
public void drawState(GuiBase<?> gui,
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
MatrixStack matrixStack = new MatrixStack();
matrixStack.push();

View file

@ -177,14 +177,14 @@ public class SlotConfigPopupElement extends ElementBase {
}
public void drawState(GuiBase<?> gui,
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
World world,
BakedModel model,
BlockState actualState,
BlockPos pos,
BlockRenderManager dispatcher,
int x,
int y,
Quaternionf quaternion) {
MatrixStack matrixStack = new MatrixStack();
matrixStack.push();

View file

@ -59,4 +59,4 @@ public class SlotElement extends ElementBase {
public int getSlotY() {
return slotY;
}
}
}

View file

@ -66,4 +66,4 @@ public enum SlotType {
public Sprite getButtonHoverOverlay() {
return buttonHoverOverlay;
}
}
}

View file

@ -108,15 +108,15 @@ public class Sprite implements ISprite {
}
public record Button(Sprite normal,
Sprite hovered) {
Sprite hovered) {
}
public record ToggleButton(Sprite normal,
Sprite hovered,
Sprite pressed) {
Sprite hovered,
Sprite pressed) {
}
public record CheckBox(Sprite normal,
Sprite ticked) {
Sprite ticked) {
}
}

View file

@ -25,11 +25,9 @@
package reborncore.client.gui.builder.widget;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import reborncore.common.misc.TriConsumer;
import java.util.function.Supplier;
public class GuiButtonExtended extends ButtonWidget {

View file

@ -570,7 +570,7 @@ public class GuiBuilder {
* @param layer {@link GuiBase.Layer} The layer to draw on
*/
public void drawMultiEnergyBar(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, long energyStored, long maxEnergyStored, int mouseX,
int mouseY, int buttonID, GuiBase.Layer layer) {
int mouseY, int buttonID, GuiBase.Layer layer) {
if (gui.hideGuiElements()) return;
if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft();

View file

@ -32,10 +32,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -92,12 +89,12 @@ public class RebornCore implements ModInitializer {
BlockWrenchEventHandler.setup();
/*
This is a generic multiblock tick handler. If you are using this code on your
own, you will need to register this with the Forge TickRegistry on both the
client AND server sides. Note that different types of ticks run on different
parts of the system. CLIENT ticks only run on the client, at the start/end of
each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
ticks run only on the server, and only when worlds are loaded.
This is a generic multiblock tick handler. If you are using this code on your
own, you will need to register this with the Forge TickRegistry on both the
client AND server sides. Note that different types of ticks run on different
parts of the system. CLIENT ticks only run on the client, at the start/end of
each game loop. SERVER and WORLD ticks only run on the server. WORLDLOAD
ticks run only on the server, and only when worlds are loaded.
*/
ServerTickEvents.START_WORLD_TICK.register(MultiblockRegistry::tickStart);
@ -108,7 +105,7 @@ public class RebornCore implements ModInitializer {
RebornCoreTags.WATER_EXPLOSION_ITEM.toString();
PaddedShapedRecipe.PADDED.toString();
/* register UnloadHandler */
ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.register((blockEntity, world) -> {
if (blockEntity instanceof UnloadHandler) ((UnloadHandler) blockEntity).onUnload();

View file

@ -92,6 +92,6 @@ public abstract class BaseBlockEntityProvider extends Block implements BlockEnti
}
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune){
}
}

View file

@ -45,7 +45,6 @@ import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerChunkManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.registry.Registry;
import net.minecraft.world.chunk.ChunkStatus;
import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.IdentifiedPacket;
@ -185,4 +184,4 @@ public class RebornCoreCommands {
IdentifiedPacket packet = ClientBoundPackets.createPacketQueueItemStacksToRender(stacks);
NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer());
}
}
}

View file

@ -457,7 +457,7 @@ public class MachineBaseBlockEntity extends BlockEntity implements BlockEntityTi
}
return false;
}
@Override
public boolean isValid(int slot, ItemStack stack) {
if (slotConfiguration == null) {

View file

@ -151,9 +151,9 @@ public class SlotConfiguration implements NBTSerializable {
sideMap = new HashMap<>();
read(tagCompound);
Validate.isTrue(Arrays.stream(Direction.values())
.map(enumFacing -> sideMap.get(enumFacing))
.noneMatch(Objects::isNull),
"sideMap failed to load from nbt"
.map(enumFacing -> sideMap.get(enumFacing))
.noneMatch(Objects::isNull),
"sideMap failed to load from nbt"
);
}

View file

@ -35,7 +35,6 @@ import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import reborncore.RebornCore;
import reborncore.api.recipe.IRecipeCrafterProvider;

View file

@ -41,7 +41,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;
import reborncore.common.util.DefaultedListCollector;

View file

@ -32,7 +32,6 @@ import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.registry.Registries;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import java.util.Map;

View file

@ -38,7 +38,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.util.Lazy;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.container.ItemFluidInfo;
import java.util.ArrayList;

View file

@ -37,7 +37,6 @@ import net.minecraft.recipe.Ingredient;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import java.util.Collections;

View file

@ -35,7 +35,6 @@ import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry;
import org.apache.commons.lang3.Validate;

View file

@ -32,7 +32,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtOps;
import net.minecraft.registry.Registries;
import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RecipeUtils;
import reborncore.common.crafting.ingredient.IngredientFactory;

View file

@ -28,7 +28,6 @@ import com.google.gson.JsonObject;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import org.jetbrains.annotations.NotNull;

View file

@ -44,7 +44,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.NotNull;
import reborncore.common.fluid.container.FluidInstance;
import reborncore.common.util.Tank;

View file

@ -30,7 +30,6 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import reborncore.common.fluid.FluidValue;
import reborncore.common.util.NBTSerializable;
@ -145,4 +144,4 @@ public class FluidInstance implements NBTSerializable {
if (isEmpty()) return FluidVariant.blank();
else return FluidVariant.of(fluid, tag);
}
}
}

View file

@ -26,5 +26,5 @@ package reborncore.common.misc;
@FunctionalInterface
public interface TriConsumer<A, B, C> {
void accept(A a, B b, C c);
}
void accept(A a, B b, C c);
}

View file

@ -43,7 +43,7 @@ import java.util.Set;
public abstract class IMultiblockPart extends BlockEntity {
public static final int INVALID_DISTANCE = Integer.MAX_VALUE;
public IMultiblockPart(BlockEntityType<?> type, BlockPos pos, BlockState state) {
public IMultiblockPart(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
}
@ -99,7 +99,7 @@ public abstract class IMultiblockPart extends BlockEntity {
* @see #onDetached(MultiblockControllerBase)
*/
public abstract void onOrphaned(MultiblockControllerBase oldController, int oldControllerSize,
int newControllerSize);
int newControllerSize);
// Multiblock fuse/split helper methods. Here there be dragons.

View file

@ -30,7 +30,6 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import reborncore.common.blockentity.FluidConfiguration;

View file

@ -55,7 +55,7 @@ public class ServerBoundPackets {
NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase);
// We update the block to allow pipes that are connecting to detect the update and change their
// connection status if needed
// connection status if needed
World world = legacyMachineBase.getWorld();
BlockState blockState = world.getBlockState(legacyMachineBase.getPos());
world.updateNeighborsAlways(legacyMachineBase.getPos(), blockState.getBlock());

View file

@ -288,7 +288,7 @@ public abstract class PowerAcceptorBlockEntity extends MachineBaseBlockEntity im
* @return {@code long} Energy stored in block entity
*/
public long getEnergy() {
return getStored();
return getStored();
}
/**

View file

@ -104,7 +104,7 @@ public class RecipeCrafter implements IUpgradeHandler {
};
public RecipeCrafter(RebornRecipeType<?> recipeType, BlockEntity blockEntity, int inputs, int outputs, RebornInventory<?> inventory,
int[] inputSlots, int[] outputSlots) {
int[] inputSlots, int[] outputSlots) {
this.recipeType = recipeType;
this.blockEntity = blockEntity;
if (blockEntity instanceof PowerAcceptorBlockEntity powerAcceptor) {
@ -368,7 +368,7 @@ public class RecipeCrafter implements IUpgradeHandler {
}
// Test with a stack with the max stack size as some independents will check the stack size.
// A bit of a hack but should work.
// A bit of a hack but should work.
ItemStack largeStack = stack.copy();
largeStack.setCount(largeStack.getMaxCount());
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {

View file

@ -71,8 +71,8 @@ public class BuiltScreenHandler extends ScreenHandler {
private final MachineBaseBlockEntity blockEntity;
public BuiltScreenHandler(int syncID, final String name, final Predicate<PlayerEntity> canInteract,
final List<Range<Integer>> playerSlotRange,
final List<Range<Integer>> blockEntitySlotRange, MachineBaseBlockEntity blockEntity) {
final List<Range<Integer>> playerSlotRange,
final List<Range<Integer>> blockEntitySlotRange, MachineBaseBlockEntity blockEntity) {
super(null, syncID);
this.name = name;

View file

@ -96,7 +96,7 @@ public class BlockEntityScreenHandlerBuilder {
}
public BlockEntityScreenHandlerBuilder filterSlot(final int index, final int x, final int y,
final Predicate<ItemStack> filter) {
final Predicate<ItemStack> filter) {
this.parent.slots.add(new FilteredSlot(this.inventory, index, x, y).setFilter(filter));
return this;
}

View file

@ -102,7 +102,7 @@ public final class PlayerScreenHandlerBuilder {
}
private PlayerArmorScreenHandlerBuilder armor(final int index, final int xStart, final int yStart,
final EquipmentSlot slotType, final Identifier sprite) {
final EquipmentSlot slotType, final Identifier sprite) {
this.parent.parent.slots.add(new SpriteSlot(this.parent.player, index, xStart, yStart, sprite, 1)
.setFilter(stack -> {
if (stack.getItem() instanceof ArmorItem) {

View file

@ -103,8 +103,8 @@ public class InventoryItem extends InventoryBase {
@Override
public void setStack(int slot,
@NotNull
ItemStack stack) {
@NotNull
ItemStack stack) {
setSlotData(slot, stack.writeNbt(new NbtCompound()));
}
@ -120,8 +120,8 @@ public class InventoryItem extends InventoryBase {
}
public int getStackLimit(int slot,
@NotNull
ItemStack stack) {
@NotNull
ItemStack stack) {
return Math.min(getSlotLimit(slot), stack.getMaxCount());
}

View file

@ -50,7 +50,7 @@ import java.util.function.Predicate;
public class ItemUtils {
public static boolean isItemEqual(final ItemStack a, final ItemStack b,
final boolean matchNBT) {
final boolean matchNBT) {
if (a.isEmpty() || b.isEmpty()) {
return false;
}
@ -61,7 +61,7 @@ public class ItemUtils {
}
public static boolean isItemEqual(ItemStack a, ItemStack b, boolean matchNBT,
boolean useTags) {
boolean useTags) {
if (a.isEmpty() && b.isEmpty()) {
return true;
}
@ -103,7 +103,7 @@ public class ItemUtils {
//TODO tags
public static boolean isInputEqual(Object input, ItemStack other, boolean matchNBT,
boolean useTags) {
boolean useTags) {
if (input instanceof ItemStack) {
return isItemEqual((ItemStack) input, other, matchNBT, useTags);
} else if (input instanceof String) {
@ -171,12 +171,12 @@ public class ItemUtils {
if (player instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.energyError")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.deactivating")
.formatted(Formatting.GOLD)
), true);
}
stack.getOrCreateNbt().putBoolean("isActive", false);
@ -196,23 +196,23 @@ public class ItemUtils {
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.active")
.formatted(Formatting.GOLD)
), true);
}
} else {
stack.getOrCreateNbt().putBoolean("isActive", false);
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("reborncore.message.setTo")
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD)
), true);
.formatted(Formatting.GRAY)
.append(" ")
.append(
Text.translatable("reborncore.message.inactive")
.formatted(Formatting.GOLD)
), true);
}
}
}

View file

@ -34,7 +34,6 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

View file

@ -44,4 +44,4 @@ public class TemporaryLazy<T> {
public void reset() {
value = null;
}
}
}

View file

@ -31,7 +31,6 @@ import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import java.lang.reflect.Type;

View file

@ -52,4 +52,4 @@ public abstract class MixinCraftingResultSlot {
ItemCraftCallback.EVENT.invoker().onCraft(itemStack, input, player);
}
}
}

View file

@ -29,7 +29,6 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.ItemEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;

View file

@ -106,6 +106,10 @@ allprojects {
spotless {
java {
licenseHeaderFile(file("HEADER"))
removeUnusedImports()
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
}
}
}
@ -113,6 +117,9 @@ allprojects {
spotless {
groovy {
licenseHeaderFile(file("HEADER"))
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
}
}

View file

@ -24,7 +24,6 @@
package techreborn;
import com.mojang.datafixers.util.Pair;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
@ -36,7 +35,6 @@ import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.Baker;
import net.minecraft.client.render.model.ModelBakeSettings;
import net.minecraft.client.render.model.ModelLoader;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.render.model.json.JsonUnbakedModel;
import net.minecraft.client.texture.Sprite;
@ -50,7 +48,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.Nullable;
import reborncore.client.ClientJumpEvent;
import reborncore.client.gui.builder.GuiBase;
@ -81,7 +78,6 @@ import techreborn.items.tool.industrial.NanosaberItem;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;

View file

@ -26,7 +26,6 @@ package techreborn.client;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreens;

View file

@ -25,7 +25,6 @@
package techreborn.client.compat.rei.fluidgenerator;
import com.google.common.collect.Lists;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.ClientHelper;
import me.shedaniel.rei.api.client.gui.Renderer;

View file

@ -44,7 +44,6 @@ import net.minecraft.registry.Registries;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.registry.Registry;
import reborncore.api.IListInfoProvider;
import reborncore.common.BaseBlockEntityProvider;
import techreborn.blocks.cable.CableBlock;

View file

@ -62,7 +62,7 @@ public class GuiBlockPlacer extends GuiBase<BuiltScreenHandler> {
protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
}
}

View file

@ -54,9 +54,9 @@ public class GuiChunkLoader extends GuiBase<BuiltScreenHandler> {
addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND));
addDrawableChild(ButtonWidget.builder(Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))
.position(x + 10, y + 70)
.size(155, 20)
.build());
.position(x + 10, y + 70)
.size(155, 20)
.build());
}
@Override

View file

@ -64,4 +64,4 @@ public class GuiDieselGenerator extends GuiBase<BuiltScreenHandler> {
}
}
}

View file

@ -107,4 +107,4 @@ public class GuiGreenhouseController extends GuiBase<BuiltScreenHandler> {
public void onClick(GuiButtonExtended button, Double x, Double y) {
blockEntity.renderMultiblock ^= !hideGuiElements();
}
}
}

View file

@ -60,4 +60,4 @@ public class GuiGrinder extends GuiBase<BuiltScreenHandler> {
builder.drawProgressBar(matrixStack, this, blockEntity.getProgressScaled(100), 100, 76, 48, mouseX, mouseY, GuiBuilder.ProgressDirection.RIGHT, layer);
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer);
}
}
}

View file

@ -65,4 +65,4 @@ public class GuiIndustrialElectrolyzer extends GuiBase<BuiltScreenHandler> {
}
}
}

View file

@ -94,5 +94,3 @@ public class GuiManual extends Screen {
super.render(matrixStack, mouseX, mouseY, partialTicks);
}
}

View file

@ -45,7 +45,7 @@ import java.util.HashMap;
public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity> {
private static final TurbineModel MODEL = new TurbineModel();
public static final Identifier TEXTURE = new Identifier("techreborn:textures/block/machines/generators/wind_mill_turbine.png");
public TurbineRenderer(BlockEntityRendererFactory.Context ctx) {
}

View file

@ -49,10 +49,10 @@ import techreborn.datagen.worldgen.TRWorldGenProvider
class TechRebornDataGen implements DataGeneratorEntrypoint {
@Override
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
@Override
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
def pack = fabricDataGenerator.createPack()
def add = { FabricDataGenerator.Pack.RegistryDependentFactory factory ->
pack.addProvider factory
}
@ -61,7 +61,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
add TRPointOfInterestTagProvider::new
add TRBlockTagProvider::new
// tags before all else, very important!!
// tags before all else, very important!!
add SmeltingRecipesProvider::new
add CraftingRecipesProvider::new
@ -76,9 +76,9 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
add ModelProvider::new
add BlockLootTableProvider::new
add TRWorldGenProvider::new
}
}
@Override
String getEffectiveModId() {

View file

@ -43,74 +43,74 @@ import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
protected Consumer<RecipeJsonProvider> exporter
TechRebornRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output)
}
protected Consumer<RecipeJsonProvider> exporter
TechRebornRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output)
}
@Override
final void generate(Consumer<RecipeJsonProvider> exporter) {
this.exporter = exporter
generateRecipes()
}
@Override
final void generate(Consumer<RecipeJsonProvider> exporter) {
this.exporter = exporter
generateRecipes()
}
abstract void generateRecipes()
abstract void generateRecipes()
static Ingredient createIngredient(def input) {
if (input instanceof Ingredient) {
if (input instanceof Ingredient) {
return input
}
if (input instanceof ItemConvertible) {
return Ingredient.ofItems(input)
} else if (input instanceof TagKey) {
return Ingredient.fromTag(input)
}
return Ingredient.ofItems(input)
} else if (input instanceof TagKey) {
return Ingredient.fromTag(input)
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static String getCriterionName(def input) {
if (input instanceof ItemConvertible) {
return hasItem(input)
} else if (input instanceof TagKey) {
return "has_tag_" + input.id().toUnderscoreSeparatedString()
}
static String getCriterionName(def input) {
if (input instanceof ItemConvertible) {
return hasItem(input)
} else if (input instanceof TagKey) {
return "has_tag_" + input.id().toUnderscoreSeparatedString()
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static CriterionConditions getCriterionConditions(def input) {
if (input instanceof ItemConvertible) {
return conditionsFromItem(input)
} else if (input instanceof TagKey) {
return conditionsFromTag(input)
}
static CriterionConditions getCriterionConditions(def input) {
if (input instanceof ItemConvertible) {
return conditionsFromItem(input)
} else if (input instanceof TagKey) {
return conditionsFromTag(input)
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static String getInputPath(def input) {
if (input instanceof ItemConvertible) {
return getItemPath(input)
} else if (input instanceof TagKey) {
return input.id().toString().replace(":", "_")
}
throw new IllegalArgumentException()
}
static String getName(def input) {
if (input instanceof ItemConvertible) {
static String getInputPath(def input) {
if (input instanceof ItemConvertible) {
return getItemPath(input)
} else if (input instanceof TagKey) {
String name = input.id().toString()
if (name.contains(":"))
name = name.substring(name.indexOf(":")+1)
return name
}
} else if (input instanceof TagKey) {
return input.id().toString().replace(":", "_")
}
throw new IllegalArgumentException()
}
throw new IllegalArgumentException()
}
static String getName(def input) {
if (input instanceof ItemConvertible) {
return getItemPath(input)
} else if (input instanceof TagKey) {
String name = input.id().toString()
if (name.contains(":"))
name = name.substring(name.indexOf(":")+1)
return name
}
throw new IllegalArgumentException()
}
static String getNamePart1(def input) {
String name
@ -160,9 +160,9 @@ abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
}
@Override
protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
}
protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
}
@Override
public String getName() {

View file

@ -83,104 +83,104 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
offerWallRecipe(block.asTag(), block.getWallBlock(), "crafting_table/storage_block/")
offerWallRecipeStonecutter(block.asTag(), block.getWallBlock(), "crafting_table/storage_block/")
}
generateToolRecipes()
generateArmorRecipes()
generateToolRecipes()
generateArmorRecipes()
}
def generateToolRecipes() {
// add axes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_AXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_AXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_AXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_AXE
].each { material, axe ->
offerAxeRecipe(material, axe, "crafting_table/tool/")
}
// add hoes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HOE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HOE,
(TRContent.Gems.RUBY) : TRContent.RUBY_HOE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HOE
].each { material, hoe ->
offerHoeRecipe(material, hoe, "crafting_table/tool/")
}
// add pickaxes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_PICKAXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_PICKAXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_PICKAXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_PICKAXE
].each { material, pickaxe ->
offerPickaxeRecipe(material, pickaxe, "crafting_table/tool/")
}
// add shovels
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SPADE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SPADE,
(TRContent.Gems.RUBY) : TRContent.RUBY_SPADE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SPADE
].each { material, shovel ->
offerShovelRecipe(material, shovel, "crafting_table/tool/", "spade")
}
// add swords
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SWORD,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SWORD,
(TRContent.Gems.RUBY) : TRContent.RUBY_SWORD,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SWORD
].each { material, sword ->
offerSwordRecipe(material, sword, "crafting_table/tool/")
}
}
def generateToolRecipes() {
// add axes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_AXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_AXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_AXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_AXE
].each { material, axe ->
offerAxeRecipe(material, axe, "crafting_table/tool/")
}
// add hoes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HOE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HOE,
(TRContent.Gems.RUBY) : TRContent.RUBY_HOE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HOE
].each { material, hoe ->
offerHoeRecipe(material, hoe, "crafting_table/tool/")
}
// add pickaxes
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_PICKAXE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_PICKAXE,
(TRContent.Gems.RUBY) : TRContent.RUBY_PICKAXE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_PICKAXE
].each { material, pickaxe ->
offerPickaxeRecipe(material, pickaxe, "crafting_table/tool/")
}
// add shovels
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SPADE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SPADE,
(TRContent.Gems.RUBY) : TRContent.RUBY_SPADE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SPADE
].each { material, shovel ->
offerShovelRecipe(material, shovel, "crafting_table/tool/", "spade")
}
// add swords
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_SWORD,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_SWORD,
(TRContent.Gems.RUBY) : TRContent.RUBY_SWORD,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_SWORD
].each { material, sword ->
offerSwordRecipe(material, sword, "crafting_table/tool/")
}
}
def generateArmorRecipes() {
// add boots
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_BOOTS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_BOOTS,
(TRContent.Gems.RUBY) : TRContent.RUBY_BOOTS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_BOOTS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_BOOTS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_BOOTS
].each { material, boots ->
offerBootsRecipe(material, boots, "crafting_table/armor/")
}
// add chestplate
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_CHESTPLATE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_CHESTPLATE,
(TRContent.Gems.RUBY) : TRContent.RUBY_CHESTPLATE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_CHESTPLATE,
(TRContent.Ingots.SILVER) : TRContent.SILVER_CHESTPLATE,
(TRContent.Ingots.STEEL) : TRContent.STEEL_CHESTPLATE
].each { material, chestplate ->
offerChestplateRecipe(material, chestplate, "crafting_table/armor/")
}
// add helmets
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HELMET,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HELMET,
(TRContent.Gems.RUBY) : TRContent.RUBY_HELMET,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HELMET,
(TRContent.Ingots.SILVER) : TRContent.SILVER_HELMET,
(TRContent.Ingots.STEEL) : TRContent.STEEL_HELMET
].each { material, helmet ->
offerHelmetRecipe(material, helmet, "crafting_table/armor/")
}
// add leggings
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_LEGGINGS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_LEGGINGS,
(TRContent.Gems.RUBY) : TRContent.RUBY_LEGGINGS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_LEGGINGS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_LEGGINGS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_LEGGINGS
].each { material, leggings ->
offerLeggingsRecipe(material, leggings, "crafting_table/armor/")
}
}
def generateArmorRecipes() {
// add boots
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_BOOTS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_BOOTS,
(TRContent.Gems.RUBY) : TRContent.RUBY_BOOTS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_BOOTS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_BOOTS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_BOOTS
].each { material, boots ->
offerBootsRecipe(material, boots, "crafting_table/armor/")
}
// add chestplate
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_CHESTPLATE,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_CHESTPLATE,
(TRContent.Gems.RUBY) : TRContent.RUBY_CHESTPLATE,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_CHESTPLATE,
(TRContent.Ingots.SILVER) : TRContent.SILVER_CHESTPLATE,
(TRContent.Ingots.STEEL) : TRContent.STEEL_CHESTPLATE
].each { material, chestplate ->
offerChestplateRecipe(material, chestplate, "crafting_table/armor/")
}
// add helmets
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_HELMET,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_HELMET,
(TRContent.Gems.RUBY) : TRContent.RUBY_HELMET,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_HELMET,
(TRContent.Ingots.SILVER) : TRContent.SILVER_HELMET,
(TRContent.Ingots.STEEL) : TRContent.STEEL_HELMET
].each { material, helmet ->
offerHelmetRecipe(material, helmet, "crafting_table/armor/")
}
// add leggings
[
(TRContent.Ingots.BRONZE.asTag()): TRContent.BRONZE_LEGGINGS,
(TRContent.Gems.PERIDOT) : TRContent.PERIDOT_LEGGINGS,
(TRContent.Gems.RUBY) : TRContent.RUBY_LEGGINGS,
(TRContent.Gems.SAPPHIRE) : TRContent.SAPPHIRE_LEGGINGS,
(TRContent.Ingots.SILVER) : TRContent.SILVER_LEGGINGS,
(TRContent.Ingots.STEEL) : TRContent.STEEL_LEGGINGS
].each { material, leggings ->
offerLeggingsRecipe(material, leggings, "crafting_table/armor/")
}
}
def static recipeNameString(String prefix, def input, def output, String source = null, String result = null) {
StringBuilder s = new StringBuilder()
@ -196,37 +196,37 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
return s.toString()
}
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null, RecipeCategory category = RecipeCategory.MISC) {
def offerMonoShapelessRecipe(def input, int inputSize, ItemConvertible output, int outputSize, String source, prefix = "", String result = null, RecipeCategory category = RecipeCategory.MISC) {
new ShapelessRecipeJsonBuilder(category, output, outputSize).input(createIngredient(input), inputSize)
.criterion(getCriterionName(input), getCriterionConditions(input))
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
}
.criterion(getCriterionName(input), getCriterionConditions(input))
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, recipeNameString(prefix, input, output, source, result)))
}
def static materialTypeString(String prefix, def material, String type, Function<?, String> modifier) {
StringBuilder s = new StringBuilder()
s.append(prefix)
s.append(modifier.apply(material))
s.append('_')
s.append(type)
return s.toString()
}
def static materialTypeString(String prefix, def material, String type, Function<?, String> modifier) {
StringBuilder s = new StringBuilder()
s.append(prefix)
s.append(modifier.apply(material))
s.append('_')
s.append(type)
return s.toString()
}
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
return new ShapedRecipeJsonBuilder(category, output, outputAmount)
.input(character, createIngredient(input))
.criterion(getCriterionName(input), getCriterionConditions(input))
}
def static createMonoShapeRecipe(def input, ItemConvertible output, char character, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
return new ShapedRecipeJsonBuilder(category, output, outputAmount)
.input(character, createIngredient(input))
.criterion(getCriterionName(input), getCriterionConditions(input))
}
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false, RecipeCategory category = RecipeCategory.MISC) {
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(category, output)
.input(char1, createIngredient(input1))
.input(char2, createIngredient(input2))
if (crit1)
factory = factory.criterion(getCriterionName(input1), getCriterionConditions(input1))
if (crit2)
factory = factory.criterion(getCriterionName(input2), getCriterionConditions(input2))
return factory
}
def static createDuoShapeRecipe(def input1, def input2, ItemConvertible output, char char1, char char2, boolean crit1 = true, boolean crit2 = false, RecipeCategory category = RecipeCategory.MISC) {
ShapedRecipeJsonBuilder factory = ShapedRecipeJsonBuilder.create(category, output)
.input(char1, createIngredient(input1))
.input(char2, createIngredient(input2))
if (crit1)
factory = factory.criterion(getCriterionName(input1), getCriterionConditions(input1))
if (crit2)
factory = factory.criterion(getCriterionName(input2), getCriterionConditions(input2))
return factory
}
def static createStonecutterRecipe(def input, ItemConvertible output, int outputAmount = 1, RecipeCategory category = RecipeCategory.MISC) {
return new SingleItemRecipeJsonBuilder(category, RecipeSerializer.STONECUTTING, createIngredient(input), output, outputAmount)
@ -269,80 +269,80 @@ class CraftingRecipesProvider extends TechRebornRecipesProvider {
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, "wall", TechRebornRecipesProvider::getName) + "_stonecutter"))
}
def offerAxeRecipe(def material, ItemConvertible output, prefix = "", String type = "axe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern("X#")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerAxeRecipe(def material, ItemConvertible output, prefix = "", String type = "axe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern("X#")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHoeRecipe(def material, ItemConvertible output, prefix = "", String type = "hoe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern(" #")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHoeRecipe(def material, ItemConvertible output, prefix = "", String type = "hoe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XX")
.pattern(" #")
.pattern(" #")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerPickaxeRecipe(def material, ItemConvertible output, prefix = "", String type = "pickaxe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XXX")
.pattern(" # ")
.pattern(" # ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerPickaxeRecipe(def material, ItemConvertible output, prefix = "", String type = "pickaxe") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("XXX")
.pattern(" # ")
.pattern(" # ")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerShovelRecipe(def material, ItemConvertible output, prefix = "", String type = "shovel") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("#")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerShovelRecipe(def material, ItemConvertible output, prefix = "", String type = "shovel") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("#")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerSwordRecipe(def material, ItemConvertible output, prefix = "", String type = "sword") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("X")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerSwordRecipe(def material, ItemConvertible output, prefix = "", String type = "sword") {
createDuoShapeRecipe(material, Items.STICK, output,
'X' as char, '#' as char)
.pattern("X")
.pattern("X")
.pattern("#")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerBootsRecipe(def material, ItemConvertible output, prefix = "", String type = "boots") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerBootsRecipe(def material, ItemConvertible output, prefix = "", String type = "boots") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerChestplateRecipe(def material, ItemConvertible output, prefix = "", String type = "chestplate") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("XXX")
.pattern("XXX")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerChestplateRecipe(def material, ItemConvertible output, prefix = "", String type = "chestplate") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("X X")
.pattern("XXX")
.pattern("XXX")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHelmetRecipe(def material, ItemConvertible output, prefix = "", String type = "helmet") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerHelmetRecipe(def material, ItemConvertible output, prefix = "", String type = "helmet") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerLeggingsRecipe(def material, ItemConvertible output, prefix = "", String type = "leggings") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
def offerLeggingsRecipe(def material, ItemConvertible output, prefix = "", String type = "leggings") {
createMonoShapeRecipe(material, output, 'X' as char)
.pattern("XXX")
.pattern("X X")
.pattern("X X")
.offerTo(this.exporter, new Identifier(TechReborn.MOD_ID, materialTypeString(prefix, material, type, TechRebornRecipesProvider::getNamePart1)))
}
}

View file

@ -57,4 +57,4 @@ abstract class MachineRecipeWithFluidJsonFactory<R extends RebornFluidRecipe> ex
if (fluid == null)
throw new IllegalStateException("recipe has no valid fluid type specified")
}
}
}

View file

@ -35,7 +35,7 @@ import java.util.concurrent.CompletableFuture
class AssemblingMachineRecipesProvider extends TechRebornRecipesProvider {
AssemblingMachineRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
AssemblingMachineRecipesProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture)
}

View file

@ -65,4 +65,4 @@ class BlastFurnaceRecipeJsonFactory extends MachineRecipeJsonFactory<BlastFurnac
throw new IllegalStateException("recipe has no heat value")
}
}
}
}

View file

@ -61,7 +61,7 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
generateGlassFromGlassPane()
generateAnvil()
}
void generateBoots() {
final int count = 2
[
@ -308,4 +308,4 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
}
}
}
}
}

View file

@ -68,4 +68,4 @@ class CompressorRecipesProvider extends TechRebornRecipesProvider {
}
}
}
}
}

View file

@ -122,7 +122,7 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
Items.MILK_BUCKET,
Items.LAVA_BUCKET,
Items.POWDER_SNOW_BUCKET,
Items.WATER_BUCKET
Items.WATER_BUCKET
].each {bucket ->
offerExtractorRecipe {
ingredients bucket
@ -138,7 +138,7 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
Items.EXPERIENCE_BOTTLE,
Items.HONEY_BOTTLE,
Items.LINGERING_POTION,
Items.POTION,
Items.POTION,
Items.SPLASH_POTION
].each {bottle ->
offerExtractorRecipe {
@ -160,4 +160,4 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
}
}
}
}

View file

@ -186,7 +186,7 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
}
}
}
void generateConcretePowder() {
[
(Items.BLACK_CONCRETE): Items.BLACK_CONCRETE_POWDER,
@ -253,4 +253,4 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
}
}
}
}
}

View file

@ -52,4 +52,4 @@ class IndustrialGrinderRecipeJsonFactory extends MachineRecipeWithFluidJsonFacto
protected IndustrialGrinderRecipe createRecipe(Identifier identifier) {
return new IndustrialGrinderRecipe(ModRecipes.INDUSTRIAL_GRINDER, identifier, ingredients, outputs, power, time, new FluidInstance(fluid, FluidValue.fromMillibuckets(fluidAmount)))
}
}
}

View file

@ -354,4 +354,4 @@ class IndustrialGrinderRecipesProvider extends TechRebornRecipesProvider {
}
}
}
}

View file

@ -53,4 +53,4 @@ class IndustrialSawmillRecipeJsonFactory extends MachineRecipeWithFluidJsonFacto
protected IndustrialSawmillRecipe createRecipe(Identifier identifier) {
return new IndustrialSawmillRecipe(ModRecipes.INDUSTRIAL_SAWMILL, identifier, ingredients, outputs, power, time, new FluidInstance(fluid, FluidValue.fromMillibuckets(fluidAmount)))
}
}
}

View file

@ -195,4 +195,4 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
criterion getCriterionName(ItemTags.WOODEN_BUTTONS), getCriterionConditions(ItemTags.WOODEN_BUTTONS)
}
}
}
}

View file

@ -40,84 +40,84 @@ import java.nio.file.Paths
import java.util.List
class OreDistributionVisualiser {
private static final Color[] colors = new Color[] {
Color.black,
Color.red,
Color.pink,
Color.orange,
Color.yellow,
Color.green,
Color.magenta,
Color.cyan,
Color.blue
}
private static final Color[] colors = new Color[] {
Color.black,
Color.red,
Color.pink,
Color.orange,
Color.yellow,
Color.green,
Color.magenta,
Color.cyan,
Color.blue
}
static void main(String[] args) {
// Start the game up enough
SharedConstants.createGameVersion()
Bootstrap.initialize()
static void main(String[] args) {
// Start the game up enough
SharedConstants.createGameVersion()
Bootstrap.initialize()
generateOreDistributionVisualization()
}
generateOreDistributionVisualization()
}
static void generateOreDistributionVisualization() throws IOException {
def heightContext = new FixedHeightContext(-64, 360)
static void generateOreDistributionVisualization() throws IOException {
def heightContext = new FixedHeightContext(-64, 360)
BufferedImage bi = new BufferedImage(450, 220, BufferedImage.TYPE_INT_ARGB)
Graphics2D png = bi.createGraphics()
Font font = new Font("TimesRoman", Font.BOLD, 20)
png.setFont(font)
BufferedImage bi = new BufferedImage(450, 220, BufferedImage.TYPE_INT_ARGB)
Graphics2D png = bi.createGraphics()
Font font = new Font("TimesRoman", Font.BOLD, 20)
png.setFont(font)
png.setPaint(Color.black)
// Draw 0
png.drawLine(0, -heightContext.minY, (overworldOres().size() * 10) + 20, -heightContext.minY)
png.setPaint(Color.black)
// Draw 0
png.drawLine(0, -heightContext.minY, (overworldOres().size() * 10) + 20, -heightContext.minY)
png.setPaint(Color.blue)
// Draw ground
png.drawLine(0, -heightContext.minY + 64, (overworldOres().size() * 10) + 20, -heightContext.minY + 64)
png.setPaint(Color.blue)
// Draw ground
png.drawLine(0, -heightContext.minY + 64, (overworldOres().size() * 10) + 20, -heightContext.minY + 64)
int c = 1
for (OreDistribution value : overworldOres()) {
png.setPaint(colors[c])
int c = 1
for (OreDistribution value : overworldOres()) {
png.setPaint(colors[c])
def yMin = value.minOffset.getY(heightContext) + -heightContext.minY
def yMax = -heightContext.minY + value.maxY
def yMin = value.minOffset.getY(heightContext) + -heightContext.minY
def yMax = -heightContext.minY + value.maxY
png.fill3DRect(c * 10, yMin, 10, yMax - yMin, true)
png.fill3DRect(c * 10, yMin, 10, yMax - yMin, true)
png.drawString(value.name() + "(%d -> %d)".formatted(value.minOffset.getY(heightContext), value.maxY), 190, 25 * c)
png.drawString(value.name() + "(%d -> %d)".formatted(value.minOffset.getY(heightContext), value.maxY), 190, 25 * c)
c += 1
}
c += 1
}
ImageIO.write(bi, "PNG", Paths.get("ore_distribution.png").toFile())
}
ImageIO.write(bi, "PNG", Paths.get("ore_distribution.png").toFile())
}
private static List<OreDistribution> overworldOres() {
return Arrays.stream(OreDistribution.values())
.filter(ore -> ore.dimension == TargetDimension.OVERWORLD)
.toList()
}
private static List<OreDistribution> overworldOres() {
return Arrays.stream(OreDistribution.values())
.filter(ore -> ore.dimension == TargetDimension.OVERWORLD)
.toList()
}
private static class FixedHeightContext extends HeightContext {
final int minY
final int height
private static class FixedHeightContext extends HeightContext {
final int minY
final int height
FixedHeightContext(int minY, int height) {
super(new DebugChunkGenerator(BuiltinRegistries.BIOME), EmptyBlockView.INSTANCE)
FixedHeightContext(int minY, int height) {
super(new DebugChunkGenerator(BuiltinRegistries.BIOME), EmptyBlockView.INSTANCE)
this.minY = minY
this.height = height
}
this.minY = minY
this.height = height
}
@Override
int getMinY() {
return minY
}
@Override
int getMinY() {
return minY
}
@Override
int getHeight() {
return height
}
}
@Override
int getHeight() {
return height
}
}
}

View file

@ -37,9 +37,9 @@ import java.lang.reflect.Method
*/
@Slf4j
abstract class TRGameTest implements FabricGameTest {
@Override
void invokeTestMethod(TestContext context, Method method) {
try {
@Override
void invokeTestMethod(TestContext context, Method method) {
try {
method.invoke(this, new TRTestContext(context))
} catch (TRGameTestException gameTestException) {
log.error("Test ${method.name} failed with message ${gameTestException.message}", gameTestException.cause)
@ -49,7 +49,7 @@ abstract class TRGameTest implements FabricGameTest {
log.error("Test ${method.name} failed", throwable)
throw throwable
}
}
}
static class TRGameTestException extends AssertionError {
TRGameTestException(String message, Throwable cause) {

View file

@ -32,28 +32,28 @@ import reborncore.common.blockentity.MachineBaseBlockEntity
import techreborn.init.TRContent
class TRTestContext extends TestContext {
TRTestContext(TestContext parentContext) {
//noinspection GroovyAccessibility
super(parentContext.test)
}
TRTestContext(TestContext parentContext) {
//noinspection GroovyAccessibility
super(parentContext.test)
}
/**
* Place a machine with a creative solar panel
*/
def poweredMachine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 2, 0)
setBlockState(machinePos, machine.block)
setBlockState(machinePos.down(), TRContent.SolarPanels.CREATIVE.block)
/**
* Place a machine with a creative solar panel
*/
def poweredMachine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 2, 0)
setBlockState(machinePos, machine.block)
setBlockState(machinePos.down(), TRContent.SolarPanels.CREATIVE.block)
waitAndRun(5) {
try {
new MachineContext(machinePos).with(machineContextClosure)
} catch (e) {
e.printStackTrace()
throw e
}
}
}
waitAndRun(5) {
try {
new MachineContext(machinePos).with(machineContextClosure)
} catch (e) {
e.printStackTrace()
throw e
}
}
}
def machine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 1, 0)
@ -69,59 +69,59 @@ class TRTestContext extends TestContext {
}
}
class MachineContext {
final BlockPos machinePos
class MachineContext {
final BlockPos machinePos
MachineContext(BlockPos machinePos) {
this.machinePos = machinePos
}
MachineContext(BlockPos machinePos) {
this.machinePos = machinePos
}
def input(ItemConvertible item, int slot = -1) {
this.input(new ItemStack(item), slot)
}
def input(ItemConvertible item, int slot = -1) {
this.input(new ItemStack(item), slot)
}
def input(ItemStack stack, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first input slot
slot = blockEntity.crafter.inputSlots[0]
}
def input(ItemStack stack, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first input slot
slot = blockEntity.crafter.inputSlots[0]
}
blockEntity.inventory.setStack(slot, stack)
}
blockEntity.inventory.setStack(slot, stack)
}
def expectOutput(ItemConvertible item, int ticks, int slot = -1) {
expectOutput(new ItemStack(item), ticks, slot)
}
def expectOutput(ItemConvertible item, int ticks, int slot = -1) {
expectOutput(new ItemStack(item), ticks, slot)
}
def expectOutput(ItemStack stack, int ticks, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first output slot
slot = blockEntity.crafter.outputSlots[0]
}
def expectOutput(ItemStack stack, int ticks, int slot = -1) {
if (slot == -1) {
// If not slot is provided use the first output slot
slot = blockEntity.crafter.outputSlots[0]
}
addFinalTaskWithDuration(ticks) {
if (!blockEntity.inventory.getStack(slot).isItemEqual(stack)) {
throwGameTestException("Failed to find $stack in slot $slot")
}
}
}
addFinalTaskWithDuration(ticks) {
if (!blockEntity.inventory.getStack(slot).isItemEqual(stack)) {
throwGameTestException("Failed to find $stack in slot $slot")
}
}
}
def withUpgrades(TRContent.Upgrades upgrade, int count = -1) {
count = (count != -1 ? count : blockEntity.getUpgradeSlotCount()) -1
def withUpgrades(TRContent.Upgrades upgrade, int count = -1) {
count = (count != -1 ? count : blockEntity.getUpgradeSlotCount()) -1
(0..count).each {
blockEntity.upgradeInventory.setStack(it, new ItemStack(upgrade))
}
}
(0..count).each {
blockEntity.upgradeInventory.setStack(it, new ItemStack(upgrade))
}
}
MachineBaseBlockEntity getBlockEntity() {
def be = getBlockEntity(machinePos)
def be = getBlockEntity(machinePos)
if (!be) {
throwPositionedException("Failed to get machine block entity", machinePos)
}
if (!be) {
throwPositionedException("Failed to get machine block entity", machinePos)
}
return be as MachineBaseBlockEntity
}
}
return be as MachineBaseBlockEntity
}
}
}

View file

@ -31,17 +31,17 @@ import techreborn.test.TRGameTest
import techreborn.test.TRTestContext
class GrinderTest extends TRGameTest {
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150)
def testGrind2OCs(TRTestContext context) {
/**
* Test that grinder with 2 overclocker upgrades grinds coal into coal dust in 116 ticks
*/
context.poweredMachine(TRContent.Machine.GRINDER) {
input(Items.COAL)
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150)
def testGrind2OCs(TRTestContext context) {
/**
* Test that grinder with 2 overclocker upgrades grinds coal into coal dust in 116 ticks
*/
context.poweredMachine(TRContent.Machine.GRINDER) {
input(Items.COAL)
withUpgrades(TRContent.Upgrades.OVERCLOCKER, 2)
withUpgrades(TRContent.Upgrades.OVERCLOCKER, 2)
expectOutput(TRContent.Dusts.COAL, 116)
}
}
expectOutput(TRContent.Dusts.COAL, 116)
}
}
}

View file

@ -33,18 +33,18 @@ import techreborn.test.TRGameTest
import techreborn.test.TRTestContext
class IronAlloyFurnaceTest extends TRGameTest {
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronAlloyFurnaceElectrumAlloyIngot(TRTestContext context) {
/**
* Test that the Iron Alloy Furnace smelts a gold ingot and a silver ingot into an electrum alloy ingot in 200
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronAlloyFurnaceElectrumAlloyIngot(TRTestContext context) {
/**
* Test that the Iron Alloy Furnace smelts a gold ingot and a silver ingot into an electrum alloy ingot in 200
* Verifies: Issue #2850
*/
context.machine(TRContent.Machine.IRON_ALLOY_FURNACE) {
*/
context.machine(TRContent.Machine.IRON_ALLOY_FURNACE) {
input(Items.COAL_BLOCK, IronAlloyFurnaceBlockEntity.FUEL_SLOT)
input(Items.GOLD_INGOT, IronAlloyFurnaceBlockEntity.INPUT_SLOT_1)
input(TRContent.Ingots.SILVER, IronAlloyFurnaceBlockEntity.INPUT_SLOT_2)
input(Items.GOLD_INGOT, IronAlloyFurnaceBlockEntity.INPUT_SLOT_1)
input(TRContent.Ingots.SILVER, IronAlloyFurnaceBlockEntity.INPUT_SLOT_2)
expectOutput(TRContent.Ingots.ELECTRUM, (int) (200 / TechRebornConfig.cookingScale), IronAlloyFurnaceBlockEntity.OUTPUT_SLOT)
}
}
expectOutput(TRContent.Ingots.ELECTRUM, (int) (200 / TechRebornConfig.cookingScale), IronAlloyFurnaceBlockEntity.OUTPUT_SLOT)
}
}
}

View file

@ -48,17 +48,17 @@ class IronFurnaceTest extends TRGameTest {
}
}
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronFurnaceSmeltRawIronBlock(TRTestContext context) {
/**
* Test that the Iron Furnace smelts a raw iron block into an iron block in 1500 ticks instead of 200
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronFurnaceSmeltRawIronBlock(TRTestContext context) {
/**
* Test that the Iron Furnace smelts a raw iron block into an iron block in 1500 ticks instead of 200
* Verifies: Issue #2850
*/
context.machine(TRContent.Machine.IRON_FURNACE) {
*/
context.machine(TRContent.Machine.IRON_FURNACE) {
input(Items.COAL_BLOCK, IronFurnaceBlockEntity.FUEL_SLOT)
input(Items.RAW_IRON_BLOCK, IronFurnaceBlockEntity.INPUT_SLOT)
input(Items.RAW_IRON_BLOCK, IronFurnaceBlockEntity.INPUT_SLOT)
expectOutput(Items.IRON_BLOCK, (int) (1500 / TechRebornConfig.cookingScale), IronFurnaceBlockEntity.OUTPUT_SLOT)
}
}
expectOutput(Items.IRON_BLOCK, (int) (1500 / TechRebornConfig.cookingScale), IronFurnaceBlockEntity.OUTPUT_SLOT)
}
}
}

View file

@ -29,7 +29,7 @@ import net.minecraft.fluid.Fluid;
import reborncore.common.fluid.FluidUtils;
public record FluidGeneratorRecipe(Fluid fluid, int energyPerMb,
EFluidGenerator generatorType) {
EFluidGenerator generatorType) {
public int getEnergyPerBucket() {
return energyPerMb * 1000;

View file

@ -35,9 +35,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

View file

@ -133,7 +133,7 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
}
protected boolean tryAddingEnergy(int amount) {
if (getFreeSpace() > 0) {
if (getFreeSpace() > 0) {
addEnergy(amount);
return true;
}

View file

@ -121,8 +121,8 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
// Ok, we are actively generating power, but check for a few conditions that would restrict
// the generation to minimal production...
if (!world.getDimension().hasSkyLight() || // No light source in dimension (e.g. nether or end)
(skyAngle > 0.25 && skyAngle < 0.75) || // Light source is below horizon
(world.isRaining() || world.isThundering())) { // Weather is present
(skyAngle > 0.25 && skyAngle < 0.75) || // Light source is below horizon
(world.isRaining() || world.isThundering())) { // Weather is present
return getPanel().generationRateN;
}

View file

@ -62,9 +62,9 @@ public class AlarmBlockEntity extends BlockEntity
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.sendMessage(Text.translatable("techreborn.message.alarm")
.formatted(Formatting.GRAY)
.append(" Alarm ")
.append(String.valueOf(selectedSound)), true);
.formatted(Formatting.GRAY)
.append(" Alarm ")
.append(String.valueOf(selectedSound)), true);
}
}

View file

@ -73,4 +73,4 @@ public class DistillationTowerBlockEntity extends GenericMachineBlockEntity impl
public boolean canCraft(RebornRecipe rebornRecipe) {
return isMultiblockValid();
}
}
}

View file

@ -123,4 +123,4 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl
.addInventory().create(this, syncID);
}
}
}

View file

@ -62,7 +62,7 @@ public class VacuumFreezerBlockEntity extends GenericMachineBlockEntity implemen
.fill(0, 2, 0, 3, 3, 3, advanced);
}
// IContainerProvider
// IContainerProvider
@Override
public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) {
return new ScreenHandlerBuilder("vacuumfreezer").player(player.getInventory()).inventory().hotbar().addInventory()
@ -78,4 +78,4 @@ public class VacuumFreezerBlockEntity extends GenericMachineBlockEntity implemen
return super.canCraft(rebornRecipe);
}
}
}

View file

@ -62,4 +62,4 @@ public interface BlockProcessable extends IUpgradeHandler, RedstoneConfigurable,
default boolean canPlaySound() {
return true;
}
}
}

View file

@ -55,4 +55,4 @@ public class ChemicalReactorBlockEntity extends GenericMachineBlockEntity implem
.addInventory().blockEntity(this).slot(0, 34, 47).slot(1, 126, 47).outputSlot(2, 80, 47).energySlot(3, 8, 72)
.syncEnergyValue().syncCrafterValue().addInventory().create(this, syncID);
}
}
}

View file

@ -55,4 +55,4 @@ public class CompressorBlockEntity extends GenericMachineBlockEntity implements
.blockEntity(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create(this, syncID);
}
}
}

View file

@ -54,4 +54,4 @@ public class GrinderBlockEntity extends GenericMachineBlockEntity implements Bui
.slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
.addInventory().create(this, syncID);
}
}
}

View file

@ -60,4 +60,4 @@ public class IndustrialElectrolyzerBlockEntity extends GenericMachineBlockEntity
.outputSlot(2, 51, 24).outputSlot(3, 71, 24).outputSlot(4, 91, 24).outputSlot(5, 111, 24)
.energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this, syncID);
}
}
}

View file

@ -30,7 +30,6 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.math.BlockPos;
import net.minecraft.registry.Registry;
import reborncore.api.blockentity.IUpgrade;
import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.screen.BuiltScreenHandlerProvider;

View file

@ -60,4 +60,4 @@ public class ScrapboxinatorBlockEntity extends GenericMachineBlockEntity impleme
.blockEntity(this).filterSlot(0, 55, 45, stack -> stack.getItem() == TRContent.SCRAP_BOX).outputSlot(1, 101, 45)
.energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this, syncID);
}
}
}

View file

@ -60,4 +60,4 @@ public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity i
.outputSlot(4, 120, 44).outputSlot(5, 101, 63).energySlot(6, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create(this, syncID);
}
}
}

View file

@ -117,7 +117,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
if (world == null || world.isClient) {
return;
}
this.charge(11);
for (int i = 0; i < 6; i++) {

View file

@ -52,4 +52,4 @@ public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implement
.complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
.syncEnergyValue().addInventory().create(this, syncID);
}
}
}

View file

@ -53,4 +53,4 @@ public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity impleme
.syncEnergyValue().addInventory().create(this, syncID);
}
}
}

View file

@ -81,7 +81,7 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
dropStack.getOrCreateNbt().put("blockEntity", blockEntity);
return dropStack;
}
protected boolean canDrainTransfer(){
if (inventory == null || inventory.size() < 2){
return false;
@ -96,7 +96,7 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I
}
return true;
}
// MachineBaseBlockEntity
@Override
public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) {

View file

@ -173,4 +173,4 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity implements
.formatted(Formatting.GOLD)
);
}
}
}

View file

@ -57,7 +57,7 @@ public class BlockFusionCoil extends Block {
@SuppressWarnings("deprecation")
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, BlockHitResult hitResult) {
Hand hand, BlockHitResult hitResult) {
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
if (tool.isEmpty()) return ActionResult.PASS;
@ -83,4 +83,4 @@ public class BlockFusionCoil extends Block {
super.appendTooltip(stack, worldIn, tooltip, flagIn);
tooltip.add(Text.translatable("techreborn.tooltip.fusion_coil").formatted(Formatting.BLUE));
}
}
}

View file

@ -49,7 +49,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
@Override
public ActionResult onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, BlockHitResult hitResult) {
Hand hand, BlockHitResult hitResult) {
final FusionControlComputerBlockEntity blockEntityFusionControlComputer = (FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos);
if (!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())) {
List<BlockPos> coils = Torus.generate(blockEntityFusionControlComputer.getPos(), blockEntityFusionControlComputer.size);

Some files were not shown because too many files have changed in this diff Show more