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.fabricmc.api.Environment;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient; 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.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; 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.item.ItemStack;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
import org.joml.Matrix4f; import org.joml.Matrix4f;
import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.GL12;

View file

@ -55,7 +55,7 @@ public class RebornFluidRenderManager implements SimpleSynchronousResourceReload
private static void setupFluidRenderer(RebornFluid fluid) { private static void setupFluidRenderer(RebornFluid fluid) {
// Done lazy as we want to ensure we get the sprite at the correct time, // 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<>(() -> { TemporaryLazy<Sprite[]> sprites = new TemporaryLazy<>(() -> {
FluidSettings fluidSettings = fluid.getFluidSettings(); FluidSettings fluidSettings = fluid.getFluidSettings();
return new Sprite[]{RenderUtil.getSprite(fluidSettings.getStillTexture()), RenderUtil.getSprite(fluidSettings.getFlowingTexture())}; 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.MinecraftClient;
import net.minecraft.client.render.*; import net.minecraft.client.render.*;
import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.Sprite;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.texture.TextureManager; import net.minecraft.client.texture.TextureManager;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.Fluid; 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, 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)) { if (fluid == null || fluid.getFluid() == null || fluid.getAmount().lessThanOrEqual(FluidValue.EMPTY)) {
return; return;
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -570,7 +570,7 @@ public class GuiBuilder {
* @param layer {@link GuiBase.Layer} The layer to draw on * @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, 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 (gui.hideGuiElements()) return;
if (layer == GuiBase.Layer.BACKGROUND) { if (layer == GuiBase.Layer.BACKGROUND) {
x += gui.getGuiLeft(); 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.event.lifecycle.v1.ServerWorldEvents;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage; import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.fabricmc.loader.api.FabricLoader; 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.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -92,12 +89,12 @@ public class RebornCore implements ModInitializer {
BlockWrenchEventHandler.setup(); BlockWrenchEventHandler.setup();
/* /*
This is a generic multiblock tick handler. If you are using this code on your 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 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 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 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 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. ticks run only on the server, and only when worlds are loaded.
*/ */
ServerTickEvents.START_WORLD_TICK.register(MultiblockRegistry::tickStart); ServerTickEvents.START_WORLD_TICK.register(MultiblockRegistry::tickStart);
@ -108,7 +105,7 @@ public class RebornCore implements ModInitializer {
RebornCoreTags.WATER_EXPLOSION_ITEM.toString(); RebornCoreTags.WATER_EXPLOSION_ITEM.toString();
PaddedShapedRecipe.PADDED.toString(); PaddedShapedRecipe.PADDED.toString();
/* register UnloadHandler */ /* register UnloadHandler */
ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.register((blockEntity, world) -> { ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.register((blockEntity, world) -> {
if (blockEntity instanceof UnloadHandler) ((UnloadHandler) blockEntity).onUnload(); 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){ 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.ServerChunkManager;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.registry.Registry;
import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.chunk.ChunkStatus;
import reborncore.common.network.ClientBoundPackets; import reborncore.common.network.ClientBoundPackets;
import reborncore.common.network.IdentifiedPacket; import reborncore.common.network.IdentifiedPacket;
@ -185,4 +184,4 @@ public class RebornCoreCommands {
IdentifiedPacket packet = ClientBoundPackets.createPacketQueueItemStacksToRender(stacks); IdentifiedPacket packet = ClientBoundPackets.createPacketQueueItemStacksToRender(stacks);
NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer()); NetworkManager.sendToPlayer(packet, ctx.getSource().getPlayer());
} }
} }

View file

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

View file

@ -151,9 +151,9 @@ public class SlotConfiguration implements NBTSerializable {
sideMap = new HashMap<>(); sideMap = new HashMap<>();
read(tagCompound); read(tagCompound);
Validate.isTrue(Arrays.stream(Direction.values()) Validate.isTrue(Arrays.stream(Direction.values())
.map(enumFacing -> sideMap.get(enumFacing)) .map(enumFacing -> sideMap.get(enumFacing))
.noneMatch(Objects::isNull), .noneMatch(Objects::isNull),
"sideMap failed to load from nbt" "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.registry.Registries;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import reborncore.RebornCore; import reborncore.RebornCore;
import reborncore.api.recipe.IRecipeCrafterProvider; 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.Identifier;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import net.minecraft.registry.Registry;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import reborncore.common.util.DefaultedListCollector; 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.Registries;
import net.minecraft.registry.tag.TagKey; import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntry;
import java.util.Map; import java.util.Map;

View file

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

View file

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

View file

@ -35,7 +35,6 @@ import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey; import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntry;
import org.apache.commons.lang3.Validate; 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.nbt.NbtOps;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import net.minecraft.registry.Registry;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RecipeUtils; import reborncore.common.crafting.RecipeUtils;
import reborncore.common.crafting.ingredient.IngredientFactory; 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.fluid.Fluid;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper; import net.minecraft.util.JsonHelper;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View file

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

View file

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

View file

@ -26,5 +26,5 @@ package reborncore.common.misc;
@FunctionalInterface @FunctionalInterface
public interface TriConsumer<A, B, C> { 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 abstract class IMultiblockPart extends BlockEntity {
public static final int INVALID_DISTANCE = Integer.MAX_VALUE; 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); super(type, pos, state);
} }
@ -99,7 +99,7 @@ public abstract class IMultiblockPart extends BlockEntity {
* @see #onDetached(MultiblockControllerBase) * @see #onDetached(MultiblockControllerBase)
*/ */
public abstract void onOrphaned(MultiblockControllerBase oldController, int oldControllerSize, public abstract void onOrphaned(MultiblockControllerBase oldController, int oldControllerSize,
int newControllerSize); int newControllerSize);
// Multiblock fuse/split helper methods. Here there be dragons. // 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.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandler;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import reborncore.common.blockentity.FluidConfiguration; import reborncore.common.blockentity.FluidConfiguration;

View file

@ -55,7 +55,7 @@ public class ServerBoundPackets {
NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase); NetworkManager.sendToTracking(packetFluidConfigSync, legacyMachineBase);
// We update the block to allow pipes that are connecting to detect the update and change their // 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(); World world = legacyMachineBase.getWorld();
BlockState blockState = world.getBlockState(legacyMachineBase.getPos()); BlockState blockState = world.getBlockState(legacyMachineBase.getPos());
world.updateNeighborsAlways(legacyMachineBase.getPos(), blockState.getBlock()); 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 * @return {@code long} Energy stored in block entity
*/ */
public long getEnergy() { 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, public RecipeCrafter(RebornRecipeType<?> recipeType, BlockEntity blockEntity, int inputs, int outputs, RebornInventory<?> inventory,
int[] inputSlots, int[] outputSlots) { int[] inputSlots, int[] outputSlots) {
this.recipeType = recipeType; this.recipeType = recipeType;
this.blockEntity = blockEntity; this.blockEntity = blockEntity;
if (blockEntity instanceof PowerAcceptorBlockEntity powerAcceptor) { 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. // 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(); ItemStack largeStack = stack.copy();
largeStack.setCount(largeStack.getMaxCount()); largeStack.setCount(largeStack.getMaxCount());
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) { for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,4 +52,4 @@ public abstract class MixinCraftingResultSlot {
ItemCraftCallback.EVENT.invoker().onCraft(itemStack, input, player); 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.entity.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;

View file

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

View file

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

View file

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

View file

@ -25,7 +25,6 @@
package techreborn.client.compat.rei.fluidgenerator; package techreborn.client.compat.rei.fluidgenerator;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import me.shedaniel.math.Point;
import me.shedaniel.math.Rectangle; import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.api.client.ClientHelper; import me.shedaniel.rei.api.client.ClientHelper;
import me.shedaniel.rei.api.client.gui.Renderer; 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.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.registry.Registry;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
import reborncore.common.BaseBlockEntityProvider; import reborncore.common.BaseBlockEntityProvider;
import techreborn.blocks.cable.CableBlock; 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) { protected void drawForeground(MatrixStack matrixStack, final int mouseX, final int mouseY) {
super.drawForeground(matrixStack, mouseX, mouseY); super.drawForeground(matrixStack, mouseX, mouseY);
final Layer layer = Layer.FOREGROUND; final Layer layer = Layer.FOREGROUND;
builder.drawMultiEnergyBar(matrixStack, this, 9, 19, (int) blockEntity.getEnergy(), (int) blockEntity.getMaxStoredPower(), mouseX, mouseY, 0, layer); 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(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())) addDrawableChild(ButtonWidget.builder(Text.literal("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))
.position(x + 10, y + 70) .position(x + 10, y + 70)
.size(155, 20) .size(155, 20)
.build()); .build());
} }
@Override @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) { public void onClick(GuiButtonExtended button, Double x, Double y) {
blockEntity.renderMultiblock ^= !hideGuiElements(); 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.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); 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); super.render(matrixStack, mouseX, mouseY, partialTicks);
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -61,7 +61,7 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
generateGlassFromGlassPane() generateGlassFromGlassPane()
generateAnvil() generateAnvil()
} }
void generateBoots() { void generateBoots() {
final int count = 2 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.MILK_BUCKET,
Items.LAVA_BUCKET, Items.LAVA_BUCKET,
Items.POWDER_SNOW_BUCKET, Items.POWDER_SNOW_BUCKET,
Items.WATER_BUCKET Items.WATER_BUCKET
].each {bucket -> ].each {bucket ->
offerExtractorRecipe { offerExtractorRecipe {
ingredients bucket ingredients bucket
@ -138,7 +138,7 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
Items.EXPERIENCE_BOTTLE, Items.EXPERIENCE_BOTTLE,
Items.HONEY_BOTTLE, Items.HONEY_BOTTLE,
Items.LINGERING_POTION, Items.LINGERING_POTION,
Items.POTION, Items.POTION,
Items.SPLASH_POTION Items.SPLASH_POTION
].each {bottle -> ].each {bottle ->
offerExtractorRecipe { offerExtractorRecipe {
@ -160,4 +160,4 @@ class ExtractorRecipesProvider extends TechRebornRecipesProvider {
} }
} }
} }

View file

@ -186,7 +186,7 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
} }
} }
} }
void generateConcretePowder() { void generateConcretePowder() {
[ [
(Items.BLACK_CONCRETE): Items.BLACK_CONCRETE_POWDER, (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) { protected IndustrialGrinderRecipe createRecipe(Identifier identifier) {
return new IndustrialGrinderRecipe(ModRecipes.INDUSTRIAL_GRINDER, identifier, ingredients, outputs, power, time, new FluidInstance(fluid, FluidValue.fromMillibuckets(fluidAmount))) 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) { protected IndustrialSawmillRecipe createRecipe(Identifier identifier) {
return new IndustrialSawmillRecipe(ModRecipes.INDUSTRIAL_SAWMILL, identifier, ingredients, outputs, power, time, new FluidInstance(fluid, FluidValue.fromMillibuckets(fluidAmount))) 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) criterion getCriterionName(ItemTags.WOODEN_BUTTONS), getCriterionConditions(ItemTags.WOODEN_BUTTONS)
} }
} }
} }

View file

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

View file

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

View file

@ -32,28 +32,28 @@ import reborncore.common.blockentity.MachineBaseBlockEntity
import techreborn.init.TRContent import techreborn.init.TRContent
class TRTestContext extends TestContext { class TRTestContext extends TestContext {
TRTestContext(TestContext parentContext) { TRTestContext(TestContext parentContext) {
//noinspection GroovyAccessibility //noinspection GroovyAccessibility
super(parentContext.test) super(parentContext.test)
} }
/** /**
* Place a machine with a creative solar panel * Place a machine with a creative solar panel
*/ */
def poweredMachine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) { def poweredMachine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 2, 0) def machinePos = new BlockPos(0, 2, 0)
setBlockState(machinePos, machine.block) setBlockState(machinePos, machine.block)
setBlockState(machinePos.down(), TRContent.SolarPanels.CREATIVE.block) setBlockState(machinePos.down(), TRContent.SolarPanels.CREATIVE.block)
waitAndRun(5) { waitAndRun(5) {
try { try {
new MachineContext(machinePos).with(machineContextClosure) new MachineContext(machinePos).with(machineContextClosure)
} catch (e) { } catch (e) {
e.printStackTrace() e.printStackTrace()
throw e throw e
} }
} }
} }
def machine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) { def machine(TRContent.Machine machine, @DelegatesTo(MachineContext) Closure machineContextClosure) {
def machinePos = new BlockPos(0, 1, 0) def machinePos = new BlockPos(0, 1, 0)
@ -69,59 +69,59 @@ class TRTestContext extends TestContext {
} }
} }
class MachineContext { class MachineContext {
final BlockPos machinePos final BlockPos machinePos
MachineContext(BlockPos machinePos) { MachineContext(BlockPos machinePos) {
this.machinePos = machinePos this.machinePos = machinePos
} }
def input(ItemConvertible item, int slot = -1) { def input(ItemConvertible item, int slot = -1) {
this.input(new ItemStack(item), slot) this.input(new ItemStack(item), slot)
} }
def input(ItemStack stack, int slot = -1) { def input(ItemStack stack, int slot = -1) {
if (slot == -1) { if (slot == -1) {
// If not slot is provided use the first input slot // If not slot is provided use the first input slot
slot = blockEntity.crafter.inputSlots[0] slot = blockEntity.crafter.inputSlots[0]
} }
blockEntity.inventory.setStack(slot, stack) blockEntity.inventory.setStack(slot, stack)
} }
def expectOutput(ItemConvertible item, int ticks, int slot = -1) { def expectOutput(ItemConvertible item, int ticks, int slot = -1) {
expectOutput(new ItemStack(item), ticks, slot) expectOutput(new ItemStack(item), ticks, slot)
} }
def expectOutput(ItemStack stack, int ticks, int slot = -1) { def expectOutput(ItemStack stack, int ticks, int slot = -1) {
if (slot == -1) { if (slot == -1) {
// If not slot is provided use the first output slot // If not slot is provided use the first output slot
slot = blockEntity.crafter.outputSlots[0] slot = blockEntity.crafter.outputSlots[0]
} }
addFinalTaskWithDuration(ticks) { addFinalTaskWithDuration(ticks) {
if (!blockEntity.inventory.getStack(slot).isItemEqual(stack)) { if (!blockEntity.inventory.getStack(slot).isItemEqual(stack)) {
throwGameTestException("Failed to find $stack in slot $slot") throwGameTestException("Failed to find $stack in slot $slot")
} }
} }
} }
def withUpgrades(TRContent.Upgrades upgrade, int count = -1) { def withUpgrades(TRContent.Upgrades upgrade, int count = -1) {
count = (count != -1 ? count : blockEntity.getUpgradeSlotCount()) -1 count = (count != -1 ? count : blockEntity.getUpgradeSlotCount()) -1
(0..count).each { (0..count).each {
blockEntity.upgradeInventory.setStack(it, new ItemStack(upgrade)) blockEntity.upgradeInventory.setStack(it, new ItemStack(upgrade))
} }
} }
MachineBaseBlockEntity getBlockEntity() { MachineBaseBlockEntity getBlockEntity() {
def be = getBlockEntity(machinePos) def be = getBlockEntity(machinePos)
if (!be) { if (!be) {
throwPositionedException("Failed to get machine block entity", machinePos) 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 import techreborn.test.TRTestContext
class GrinderTest extends TRGameTest { class GrinderTest extends TRGameTest {
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150) @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 150)
def testGrind2OCs(TRTestContext context) { def testGrind2OCs(TRTestContext context) {
/** /**
* Test that grinder with 2 overclocker upgrades grinds coal into coal dust in 116 ticks * Test that grinder with 2 overclocker upgrades grinds coal into coal dust in 116 ticks
*/ */
context.poweredMachine(TRContent.Machine.GRINDER) { context.poweredMachine(TRContent.Machine.GRINDER) {
input(Items.COAL) 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 import techreborn.test.TRTestContext
class IronAlloyFurnaceTest extends TRGameTest { class IronAlloyFurnaceTest extends TRGameTest {
@GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000) @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronAlloyFurnaceElectrumAlloyIngot(TRTestContext context) { 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 * Test that the Iron Alloy Furnace smelts a gold ingot and a silver ingot into an electrum alloy ingot in 200
* Verifies: Issue #2850 * 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.COAL_BLOCK, IronAlloyFurnaceBlockEntity.FUEL_SLOT)
input(Items.GOLD_INGOT, IronAlloyFurnaceBlockEntity.INPUT_SLOT_1) input(Items.GOLD_INGOT, IronAlloyFurnaceBlockEntity.INPUT_SLOT_1)
input(TRContent.Ingots.SILVER, IronAlloyFurnaceBlockEntity.INPUT_SLOT_2) 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) @GameTest(templateName = "fabric-gametest-api-v1:empty", tickLimit = 2000)
def testIronFurnaceSmeltRawIronBlock(TRTestContext context) { def testIronFurnaceSmeltRawIronBlock(TRTestContext context) {
/** /**
* Test that the Iron Furnace smelts a raw iron block into an iron block in 1500 ticks instead of 200 * Test that the Iron Furnace smelts a raw iron block into an iron block in 1500 ticks instead of 200
* Verifies: Issue #2850 * Verifies: Issue #2850
*/ */
context.machine(TRContent.Machine.IRON_FURNACE) { context.machine(TRContent.Machine.IRON_FURNACE) {
input(Items.COAL_BLOCK, IronFurnaceBlockEntity.FUEL_SLOT) 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; import reborncore.common.fluid.FluidUtils;
public record FluidGeneratorRecipe(Fluid fluid, int energyPerMb, public record FluidGeneratorRecipe(Fluid fluid, int energyPerMb,
EFluidGenerator generatorType) { EFluidGenerator generatorType) {
public int getEnergyPerBucket() { public int getEnergyPerBucket() {
return energyPerMb * 1000; return energyPerMb * 1000;

View file

@ -35,9 +35,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtHelper; import net.minecraft.nbt.NbtHelper;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; 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.server.world.ServerWorld;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;

View file

@ -133,7 +133,7 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn
} }
protected boolean tryAddingEnergy(int amount) { protected boolean tryAddingEnergy(int amount) {
if (getFreeSpace() > 0) { if (getFreeSpace() > 0) {
addEnergy(amount); addEnergy(amount);
return true; 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 // Ok, we are actively generating power, but check for a few conditions that would restrict
// the generation to minimal production... // the generation to minimal production...
if (!world.getDimension().hasSkyLight() || // No light source in dimension (e.g. nether or end) 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 (skyAngle > 0.25 && skyAngle < 0.75) || // Light source is below horizon
(world.isRaining() || world.isThundering())) { // Weather is present (world.isRaining() || world.isThundering())) { // Weather is present
return getPanel().generationRateN; return getPanel().generationRateN;
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -62,4 +62,4 @@ public interface BlockProcessable extends IUpgradeHandler, RedstoneConfigurable,
default boolean canPlaySound() { default boolean canPlaySound() {
return true; 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) .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); .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() .blockEntity(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create(this, syncID); .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() .slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue()
.addInventory().create(this, syncID); .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) .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); .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.item.ItemStack;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.registry.Registry;
import reborncore.api.blockentity.IUpgrade; import reborncore.api.blockentity.IUpgrade;
import reborncore.common.screen.BuiltScreenHandler; import reborncore.common.screen.BuiltScreenHandler;
import reborncore.common.screen.BuiltScreenHandlerProvider; 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) .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); .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() .outputSlot(4, 120, 44).outputSlot(5, 101, 63).energySlot(6, 8, 72).syncEnergyValue()
.syncCrafterValue().addInventory().create(this, syncID); .syncCrafterValue().addInventory().create(this, syncID);
} }
} }

View file

@ -117,7 +117,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity
if (world == null || world.isClient) { if (world == null || world.isClient) {
return; return;
} }
this.charge(11); this.charge(11);
for (int i = 0; i < 6; i++) { 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) .complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45)
.syncEnergyValue().addInventory().create(this, syncID); .syncEnergyValue().addInventory().create(this, syncID);
} }
} }

View file

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

View file

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

View file

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

View file

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