diff --git a/RebornCore/src/main/java/reborncore/common/util/BiObseravable.java b/RebornCore/src/main/java/reborncore/common/util/BiObseravable.java index 4672ee41b..e855c5330 100644 --- a/RebornCore/src/main/java/reborncore/common/util/BiObseravable.java +++ b/RebornCore/src/main/java/reborncore/common/util/BiObseravable.java @@ -62,6 +62,18 @@ public class BiObseravable { return b; } + public boolean hasA() { + return a != null; + } + + public boolean hasB() { + return b != null; + } + + public boolean hasBoth() { + return hasA() && hasB(); + } + private void fireListeners() { if (a == null || b == null) { return; diff --git a/build.gradle b/build.gradle index 07232990d..fac4b2732 100644 --- a/build.gradle +++ b/build.gradle @@ -153,9 +153,9 @@ dependencies { api project(":RebornCore") include project(":RebornCore") - optionalDependency "me.shedaniel:RoughlyEnoughItems:5.8.9" + disabledOptionalDependency "me.shedaniel:RoughlyEnoughItems:5.8.9" disabledOptionalDependency ('com.github.emilyploszaj:trinkets:2.6.7') - optionalDependency "com.github.dexman545:autoswitch-api:-SNAPSHOT" + disabledOptionalDependency "com.github.dexman545:autoswitch-api:-SNAPSHOT" } def optionalDependency(String dep) { diff --git a/src/main/java/techreborn/TechRebornClient.java b/src/main/java/techreborn/TechRebornClient.java index 8203695cb..7cdb5fa41 100644 --- a/src/main/java/techreborn/TechRebornClient.java +++ b/src/main/java/techreborn/TechRebornClient.java @@ -31,6 +31,7 @@ import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.renderer.v1.RendererAccess; import net.minecraft.client.item.ModelPredicateProvider; +import net.minecraft.client.item.UnclampedModelPredicateProvider; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; @@ -182,7 +183,7 @@ public class TechRebornClient implements ClientModInitializer { registerPredicateProvider( BatpackItem.class, new Identifier("techreborn:empty"), - (item, stack, world, entity) -> { + (item, stack, world, entity, seed) -> { if (!stack.isEmpty() && Energy.of(stack).getEnergy() == 0) { return 1.0F; } @@ -193,7 +194,7 @@ public class TechRebornClient implements ClientModInitializer { registerPredicateProvider( BatteryItem.class, new Identifier("techreborn:empty"), - (item, stack, world, entity) -> { + (item, stack, world, entity, seed) -> { if (!stack.isEmpty() && Energy.of(stack).getEnergy() == 0) { return 1.0F; } @@ -204,7 +205,7 @@ public class TechRebornClient implements ClientModInitializer { registerPredicateProvider( FrequencyTransmitterItem.class, new Identifier("techreborn:coords"), - (item, stack, world, entity) -> { + (item, stack, world, entity, seed) -> { if (!stack.isEmpty() && stack.hasTag() && stack.getTag() != null && stack.getTag().contains("x") && stack.getTag().contains("y") && stack.getTag().contains("z") && stack.getTag().contains("dim")) { return 1.0F; @@ -216,7 +217,7 @@ public class TechRebornClient implements ClientModInitializer { registerPredicateProvider( ChainsawItem.class, new Identifier("techreborn:animated"), - (item, stack, world, entity) -> { + (item, stack, world, entity, seed) -> { if (!stack.isEmpty() && Energy.of(stack).getEnergy() >= item.getCost() && entity != null && entity.getMainHandStack().equals(stack)) { return 1.0F; } @@ -227,7 +228,7 @@ public class TechRebornClient implements ClientModInitializer { registerPredicateProvider( NanosaberItem.class, new Identifier("techreborn:active"), - (item, stack, world, entity) -> { + (item, stack, world, entity, seed) -> { if (ItemUtils.isActive(stack)) { if (Energy.of(stack).getMaxStored() - Energy.of(stack).getEnergy() >= 0.9 * Energy.of(stack).getMaxStored()) { return 0.5F; @@ -247,13 +248,14 @@ public class TechRebornClient implements ClientModInitializer { } //Need the item instance in a few places, this makes it easier - private interface ItemModelPredicateProvider extends ModelPredicateProvider { + private interface ItemModelPredicateProvider extends UnclampedModelPredicateProvider { - float call(T item, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity); + float call(T item, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity, int seed); @Override - default float call(ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) { - return call((T) stack.getItem(), stack, world, entity); + default float unclampedCall(ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity, int seed) { + return call((T) stack.getItem(), stack, world, entity, seed); } + } } diff --git a/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java b/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java index dcfe8326f..9f55eb563 100644 --- a/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java +++ b/src/main/java/techreborn/blockentity/cable/CableBlockEntity.java @@ -36,8 +36,10 @@ import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; -import net.minecraft.util.Tickable; +import net.minecraft.block.entity.BlockEntityTicker; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; import org.apache.commons.lang3.tuple.Pair; import reborncore.api.IListInfoProvider; import reborncore.api.IToolDrop; @@ -63,19 +65,19 @@ import java.util.List; */ public class CableBlockEntity extends BlockEntity - implements Tickable, IListInfoProvider, IToolDrop, EnergyStorage { + implements BlockEntityTicker, IListInfoProvider, IToolDrop, EnergyStorage { private double energy = 0; private TRContent.Cables cableType = null; private ArrayList sendingFace = new ArrayList<>(); private BlockState cover = null; - public CableBlockEntity() { - super(TRBlockEntities.CABLE); + public CableBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.CABLE, pos, state); } - public CableBlockEntity(TRContent.Cables type) { - super(TRBlockEntities.CABLE); + public CableBlockEntity(BlockPos pos, BlockState state, TRContent.Cables type) { + super(TRBlockEntities.CABLE, pos, state); this.cableType = type; } @@ -134,8 +136,8 @@ public class CableBlockEntity extends BlockEntity } @Override - public void readNbt(BlockState blockState, NbtCompound compound) { - super.readNbt(blockState, compound); + public void readNbt(NbtCompound compound) { + super.readNbt(compound); if (compound.contains("energy")) { energy = compound.getDouble("energy"); } @@ -158,8 +160,11 @@ public class CableBlockEntity extends BlockEntity // Tickable @Override - public void tick() { - if (world == null || world.isClient) { + public void tick(World world, BlockPos pos, BlockState state, CableBlockEntity blockEntity2) { + if (world == null) { + return; + } + if (world.isClient) { return; } @@ -174,12 +179,7 @@ public class CableBlockEntity extends BlockEntity for (Direction face : Direction.values()) { BlockEntity blockEntity = world.getBlockEntity(pos.offset(face)); - - if (blockEntity == null) { - continue; - } - - if (!Energy.valid(blockEntity)) { + if (blockEntity == null || !Energy.valid(blockEntity)) { continue; } diff --git a/src/main/java/techreborn/blockentity/data/DataDrivenBEProvider.java b/src/main/java/techreborn/blockentity/data/DataDrivenBEProvider.java index 07357f476..0dd300e37 100644 --- a/src/main/java/techreborn/blockentity/data/DataDrivenBEProvider.java +++ b/src/main/java/techreborn/blockentity/data/DataDrivenBEProvider.java @@ -28,15 +28,18 @@ import com.google.common.collect.ImmutableSet; import com.google.gson.JsonObject; import net.fabricmc.loader.launch.common.FabricLauncherBase; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Identifier; import net.minecraft.util.JsonHelper; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.text.WordUtils; +import org.jetbrains.annotations.Nullable; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BlockEntityScreenHandlerBuilder; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -48,13 +51,12 @@ import reborncore.common.util.serialization.SerializationUtil; import techreborn.blockentity.machine.GenericMachineBlockEntity; import techreborn.init.ModRecipes; -import org.jetbrains.annotations.Nullable; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.List; -import java.util.function.Supplier; +import java.util.function.BiFunction; -public class DataDrivenBEProvider extends BlockEntityType implements Supplier { +public class DataDrivenBEProvider extends BlockEntityType implements BiFunction { private final Identifier identifier; private final Block block; @@ -89,12 +91,12 @@ public class DataDrivenBEProvider extends BlockEntityType dataDrivenSlot.add(builder)); @@ -106,16 +108,16 @@ public class DataDrivenBEProvider extends BlockEntityType recipeType = ModRecipes.byName(provider.identifier); diff --git a/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java b/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java index c8593ab1b..a49e65f7f 100644 --- a/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/BaseFluidGeneratorBlockEntity.java @@ -28,10 +28,13 @@ import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import org.apache.commons.lang3.Validate; import org.jetbrains.annotations.Nullable; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.fluid.FluidValue; import reborncore.common.fluid.container.ItemFluidInfo; @@ -62,8 +65,8 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn */ double pendingWithdraw = 0.0; - public BaseFluidGeneratorBlockEntity(BlockEntityType blockEntityType, EFluidGenerator type, String blockEntityName, FluidValue tankCapacity, int euTick) { - super(blockEntityType); + public BaseFluidGeneratorBlockEntity(BlockEntityType blockEntityType, BlockPos pos, BlockState state, EFluidGenerator type, String blockEntityName, FluidValue tankCapacity, int euTick) { + super(blockEntityType, pos, state); recipes = GeneratorRecipeHelper.getFluidRecipesForGenerator(type); Validate.notNull(recipes, "null recipe list for " + type.getRecipeID()); tank = new Tank(blockEntityName, tankCapacity, this); @@ -74,8 +77,8 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn @SuppressWarnings("deprecation") @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null) { return; @@ -167,8 +170,8 @@ public abstract class BaseFluidGeneratorBlockEntity extends PowerAcceptorBlockEn } @Override - public void readNbt(BlockState blockState, NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(NbtCompound tagCompound) { + super.readNbt(tagCompound); tank.read(tagCompound); } diff --git a/src/main/java/techreborn/blockentity/generator/LightningRodBlockEntity.java b/src/main/java/techreborn/blockentity/generator/LightningRodBlockEntity.java index 984f67a2f..5a8101078 100644 --- a/src/main/java/techreborn/blockentity/generator/LightningRodBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/LightningRodBlockEntity.java @@ -25,15 +25,17 @@ package techreborn.blockentity.generator; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.entity.EntityType; import net.minecraft.entity.LightningEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import net.minecraft.world.Heightmap; +import net.minecraft.world.World; import reborncore.api.IToolDrop; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import team.reborn.energy.EnergySide; @@ -46,13 +48,13 @@ public class LightningRodBlockEntity extends PowerAcceptorBlockEntity implements private int onStatusHoldTicks = -1; - public LightningRodBlockEntity() { - super(TRBlockEntities.LIGHTNING_ROD); + public LightningRodBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.LIGHTNING_ROD, pos, state); } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null){ return; diff --git a/src/main/java/techreborn/blockentity/generator/PlasmaGeneratorBlockEntity.java b/src/main/java/techreborn/blockentity/generator/PlasmaGeneratorBlockEntity.java index aec21b7dd..8ab17a9e8 100644 --- a/src/main/java/techreborn/blockentity/generator/PlasmaGeneratorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/PlasmaGeneratorBlockEntity.java @@ -24,8 +24,10 @@ package techreborn.blockentity.generator; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -37,8 +39,8 @@ import techreborn.init.TRContent; public class PlasmaGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity implements BuiltScreenHandlerProvider { - public PlasmaGeneratorBlockEntity() { - super(TRBlockEntities.PLASMA_GENERATOR, EFluidGenerator.PLASMA, "PlasmaGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.plasmaGeneratorEnergyPerTick); + public PlasmaGeneratorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.PLASMA_GENERATOR, pos, state, EFluidGenerator.PLASMA, "PlasmaGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.plasmaGeneratorEnergyPerTick); } @Override @@ -58,7 +60,7 @@ public class PlasmaGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity im @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("plasmagenerator").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("plasmagenerator").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue() .sync(this::getTicksSinceLastChange, this::setTicksSinceLastChange) .sync(this::getTankAmount, this::setTankAmount) diff --git a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java index e5257e6a1..ae4b047a3 100644 --- a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java @@ -33,10 +33,13 @@ import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.powerSystem.PowerSystem; @@ -65,12 +68,12 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I private SolarPanels panel; - public SolarPanelBlockEntity() { - super(TRBlockEntities.SOLAR_PANEL); + public SolarPanelBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.SOLAR_PANEL, pos, state); } - public SolarPanelBlockEntity(SolarPanels panel) { - super(TRBlockEntities.SOLAR_PANEL); + public SolarPanelBlockEntity(BlockPos pos, BlockState state, SolarPanels panel) { + super(TRBlockEntities.SOLAR_PANEL, pos, state); this.panel = panel; } @@ -147,8 +150,8 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I // Overrides @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null) { return; @@ -264,13 +267,13 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I } @Override - public void readNbt(BlockState blockState, NbtCompound tag) { + public void readNbt(NbtCompound tag) { if (world == null) { // We are in BlockEntity.create method during chunk load. this.checkOverfill = false; } updatePanel(); - super.readNbt(blockState, tag); + super.readNbt(tag); } // MachineBaseBlockEntity @@ -288,7 +291,7 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("solar_panel").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("solar_panel").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).syncEnergyValue() .sync(this::getSunState, this::setSunState) .addInventory().create(this, syncID); diff --git a/src/main/java/techreborn/blockentity/generator/advanced/DieselGeneratorBlockEntity.java b/src/main/java/techreborn/blockentity/generator/advanced/DieselGeneratorBlockEntity.java index 2a6a04f79..ab085f964 100644 --- a/src/main/java/techreborn/blockentity/generator/advanced/DieselGeneratorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/advanced/DieselGeneratorBlockEntity.java @@ -24,8 +24,10 @@ package techreborn.blockentity.generator.advanced; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class DieselGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity implements BuiltScreenHandlerProvider { - public DieselGeneratorBlockEntity() { - super(TRBlockEntities.DIESEL_GENERATOR, EFluidGenerator.DIESEL, "DieselGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.dieselGeneratorEnergyPerTick); + public DieselGeneratorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.DIESEL_GENERATOR, pos, state, EFluidGenerator.DIESEL, "DieselGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.dieselGeneratorEnergyPerTick); } @Override @@ -59,7 +61,7 @@ public class DieselGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity im @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("dieselgenerator").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("dieselgenerator").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue() .sync(this::getTicksSinceLastChange, this::setTicksSinceLastChange) .sync(this::getTankAmount, this::setTankAmount) diff --git a/src/main/java/techreborn/blockentity/generator/advanced/DragonEggSyphonBlockEntity.java b/src/main/java/techreborn/blockentity/generator/advanced/DragonEggSyphonBlockEntity.java index 44b139f16..11086ed90 100644 --- a/src/main/java/techreborn/blockentity/generator/advanced/DragonEggSyphonBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/advanced/DragonEggSyphonBlockEntity.java @@ -24,12 +24,15 @@ package techreborn.blockentity.generator.advanced; +import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.RebornInventory; @@ -44,8 +47,8 @@ public class DragonEggSyphonBlockEntity extends PowerAcceptorBlockEntity public RebornInventory inventory = new RebornInventory<>(3, "DragonEggSyphonBlockEntity", 64, this); private long lastOutput = 0; - public DragonEggSyphonBlockEntity() { - super(TRBlockEntities.DRAGON_EGG_SYPHON); + public DragonEggSyphonBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.DRAGON_EGG_SYPHON, pos, state); } private boolean tryAddingEnergy(int amount) { @@ -59,8 +62,8 @@ public class DragonEggSyphonBlockEntity extends PowerAcceptorBlockEntity // PowerAcceptorBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null) { return; diff --git a/src/main/java/techreborn/blockentity/generator/advanced/GasTurbineBlockEntity.java b/src/main/java/techreborn/blockentity/generator/advanced/GasTurbineBlockEntity.java index 92bc2bd7d..bf038d860 100644 --- a/src/main/java/techreborn/blockentity/generator/advanced/GasTurbineBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/advanced/GasTurbineBlockEntity.java @@ -24,8 +24,10 @@ package techreborn.blockentity.generator.advanced; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class GasTurbineBlockEntity extends BaseFluidGeneratorBlockEntity implements BuiltScreenHandlerProvider { - public GasTurbineBlockEntity() { - super(TRBlockEntities.GAS_TURBINE, EFluidGenerator.GAS, "GasTurbineBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.gasTurbineEnergyPerTick); + public GasTurbineBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.GAS_TURBINE, pos, state, EFluidGenerator.GAS, "GasTurbineBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.gasTurbineEnergyPerTick); } @Override @@ -59,7 +61,7 @@ public class GasTurbineBlockEntity extends BaseFluidGeneratorBlockEntity impleme @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("gasturbine").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("gasturbine").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue() .sync(this::getTicksSinceLastChange, this::setTicksSinceLastChange) .sync(this::getTankAmount, this::setTankAmount) diff --git a/src/main/java/techreborn/blockentity/generator/advanced/SemiFluidGeneratorBlockEntity.java b/src/main/java/techreborn/blockentity/generator/advanced/SemiFluidGeneratorBlockEntity.java index 865375b04..ac0828bfc 100644 --- a/src/main/java/techreborn/blockentity/generator/advanced/SemiFluidGeneratorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/advanced/SemiFluidGeneratorBlockEntity.java @@ -24,8 +24,10 @@ package techreborn.blockentity.generator.advanced; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class SemiFluidGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity implements BuiltScreenHandlerProvider { - public SemiFluidGeneratorBlockEntity() { - super(TRBlockEntities.SEMI_FLUID_GENERATOR, EFluidGenerator.SEMIFLUID, "SemiFluidGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.semiFluidGeneratorEnergyPerTick); + public SemiFluidGeneratorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.SEMI_FLUID_GENERATOR, pos, state, EFluidGenerator.SEMIFLUID, "SemiFluidGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.semiFluidGeneratorEnergyPerTick); } @Override @@ -59,7 +61,7 @@ public class SemiFluidGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("semifluidgenerator").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("semifluidgenerator").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue() .sync(this::getTicksSinceLastChange, this::setTicksSinceLastChange) .sync(this::getTankAmount, this::setTankAmount) diff --git a/src/main/java/techreborn/blockentity/generator/advanced/ThermalGeneratorBlockEntity.java b/src/main/java/techreborn/blockentity/generator/advanced/ThermalGeneratorBlockEntity.java index ed92f7c16..0d27d710a 100644 --- a/src/main/java/techreborn/blockentity/generator/advanced/ThermalGeneratorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/advanced/ThermalGeneratorBlockEntity.java @@ -24,8 +24,10 @@ package techreborn.blockentity.generator.advanced; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class ThermalGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity implements BuiltScreenHandlerProvider { - public ThermalGeneratorBlockEntity() { - super(TRBlockEntities.THERMAL_GEN, EFluidGenerator.THERMAL, "ThermalGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.thermalGeneratorEnergyPerTick); + public ThermalGeneratorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.THERMAL_GEN, pos, state, EFluidGenerator.THERMAL, "ThermalGeneratorBlockEntity", FluidValue.BUCKET.multiply(10), TechRebornConfig.thermalGeneratorEnergyPerTick); } @Override @@ -59,7 +61,7 @@ public class ThermalGeneratorBlockEntity extends BaseFluidGeneratorBlockEntity i @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("thermalgenerator").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("thermalgenerator").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this).slot(0, 25, 35).outputSlot(1, 25, 55).syncEnergyValue() .sync(this::getTicksSinceLastChange, this::setTicksSinceLastChange) .sync(this::getTankAmount, this::setTankAmount) diff --git a/src/main/java/techreborn/blockentity/generator/basic/SolidFuelGeneratorBlockEntity.java b/src/main/java/techreborn/blockentity/generator/basic/SolidFuelGeneratorBlockEntity.java index c07a21e7f..ab8b4f924 100644 --- a/src/main/java/techreborn/blockentity/generator/basic/SolidFuelGeneratorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/basic/SolidFuelGeneratorBlockEntity.java @@ -31,11 +31,15 @@ import net.minecraft.item.BucketItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.jetbrains.annotations.NotNull; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.RebornInventory; @@ -44,7 +48,6 @@ import techreborn.config.TechRebornConfig; import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; -import org.jetbrains.annotations.NotNull; import java.util.Map; public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop, InventoryProvider, BuiltScreenHandlerProvider { @@ -59,8 +62,8 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl public boolean lastTickBurning; ItemStack burnItem; - public SolidFuelGeneratorBlockEntity() { - super(TRBlockEntities.SOLID_FUEL_GENEREATOR); + public SolidFuelGeneratorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.SOLID_FUEL_GENEREATOR, pos, state); } public static int getItemBurnTime(@NotNull ItemStack stack) { @@ -75,8 +78,8 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null){ return; } @@ -180,7 +183,7 @@ public class SolidFuelGeneratorBlockEntity extends PowerAcceptorBlockEntity impl @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("generator").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("generator").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).fuelSlot(0, 80, 54).energySlot(1, 8, 72).syncEnergyValue() .sync(this::getBurnTime, this::setBurnTime) .sync(this::getTotalBurnTime, this::setTotalBurnTime).addInventory().create(this, syncID); diff --git a/src/main/java/techreborn/blockentity/generator/basic/WaterMillBlockEntity.java b/src/main/java/techreborn/blockentity/generator/basic/WaterMillBlockEntity.java index 5c5a4c144..bfd76a2e1 100644 --- a/src/main/java/techreborn/blockentity/generator/basic/WaterMillBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/basic/WaterMillBlockEntity.java @@ -24,11 +24,15 @@ package techreborn.blockentity.generator.basic; +import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; import reborncore.api.IToolDrop; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import team.reborn.energy.EnergySide; @@ -43,13 +47,13 @@ public class WaterMillBlockEntity extends PowerAcceptorBlockEntity implements IT int waterblocks = 0; - public WaterMillBlockEntity() { - super(TRBlockEntities.WATER_MILL); + public WaterMillBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.WATER_MILL, pos, state); } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world.getTime() % 20 == 0) { checkForWater(); } diff --git a/src/main/java/techreborn/blockentity/generator/basic/WindMillBlockEntity.java b/src/main/java/techreborn/blockentity/generator/basic/WindMillBlockEntity.java index b433aab6a..d89c124df 100644 --- a/src/main/java/techreborn/blockentity/generator/basic/WindMillBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/basic/WindMillBlockEntity.java @@ -24,9 +24,13 @@ package techreborn.blockentity.generator.basic; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import team.reborn.energy.EnergySide; import techreborn.config.TechRebornConfig; @@ -42,13 +46,13 @@ public class WindMillBlockEntity extends PowerAcceptorBlockEntity implements ITo public float bladeAngle; public float spinSpeed; - public WindMillBlockEntity() { - super(TRBlockEntities.WIND_MILL); + public WindMillBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.WIND_MILL, pos, state); } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null) { return; diff --git a/src/main/java/techreborn/blockentity/lighting/LampBlockEntity.java b/src/main/java/techreborn/blockentity/lighting/LampBlockEntity.java index 5286ab844..3596b6bec 100644 --- a/src/main/java/techreborn/blockentity/lighting/LampBlockEntity.java +++ b/src/main/java/techreborn/blockentity/lighting/LampBlockEntity.java @@ -28,30 +28,31 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; import reborncore.api.IToolDrop; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import team.reborn.energy.EnergySide; import techreborn.blocks.lighting.LampBlock; import techreborn.init.TRBlockEntities; -import techreborn.init.TRContent; public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDrop { private static final int capacity = 33; - public LampBlockEntity() { - super(TRBlockEntities.LAMP); + public LampBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.LAMP, pos, state); } // PowerAcceptorBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient) { return; } - BlockState state = world.getBlockState(pos); Block b = state.getBlock(); if (!(b instanceof LampBlock)) { return; @@ -70,7 +71,7 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDr @Override protected boolean canAcceptEnergy(EnergySide side) { - return side == EnergySide.UNKNOWN || getFacing().getOpposite() == Direction.values()[side.ordinal()]; + return side == EnergySide.UNKNOWN || getFacing().getOpposite() != Direction.values()[side.ordinal()]; } @Override @@ -93,22 +94,9 @@ public class LampBlockEntity extends PowerAcceptorBlockEntity implements IToolDr return 32; } - //MachineBaseBlockEntity - @Override - public Direction getFacing(){ - if (world == null){ - return Direction.NORTH; - } - return LampBlock.getFacing(world.getBlockState(pos)); - } - // IToolDrop @Override public ItemStack getToolDrop(final PlayerEntity entityPlayer) { - // I know it is weird. But world is nullable - if (world == null) { - return new ItemStack(TRContent.Machine.LAMP_INCANDESCENT.block); - } return new ItemStack(world.getBlockState(pos).getBlock()); } } diff --git a/src/main/java/techreborn/blockentity/machine/GenericMachineBlockEntity.java b/src/main/java/techreborn/blockentity/machine/GenericMachineBlockEntity.java index 1b1272adf..85a397539 100644 --- a/src/main/java/techreborn/blockentity/machine/GenericMachineBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/GenericMachineBlockEntity.java @@ -25,12 +25,16 @@ package techreborn.blockentity.machine; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.api.recipe.IRecipeCrafterProvider; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.RebornInventory; @@ -57,8 +61,8 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity * @param toolDrop Block Block to drop with wrench * @param energySlot int Energy slot to use to charge machine from battery */ - public GenericMachineBlockEntity(BlockEntityType blockEntityType, String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) { - super(blockEntityType); + public GenericMachineBlockEntity(BlockEntityType blockEntityType, BlockPos pos, BlockState state, String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) { + super(blockEntityType, pos, state); this.name = "BlockEntity" + name; this.maxInput = maxInput; this.maxEnergy = maxEnergy; @@ -82,8 +86,8 @@ public abstract class GenericMachineBlockEntity extends PowerAcceptorBlockEntity // PowerAcceptorBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient) { return; } diff --git a/src/main/java/techreborn/blockentity/machine/iron/AbstractIronMachineBlockEntity.java b/src/main/java/techreborn/blockentity/machine/iron/AbstractIronMachineBlockEntity.java index 2c6ec767c..c9f6a23c5 100644 --- a/src/main/java/techreborn/blockentity/machine/iron/AbstractIronMachineBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/iron/AbstractIronMachineBlockEntity.java @@ -31,6 +31,8 @@ import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.common.blockentity.MachineBaseBlockEntity; @@ -50,8 +52,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt Block toolDrop; boolean active = false; - public AbstractIronMachineBlockEntity(BlockEntityType blockEntityTypeIn, int fuelSlot, Block toolDrop) { - super(blockEntityTypeIn); + public AbstractIronMachineBlockEntity(BlockEntityType blockEntityTypeIn, BlockPos pos, BlockState state, int fuelSlot, Block toolDrop) { + super(blockEntityTypeIn, pos, state); this.fuelSlot = fuelSlot; // default value for vanilla smelting recipes is 200 this.totalCookingTime = (int) (200 / TechRebornConfig.cookingScale); @@ -132,8 +134,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt // MachineBaseBlockEntity @Override - public void readNbt(BlockState blockState, NbtCompound compoundTag) { - super.readNbt(blockState, compoundTag); + public void readNbt(NbtCompound compoundTag) { + super.readNbt(compoundTag); burnTime = compoundTag.getInt("BurnTime"); totalBurnTime = compoundTag.getInt("TotalBurnTime"); progress = compoundTag.getInt("Progress"); @@ -149,8 +151,8 @@ public abstract class AbstractIronMachineBlockEntity extends MachineBaseBlockEnt } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world.isClient) { return; } diff --git a/src/main/java/techreborn/blockentity/machine/iron/IronAlloyFurnaceBlockEntity.java b/src/main/java/techreborn/blockentity/machine/iron/IronAlloyFurnaceBlockEntity.java index 2f503c9d2..5e24fe9a5 100644 --- a/src/main/java/techreborn/blockentity/machine/iron/IronAlloyFurnaceBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/iron/IronAlloyFurnaceBlockEntity.java @@ -24,8 +24,10 @@ package techreborn.blockentity.machine.iron; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -44,8 +46,8 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity int input2 = 1; int output = 2; - public IronAlloyFurnaceBlockEntity() { - super(TRBlockEntities.IRON_ALLOY_FURNACE, 3, TRContent.Machine.IRON_ALLOY_FURNACE.block); + public IronAlloyFurnaceBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.IRON_ALLOY_FURNACE, pos, state, 3, TRContent.Machine.IRON_ALLOY_FURNACE.block); this.inventory = new RebornInventory<>(4, "IronAlloyFurnaceBlockEntity", 64, this); } @@ -134,7 +136,7 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("alloyfurnace").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("alloyfurnace").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this) .slot(0, 47, 17) .slot(1, 65, 17) diff --git a/src/main/java/techreborn/blockentity/machine/iron/IronFurnaceBlockEntity.java b/src/main/java/techreborn/blockentity/machine/iron/IronFurnaceBlockEntity.java index 9c5fda883..c96836720 100644 --- a/src/main/java/techreborn/blockentity/machine/iron/IronFurnaceBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/iron/IronFurnaceBlockEntity.java @@ -34,6 +34,7 @@ import net.minecraft.recipe.Recipe; import net.minecraft.recipe.RecipeType; import net.minecraft.recipe.SmeltingRecipe; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -52,8 +53,8 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple private Recipe lastRecipe = null; - public IronFurnaceBlockEntity() { - super(TRBlockEntities.IRON_FURNACE, 2, TRContent.Machine.IRON_FURNACE.block); + public IronFurnaceBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.IRON_FURNACE, pos, state, 2, TRContent.Machine.IRON_FURNACE.block); this.inventory = new RebornInventory<>(3, "IronFurnaceBlockEntity", 64, this); } @@ -143,8 +144,8 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple } @Override - public void readNbt(BlockState blockState, NbtCompound compoundTag) { - super.readNbt(blockState, compoundTag); + public void readNbt(NbtCompound compoundTag) { + super.readNbt(compoundTag); experience = compoundTag.getFloat("Experience"); } @@ -171,7 +172,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("ironfurnace").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("ironfurnace").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this) .fuelSlot(2, 56, 53).slot(0, 56, 17).outputSlot(1, 116, 35) .sync(this::getBurnTime, this::setBurnTime) diff --git a/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java b/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java index d835e2900..af75843b2 100644 --- a/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/misc/AlarmBlockEntity.java @@ -26,13 +26,16 @@ package techreborn.blockentity.machine.misc; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.sound.SoundCategory; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; -import net.minecraft.util.Tickable; +import net.minecraft.block.entity.BlockEntityTicker; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.common.util.ChatUtils; import techreborn.blocks.misc.BlockAlarm; @@ -42,11 +45,11 @@ import techreborn.init.TRContent; import techreborn.utils.MessageIDs; public class AlarmBlockEntity extends BlockEntity - implements Tickable, IToolDrop { + implements BlockEntityTicker, IToolDrop { private int selectedSound = 1; - public AlarmBlockEntity() { - super(TRBlockEntities.ALARM); + public AlarmBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.ALARM, pos, state); } public void rightClick() { @@ -75,16 +78,16 @@ public class AlarmBlockEntity extends BlockEntity } @Override - public void readNbt(BlockState blockState, NbtCompound compound) { + public void readNbt(NbtCompound compound) { if (compound != null && compound.contains("selectedSound")) { selectedSound = compound.getInt("selectedSound"); } - super.readNbt(blockState, compound); + super.readNbt(compound); } // Tickable @Override - public void tick() { + public void tick(World world, BlockPos pos, BlockState state, AlarmBlockEntity blockEntity) { if (world == null || world.isClient()) return; if (world.getTime() % 25 != 0) return; diff --git a/src/main/java/techreborn/blockentity/machine/misc/ChargeOMatBlockEntity.java b/src/main/java/techreborn/blockentity/machine/misc/ChargeOMatBlockEntity.java index ed6363739..97668b96d 100644 --- a/src/main/java/techreborn/blockentity/machine/misc/ChargeOMatBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/misc/ChargeOMatBlockEntity.java @@ -24,13 +24,17 @@ package techreborn.blockentity.machine.misc; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.RebornInventory; import team.reborn.energy.EnergySide; @@ -43,14 +47,14 @@ public class ChargeOMatBlockEntity extends PowerAcceptorBlockEntity public RebornInventory inventory = new RebornInventory<>(6, "ChargeOMatBlockEntity", 64, this); - public ChargeOMatBlockEntity() { - super(TRBlockEntities.CHARGE_O_MAT); + public ChargeOMatBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.CHARGE_O_MAT, pos, state); } // PowerAcceptorBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient) { return; @@ -102,7 +106,7 @@ public class ChargeOMatBlockEntity extends PowerAcceptorBlockEntity // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("chargebench").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("chargebench").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).energySlot(0, 62, 25).energySlot(1, 98, 25).energySlot(2, 62, 45).energySlot(3, 98, 45) .energySlot(4, 62, 65).energySlot(5, 98, 65).syncEnergyValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/machine/misc/DrainBlockEntity.java b/src/main/java/techreborn/blockentity/machine/misc/DrainBlockEntity.java index a0a818e31..19e335eaa 100644 --- a/src/main/java/techreborn/blockentity/machine/misc/DrainBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/misc/DrainBlockEntity.java @@ -29,31 +29,33 @@ import net.minecraft.block.BlockState; import net.minecraft.block.FluidDrainable; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.Fluids; +import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.fluid.FluidValue; import reborncore.common.fluid.container.FluidInstance; +import reborncore.common.fluid.container.ItemFluidInfo; import reborncore.common.util.Tank; +import techreborn.TechReborn; import techreborn.init.TRBlockEntities; -import org.jetbrains.annotations.Nullable; - public class DrainBlockEntity extends MachineBaseBlockEntity { protected Tank internalTank = new Tank("tank", FluidValue.BUCKET, this); - public DrainBlockEntity() { - this(TRBlockEntities.DRAIN); + public DrainBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.DRAIN, pos, state); } - public DrainBlockEntity(BlockEntityType blockEntityTypeIn) { - super(blockEntityTypeIn); + public DrainBlockEntity(BlockEntityType blockEntityTypeIn, BlockPos pos, BlockState state) { + super(blockEntityTypeIn, pos, state); } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world.isClient) { return; } @@ -81,11 +83,12 @@ public class DrainBlockEntity extends MachineBaseBlockEntity { Block aboveBlock = aboveBlockState.getBlock(); if (aboveBlock instanceof FluidDrainable) { - - Fluid drainFluid = ((FluidDrainable) aboveBlock).tryDrainFluid(world, above, aboveBlockState); - - if (drainFluid != Fluids.EMPTY) { + ItemStack fluidContainer = ((FluidDrainable) aboveBlock).tryDrainFluid(world, above, aboveBlockState); + if (fluidContainer.getItem() instanceof ItemFluidInfo) { + Fluid drainFluid = ((ItemFluidInfo) fluidContainer.getItem()).getFluid(fluidContainer); internalTank.setFluidInstance(new FluidInstance(drainFluid, FluidValue.BUCKET)); + } else { + TechReborn.LOGGER.debug("Could not get Fluid from ItemStack " + fluidContainer.getItem()); } } } diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/DistillationTowerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/DistillationTowerBlockEntity.java index ff8258e95..4317c1fb8 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/DistillationTowerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/DistillationTowerBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.multiblock; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -41,8 +43,8 @@ import techreborn.init.TRContent; public class DistillationTowerBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public DistillationTowerBlockEntity() { - super(TRBlockEntities.DISTILLATION_TOWER, "DistillationTower", TechRebornConfig.distillationTowerMaxInput, TechRebornConfig.distillationTowerMaxEnergy, TRContent.Machine.DISTILLATION_TOWER.block, 6); + public DistillationTowerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.DISTILLATION_TOWER, pos, state, "DistillationTower", TechRebornConfig.distillationTowerMaxInput, TechRebornConfig.distillationTowerMaxEnergy, TRContent.Machine.DISTILLATION_TOWER.block, 6); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2, 3, 4, 5}; this.inventory = new RebornInventory<>(7, "DistillationTowerBlockEntity", 64, this); @@ -61,7 +63,7 @@ public class DistillationTowerBlockEntity extends GenericMachineBlockEntity impl // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("Distillationtower").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("Distillationtower").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 35, 27).slot(1, 35, 47).outputSlot(2, 79, 37).outputSlot(3, 99, 37) .outputSlot(4, 119, 37).outputSlot(5, 139, 37).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue() .addInventory().create(this, syncID); diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/FluidReplicatorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/FluidReplicatorBlockEntity.java index fe5c4c4fe..3f24e1d75 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/FluidReplicatorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/FluidReplicatorBlockEntity.java @@ -26,12 +26,15 @@ package techreborn.blockentity.machine.multiblock; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.Fluids; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MultiblockWriter; import reborncore.common.fluid.FluidValue; import reborncore.common.recipes.RecipeCrafter; @@ -45,8 +48,6 @@ import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; import techreborn.utils.FluidUtils; -import org.jetbrains.annotations.Nullable; - /** * @author drcrazy */ @@ -56,8 +57,8 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem public Tank tank; int ticksSinceLastChange; - public FluidReplicatorBlockEntity() { - super(TRBlockEntities.FLUID_REPLICATOR, "FluidReplicator", TechRebornConfig.fluidReplicatorMaxInput, TechRebornConfig.fluidReplicatorMaxEnergy, TRContent.Machine.FLUID_REPLICATOR.block, 3); + public FluidReplicatorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.FLUID_REPLICATOR, pos, state, "FluidReplicator", TechRebornConfig.fluidReplicatorMaxInput, TechRebornConfig.fluidReplicatorMaxEnergy, TRContent.Machine.FLUID_REPLICATOR.block, 3); this.inventory = new RebornInventory<>(4, "FluidReplicatorBlockEntity", 64, this, getInventoryAccess()); this.crafter = new RecipeCrafter(ModRecipes.FLUID_REPLICATOR, this, 1, 0, this.inventory, new int[]{0}, null); this.tank = new Tank("FluidReplicatorBlockEntity", FluidReplicatorBlockEntity.TANK_CAPACITY, this); @@ -72,7 +73,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem // TileGenericMachine @Override - public void tick() { + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { if (world == null){ return; } @@ -81,15 +82,11 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem if (!world.isClient && ticksSinceLastChange >= 10) { if (!inventory.getStack(1).isEmpty()) { FluidUtils.fillContainers(tank, inventory, 1, 2); - if (tank.isEmpty()){ - // need to set to empty fluid due to #2352 - tank.setFluid(Fluids.EMPTY); - } } ticksSinceLastChange = 0; } - super.tick(); + super.tick(world, pos, state, blockEntity); } @Override @@ -99,8 +96,8 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem // TilePowerAcceptor @Override - public void readNbt(BlockState blockState, final NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(final NbtCompound tagCompound) { + super.readNbt(tagCompound); tank.read(tagCompound); } @@ -130,7 +127,7 @@ public class FluidReplicatorBlockEntity extends GenericMachineBlockEntity implem // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { - return new ScreenHandlerBuilder("fluidreplicator").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("fluidreplicator").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).fluidSlot(1, 124, 35).filterSlot(0, 55, 45, stack -> stack.isItemEqualIgnoreDamage(TRContent.Parts.UU_MATTER.getStack())) .outputSlot(2, 124, 55).energySlot(3, 8, 72).sync(tank).syncEnergyValue().syncCrafterValue().addInventory() .create(this, syncID); diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java index dfeca225e..fe4ef27a0 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/FusionControlComputerBlockEntity.java @@ -32,9 +32,11 @@ import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MultiblockWriter; import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.ingredient.RebornIngredient; @@ -65,8 +67,8 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity boolean checkNBTRecipe = false; long lastTick = -1; - public FusionControlComputerBlockEntity() { - super(TRBlockEntities.FUSION_CONTROL_COMPUTER, "FusionControlComputer", -1, -1, TRContent.Machine.FUSION_CONTROL_COMPUTER.block, -1); + public FusionControlComputerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.FUSION_CONTROL_COMPUTER, pos, state, "FusionControlComputer", -1, -1, TRContent.Machine.FUSION_CONTROL_COMPUTER.block, -1); checkOverfill = false; this.inventory = new RebornInventory<>(3, "FusionControlComputerBlockEntity", 64, this); } @@ -249,8 +251,8 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity // PowerAcceptorBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient) { return; @@ -352,8 +354,8 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity } @Override - public void readNbt(BlockState blockState, final NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(final NbtCompound tagCompound) { + super.readNbt(tagCompound); this.craftingTickTime = tagCompound.getInt("craftingTickTime"); this.neededPower = tagCompound.getInt("neededPower"); this.hasStartedCrafting = tagCompound.getBoolean("hasStartedCrafting"); @@ -399,7 +401,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("fusionreactor").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("fusionreactor").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this).slot(0, 34, 47).slot(1, 126, 47).outputSlot(2, 80, 47).syncEnergyValue() .sync(this::getCraftingTickTime, this::setCraftingTickTime) .sync(this::getSize, this::setSize) diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/ImplosionCompressorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/ImplosionCompressorBlockEntity.java index e57b237a1..f1826133d 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/ImplosionCompressorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/ImplosionCompressorBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.multiblock; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -41,8 +43,8 @@ import techreborn.init.TRContent; public class ImplosionCompressorBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public ImplosionCompressorBlockEntity() { - super(TRBlockEntities.IMPLOSION_COMPRESSOR, "ImplosionCompressor", TechRebornConfig.implosionCompressorMaxInput, TechRebornConfig.implosionCompressorMaxEnergy, TRContent.Machine.IMPLOSION_COMPRESSOR.block, 4); + public ImplosionCompressorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.IMPLOSION_COMPRESSOR, pos, state, "ImplosionCompressor", TechRebornConfig.implosionCompressorMaxInput, TechRebornConfig.implosionCompressorMaxEnergy, TRContent.Machine.IMPLOSION_COMPRESSOR.block, 4); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2, 3}; this.inventory = new RebornInventory<>(5, "ImplosionCompressorBlockEntity", 64, this); @@ -60,7 +62,7 @@ public class ImplosionCompressorBlockEntity extends GenericMachineBlockEntity im // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("implosioncompressor").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36) .energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialBlastFurnaceBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialBlastFurnaceBlockEntity.java index c23da618f..5c2aecefc 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialBlastFurnaceBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialBlastFurnaceBlockEntity.java @@ -54,8 +54,8 @@ public class IndustrialBlastFurnaceBlockEntity extends GenericMachineBlockEntity private int cachedHeat; - public IndustrialBlastFurnaceBlockEntity() { - super(TRBlockEntities.INDUSTRIAL_BLAST_FURNACE, "IndustrialBlastFurnace", TechRebornConfig.industrialBlastFurnaceMaxInput, TechRebornConfig.industrialBlastFurnaceMaxEnergy, TRContent.Machine.INDUSTRIAL_BLAST_FURNACE.block, 4); + public IndustrialBlastFurnaceBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.INDUSTRIAL_BLAST_FURNACE, pos, state, "IndustrialBlastFurnace", TechRebornConfig.industrialBlastFurnaceMaxInput, TechRebornConfig.industrialBlastFurnaceMaxEnergy, TRContent.Machine.INDUSTRIAL_BLAST_FURNACE.block, 4); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2, 3}; this.inventory = new RebornInventory<>(5, "IndustrialBlastFurnaceBlockEntity", 64, this); @@ -134,7 +134,7 @@ public class IndustrialBlastFurnaceBlockEntity extends GenericMachineBlockEntity // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("blastfurnace").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("blastfurnace").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 93, 37).outputSlot(3, 113, 37) .energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue() .sync(this::getHeat, this::setHeat).addInventory().create(this, syncID); diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialGrinderBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialGrinderBlockEntity.java index 3b3c57a05..691402084 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialGrinderBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialGrinderBlockEntity.java @@ -29,10 +29,14 @@ import net.minecraft.block.Blocks; import net.minecraft.block.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MultiblockWriter; import reborncore.common.fluid.FluidValue; import reborncore.common.recipes.RecipeCrafter; @@ -45,16 +49,14 @@ import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; import techreborn.utils.FluidUtils; -import org.jetbrains.annotations.Nullable; - public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { public static final FluidValue TANK_CAPACITY = FluidValue.BUCKET.multiply(16); public Tank tank; int ticksSinceLastChange; - public IndustrialGrinderBlockEntity() { - super(TRBlockEntities.INDUSTRIAL_GRINDER, "IndustrialGrinder", TechRebornConfig.industrialGrinderMaxInput, TechRebornConfig.industrialGrinderMaxEnergy, TRContent.Machine.INDUSTRIAL_GRINDER.block, 7); + public IndustrialGrinderBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.INDUSTRIAL_GRINDER, pos, state, "IndustrialGrinder", TechRebornConfig.industrialGrinderMaxInput, TechRebornConfig.industrialGrinderMaxEnergy, TRContent.Machine.INDUSTRIAL_GRINDER.block, 7); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2, 3, 4, 5}; this.inventory = new RebornInventory<>(8, "IndustrialGrinderBlockEntity", 64, this); @@ -75,7 +77,7 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl // TilePowerAcceptor @Override - public void tick() { + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { if (world == null){ return; } @@ -89,12 +91,12 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl ticksSinceLastChange = 0; } - super.tick(); + super.tick(world, pos, state, blockEntity); } @Override - public void readNbt(BlockState blockState, final NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(final NbtCompound tagCompound) { + super.readNbt(tagCompound); tank.read(tagCompound); } @@ -116,10 +118,10 @@ public class IndustrialGrinderBlockEntity extends GenericMachineBlockEntity impl @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { // fluidSlot first to support automation and shift-click - return new ScreenHandlerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("industrialgrinder").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36) .outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72) .sync(tank).syncEnergyValue().syncCrafterValue().addInventory().create(this, syncID); } -} \ No newline at end of file +} diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialSawmillBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialSawmillBlockEntity.java index 72745a0e5..318b87a80 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialSawmillBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/IndustrialSawmillBlockEntity.java @@ -29,10 +29,14 @@ import net.minecraft.block.Blocks; import net.minecraft.block.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MultiblockWriter; import reborncore.common.fluid.FluidValue; import reborncore.common.recipes.RecipeCrafter; @@ -45,16 +49,14 @@ import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; import techreborn.utils.FluidUtils; -import org.jetbrains.annotations.Nullable; - public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { public static final FluidValue TANK_CAPACITY = FluidValue.BUCKET.multiply(16); public Tank tank; int ticksSinceLastChange; - public IndustrialSawmillBlockEntity() { - super(TRBlockEntities.INDUSTRIAL_SAWMILL, "IndustrialSawmill", TechRebornConfig.industrialSawmillMaxInput, TechRebornConfig.industrialSawmillMaxEnergy, TRContent.Machine.INDUSTRIAL_SAWMILL.block, 6); + public IndustrialSawmillBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.INDUSTRIAL_SAWMILL, pos, state, "IndustrialSawmill", TechRebornConfig.industrialSawmillMaxInput, TechRebornConfig.industrialSawmillMaxEnergy, TRContent.Machine.INDUSTRIAL_SAWMILL.block, 6); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2, 3, 4}; this.inventory = new RebornInventory<>(7, "SawmillBlockEntity", 64, this); @@ -75,7 +77,7 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl // TileGenericMachine @Override - public void tick() { + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { if (world == null) { return; } @@ -89,14 +91,14 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl ticksSinceLastChange = 0; } - super.tick(); + super.tick(world, pos, state, blockEntity); } // TilePowerAcceptor @Override - public void readNbt(BlockState blockState, final NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(final NbtCompound tagCompound) { + super.readNbt(tagCompound); tank.read(tagCompound); } @@ -117,7 +119,7 @@ public class IndustrialSawmillBlockEntity extends GenericMachineBlockEntity impl // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("industrialsawmill").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("industrialsawmill").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 25).outputSlot(3, 126, 43) .outputSlot(4, 126, 61).outputSlot(5, 34, 55).energySlot(6, 8, 72).sync(tank).syncEnergyValue().syncCrafterValue() .addInventory().create(this, syncID); diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java index 613835b99..079093246 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/VacuumFreezerBlockEntity.java @@ -26,6 +26,7 @@ package techreborn.blockentity.machine.multiblock; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -42,8 +43,8 @@ import techreborn.init.TRContent; public class VacuumFreezerBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public VacuumFreezerBlockEntity() { - super(TRBlockEntities.VACUUM_FREEZER, "VacuumFreezer", TechRebornConfig.vacuumFreezerMaxInput, TechRebornConfig.vacuumFreezerMaxEnergy, TRContent.Machine.VACUUM_FREEZER.block, 2); + public VacuumFreezerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.VACUUM_FREEZER, pos, state, "VacuumFreezer", TechRebornConfig.vacuumFreezerMaxInput, TechRebornConfig.vacuumFreezerMaxEnergy, TRContent.Machine.VACUUM_FREEZER.block, 2); final int[] inputs = new int[]{0}; final int[] outputs = new int[]{1}; this.inventory = new RebornInventory<>(3, "VacuumFreezerBlockEntity", 64, this); @@ -61,10 +62,10 @@ public class VacuumFreezerBlockEntity extends GenericMachineBlockEntity implemen .fill(0, 2, 0, 3, 3, 3, advanced); } - // IContainerProvider + // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("vacuumfreezer").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue() .syncCrafterValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/machine/multiblock/casing/MachineCasingBlockEntity.java b/src/main/java/techreborn/blockentity/machine/multiblock/casing/MachineCasingBlockEntity.java index 11ec3e987..7768db422 100644 --- a/src/main/java/techreborn/blockentity/machine/multiblock/casing/MachineCasingBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/multiblock/casing/MachineCasingBlockEntity.java @@ -24,6 +24,10 @@ package techreborn.blockentity.machine.multiblock.casing; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.common.multiblock.MultiblockControllerBase; import reborncore.common.multiblock.rectangular.RectangularMultiblockBlockEntityBase; import techreborn.init.TRBlockEntities; @@ -31,8 +35,8 @@ import techreborn.multiblocks.MultiBlockCasing; public class MachineCasingBlockEntity extends RectangularMultiblockBlockEntityBase { - public MachineCasingBlockEntity() { - super(TRBlockEntities.MACHINE_CASINGS); + public MachineCasingBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.MACHINE_CASINGS, pos, state); } @Override @@ -86,7 +90,7 @@ public class MachineCasingBlockEntity extends RectangularMultiblockBlockEntityBa } @Override - public void tick() { + public void tick(World world, BlockPos pos, BlockState state, BlockEntity blockEntity) { } } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/AlloySmelterBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/AlloySmelterBlockEntity.java index c6b2ed02b..5fc9758b8 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/AlloySmelterBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/AlloySmelterBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class AlloySmelterBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public AlloySmelterBlockEntity() { - super(TRBlockEntities.ALLOY_SMELTER, "AlloySmelter", TechRebornConfig.alloySmelterMaxInput, TechRebornConfig.alloySmelterMaxEnergy, TRContent.Machine.ALLOY_SMELTER.block, 3); + public AlloySmelterBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.ALLOY_SMELTER, pos, state, "AlloySmelter", TechRebornConfig.alloySmelterMaxInput, TechRebornConfig.alloySmelterMaxEnergy, TRContent.Machine.ALLOY_SMELTER.block, 3); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2}; this.inventory = new RebornInventory<>(4, "AlloySmelterBlockEntity", 64, this); @@ -49,7 +51,7 @@ public class AlloySmelterBlockEntity extends GenericMachineBlockEntity implement // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("alloysmelter").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("alloysmelter").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this) .slot(0, 34, 47) .slot(1, 126, 47) diff --git a/src/main/java/techreborn/blockentity/machine/tier1/AssemblingMachineBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/AssemblingMachineBlockEntity.java index 6618317d5..aefe688bd 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/AssemblingMachineBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/AssemblingMachineBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class AssemblingMachineBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public AssemblingMachineBlockEntity() { - super(TRBlockEntities.ASSEMBLY_MACHINE, "AssemblingMachine", TechRebornConfig.assemblingMachineMaxInput, TechRebornConfig.assemblingMachineMaxEnergy, TRContent.Machine.ASSEMBLY_MACHINE.block, 3); + public AssemblingMachineBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.ASSEMBLY_MACHINE, pos, state, "AssemblingMachine", TechRebornConfig.assemblingMachineMaxInput, TechRebornConfig.assemblingMachineMaxEnergy, TRContent.Machine.ASSEMBLY_MACHINE.block, 3); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2}; this.inventory = new RebornInventory<>(4, "AssemblingMachineBlockEntity", 64, this); @@ -49,7 +51,7 @@ public class AssemblingMachineBlockEntity extends GenericMachineBlockEntity impl // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("assemblingmachine").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("assemblingmachine").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this).slot(0, 55, 35).slot(1, 55, 55).outputSlot(2, 101, 45).energySlot(3, 8, 72) .syncEnergyValue().syncCrafterValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/AutoCraftingTableBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/AutoCraftingTableBlockEntity.java index 59c4879e6..0953a413c 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/AutoCraftingTableBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/AutoCraftingTableBlockEntity.java @@ -27,7 +27,6 @@ package techreborn.blockentity.machine.tier1; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.CraftingInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.recipe.CraftingRecipe; @@ -36,13 +35,16 @@ import net.minecraft.recipe.RecipeType; import net.minecraft.screen.ScreenHandler; import net.minecraft.sound.SoundCategory; import net.minecraft.util.collection.DefaultedList; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; import org.apache.commons.lang3.tuple.Pair; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.recipes.ExtendedRecipeRemainder; import reborncore.common.util.ItemUtils; @@ -69,7 +71,6 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity public RebornInventory inventory = new RebornInventory<>(11, "AutoCraftingTableBlockEntity", 64, this); private final int OUTPUT_SLOT = 9; private final int EXTRA_OUTPUT_SLOT = 10; - public int progress; public int maxProgress = 120; public int euTick = 10; @@ -78,16 +79,10 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity CraftingInventory inventoryCrafting = null; CraftingRecipe lastRecipe = null; - Item[] layoutInv = { - null, null, null, - null, null, null, - null, null, null, - }; + public boolean locked = true; - public boolean locked = false; - - public AutoCraftingTableBlockEntity() { - super(TRBlockEntities.AUTO_CRAFTING_TABLE); + public AutoCraftingTableBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.AUTO_CRAFTING_TABLE, pos, state); } @Nullable @@ -98,11 +93,6 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity if (lastRecipe != null && lastRecipe.matches(crafting, world)) return lastRecipe; - Item[] currentInvLayout = getCraftingLayout(crafting); - if(Arrays.equals(layoutInv, currentInvLayout)) return null; - - layoutInv = currentInvLayout; - Optional testRecipe = world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, crafting, world); if (testRecipe.isPresent()) { lastRecipe = testRecipe.get(); @@ -112,20 +102,6 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity return null; } - private Item[] getCraftingLayout(CraftingInventory craftingInventory){ - Item[] layout = { - null, null, null, - null, null, null, - null, null, null, - }; - - for (int i = 0; i < 9; i++) { - layout[i] = craftingInventory.getStack(i).getItem(); - } - - return layout; - } - private CraftingInventory getCraftingInventory() { if (inventoryCrafting == null) { inventoryCrafting = new CraftingInventory(new ScreenHandler(null, -1) { @@ -149,20 +125,11 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity CraftingInventory crafting = getCraftingInventory(); if (crafting.isEmpty()) return false; - // Don't allow recipe to change (Keep at least one of each slot stocked, assuming it's actually a recipe) - if(locked){ - for(int i = 0; i < 9; i++){ - if(crafting.getStack(i).getCount() == 1){ - return false; - } - } - } - if (!recipe.matches(crafting, world)) return false; if (!hasOutputSpace(recipe.getOutput(), OUTPUT_SLOT)) return false; - DefaultedList remainingStacks = recipe.getRemainder(crafting); + DefaultedList remainingStacks = world.getRecipeManager().getRemainingStacks(RecipeType.CRAFTING, crafting, world); for (ItemStack stack : remainingStacks){ if (!stack.isEmpty() && !hasRoomForExtraItem(stack)) return false; } @@ -350,8 +317,8 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity // TilePowerAcceptor @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient) { return; } @@ -411,11 +378,11 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity } @Override - public void readNbt(BlockState blockState, NbtCompound tag) { + public void readNbt(NbtCompound tag) { if (tag.contains("locked")) { locked = tag.getBoolean("locked"); } - super.readNbt(blockState, tag); + super.readNbt(tag); } // MachineBaseBlockEntity @@ -450,7 +417,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { - return new ScreenHandlerBuilder("autocraftingtable").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("autocraftingtable").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this) .slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25) .slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43) diff --git a/src/main/java/techreborn/blockentity/machine/tier1/ChemicalReactorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/ChemicalReactorBlockEntity.java index bab91ba1c..42bd70d11 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/ChemicalReactorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/ChemicalReactorBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class ChemicalReactorBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public ChemicalReactorBlockEntity() { - super(TRBlockEntities.CHEMICAL_REACTOR, "ChemicalReactor", TechRebornConfig.chemicalReactorMaxInput, TechRebornConfig.chemicalReactorMaxEnergy, TRContent.Machine.CHEMICAL_REACTOR.block, 3); + public ChemicalReactorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.CHEMICAL_REACTOR, pos, state, "ChemicalReactor", TechRebornConfig.chemicalReactorMaxInput, TechRebornConfig.chemicalReactorMaxEnergy, TRContent.Machine.CHEMICAL_REACTOR.block, 3); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2}; this.inventory = new RebornInventory<>(4, "ChemicalReactorBlockEntity", 64, this); @@ -49,7 +51,7 @@ public class ChemicalReactorBlockEntity extends GenericMachineBlockEntity implem // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("chemicalreactor").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("chemicalreactor").player(player.getInventory()).inventory().hotbar() .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); } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/CompressorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/CompressorBlockEntity.java index a26acae5d..df1e403ee 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/CompressorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/CompressorBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class CompressorBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public CompressorBlockEntity() { - super(TRBlockEntities.COMPRESSOR, "Compressor", TechRebornConfig.compressorMaxInput, TechRebornConfig.compressorMaxEnergy, TRContent.Machine.COMPRESSOR.block, 2); + public CompressorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.COMPRESSOR, pos, state, "Compressor", TechRebornConfig.compressorMaxInput, TechRebornConfig.compressorMaxEnergy, TRContent.Machine.COMPRESSOR.block, 2); final int[] inputs = new int[]{0}; final int[] outputs = new int[]{1}; this.inventory = new RebornInventory<>(3, "CompressorBlockEntity", 64, this); @@ -49,7 +51,7 @@ public class CompressorBlockEntity extends GenericMachineBlockEntity implements // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("compressor").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("compressor").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue() .syncCrafterValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/ElectricFurnaceBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/ElectricFurnaceBlockEntity.java index 5f61d5814..54d903264 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/ElectricFurnaceBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/ElectricFurnaceBlockEntity.java @@ -25,15 +25,19 @@ package techreborn.blockentity.machine.tier1; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.recipe.RecipeType; import net.minecraft.recipe.SmeltingRecipe; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.recipes.RecipeCrafter; @@ -59,8 +63,8 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity // Energy cost per tick of cooking final int EnergyPerTick = 1; - public ElectricFurnaceBlockEntity() { - super(TRBlockEntities.ELECTRIC_FURNACE); + public ElectricFurnaceBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.ELECTRIC_FURNACE, pos, state); } private void setInvDirty(boolean isDirty) { @@ -189,8 +193,8 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity // TilePowerAcceptor @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); charge(2); if (world == null || world.isClient) { @@ -265,7 +269,7 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("electricfurnace").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("electricfurnace").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue() .sync(this::getCookTime, this::setCookTime).sync(this::getCookTimeTotal, this::setCookTimeTotal).addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/ExtractorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/ExtractorBlockEntity.java index e88c978c4..831b4e548 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/ExtractorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/ExtractorBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class ExtractorBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public ExtractorBlockEntity() { - super(TRBlockEntities.EXTRACTOR, "Extractor", TechRebornConfig.extractorMaxInput, TechRebornConfig.extractorMaxEnergy, TRContent.Machine.EXTRACTOR.block, 2); + public ExtractorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.EXTRACTOR, pos, state, "Extractor", TechRebornConfig.extractorMaxInput, TechRebornConfig.extractorMaxEnergy, TRContent.Machine.EXTRACTOR.block, 2); final int[] inputs = new int[]{0}; final int[] outputs = new int[]{1}; this.inventory = new RebornInventory<>(3, "ExtractorBlockEntity", 64, this); @@ -49,7 +51,7 @@ public class ExtractorBlockEntity extends GenericMachineBlockEntity implements B // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("extractor").player(player.inventory).inventory().hotbar().addInventory().blockEntity(this) + return new ScreenHandlerBuilder("extractor").player(player.getInventory()).inventory().hotbar().addInventory().blockEntity(this) .slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue().syncCrafterValue() .addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/GreenhouseControllerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/GreenhouseControllerBlockEntity.java index f7427938c..e0bbe5be7 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/GreenhouseControllerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/GreenhouseControllerBlockEntity.java @@ -32,11 +32,13 @@ import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MultiblockWriter; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.ItemUtils; @@ -59,8 +61,8 @@ public class GreenhouseControllerBlockEntity extends PowerAcceptorBlockEntity private int ticksToNextMultiblockCheck = 0; private boolean growthBoost = false; - public GreenhouseControllerBlockEntity() { - super(TRBlockEntities.GREENHOUSE_CONTROLLER); + public GreenhouseControllerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.GREENHOUSE_CONTROLLER, pos, state); } private void workCycle() { @@ -182,7 +184,7 @@ public class GreenhouseControllerBlockEntity extends PowerAcceptorBlockEntity // PowerAcceptorBlockEntity @Override - public void tick() { + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { if (world == null){ return; } @@ -190,7 +192,7 @@ public class GreenhouseControllerBlockEntity extends PowerAcceptorBlockEntity multiblockCenter = pos.offset(getFacing().getOpposite(), 5); } charge(6); - super.tick(); + super.tick(world, pos, state, blockEntity); if (world.isClient) { return; @@ -272,7 +274,7 @@ public class GreenhouseControllerBlockEntity extends PowerAcceptorBlockEntity // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { - return new ScreenHandlerBuilder("greenhousecontroller").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("greenhousecontroller").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this) .outputSlot(0, 30, 22).outputSlot(1, 48, 22) .outputSlot(2, 30, 40).outputSlot(3, 48, 40) diff --git a/src/main/java/techreborn/blockentity/machine/tier1/IndustrialElectrolyzerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/IndustrialElectrolyzerBlockEntity.java index a344e6d56..36eaf0a3d 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/IndustrialElectrolyzerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/IndustrialElectrolyzerBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -40,8 +42,8 @@ import techreborn.items.DynamicCellItem; public class IndustrialElectrolyzerBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public IndustrialElectrolyzerBlockEntity() { - super(TRBlockEntities.INDUSTRIAL_ELECTROLYZER, "IndustrialElectrolyzer", TechRebornConfig.industrialElectrolyzerMaxInput, TechRebornConfig.industrialElectrolyzerMaxEnergy, TRContent.Machine.INDUSTRIAL_ELECTROLYZER.block, 6); + public IndustrialElectrolyzerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.INDUSTRIAL_ELECTROLYZER, pos, state, "IndustrialElectrolyzer", TechRebornConfig.industrialElectrolyzerMaxInput, TechRebornConfig.industrialElectrolyzerMaxEnergy, TRContent.Machine.INDUSTRIAL_ELECTROLYZER.block, 6); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2, 3, 4, 5}; this.inventory = new RebornInventory<>(7, "IndustrialElectrolyzerBlockEntity", 64, this); @@ -51,7 +53,7 @@ public class IndustrialElectrolyzerBlockEntity extends GenericMachineBlockEntity // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("industrialelectrolyzer").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("industrialelectrolyzer").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this) .filterSlot(1, 47, 72, stack -> ItemUtils.isItemEqual(stack, DynamicCellItem.getEmptyCell(1), true, true)) .filterSlot(0, 81, 72, stack -> !ItemUtils.isItemEqual(stack, DynamicCellItem.getEmptyCell(1), true, true)) diff --git a/src/main/java/techreborn/blockentity/machine/tier1/PlayerDectectorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/PlayerDectectorBlockEntity.java index 109604908..c5c4d0e0e 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/PlayerDectectorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/PlayerDectectorBlockEntity.java @@ -28,7 +28,10 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.WorldUtils; import team.reborn.energy.EnergySide; @@ -44,8 +47,8 @@ public class PlayerDectectorBlockEntity extends PowerAcceptorBlockEntity impleme public String owenerUdid = ""; boolean redstone = false; - public PlayerDectectorBlockEntity() { - super(TRBlockEntities.PLAYER_DETECTOR); + public PlayerDectectorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.PLAYER_DETECTOR, pos, state); } public boolean isProvidingPower() { @@ -54,8 +57,8 @@ public class PlayerDectectorBlockEntity extends PowerAcceptorBlockEntity impleme // PowerAcceptorBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null) { return; @@ -117,8 +120,8 @@ public class PlayerDectectorBlockEntity extends PowerAcceptorBlockEntity impleme } @Override - public void readNbt(BlockState blockState, NbtCompound tag) { - super.readNbt(blockState, tag); + public void readNbt(NbtCompound tag) { + super.readNbt(tag); owenerUdid = tag.getString("ownerID"); } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/RecyclerBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/RecyclerBlockEntity.java index 597a35a6d..5e429f524 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/RecyclerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/RecyclerBlockEntity.java @@ -24,9 +24,11 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; import reborncore.api.blockentity.IUpgrade; import reborncore.client.screen.BuiltScreenHandlerProvider; @@ -41,8 +43,8 @@ import techreborn.init.TRContent; public class RecyclerBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public RecyclerBlockEntity() { - super(TRBlockEntities.RECYCLER, "Recycler", TechRebornConfig.recyclerMaxInput, TechRebornConfig.recyclerMaxEnergy, TRContent.Machine.RECYCLER.block, 2); + public RecyclerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.RECYCLER, pos, state, "Recycler", TechRebornConfig.recyclerMaxInput, TechRebornConfig.recyclerMaxEnergy, TRContent.Machine.RECYCLER.block, 2); final int[] inputs = new int[]{0}; final int[] outputs = new int[]{1}; this.inventory = new RebornInventory<>(3, "RecyclerBlockEntity", 64, this); @@ -60,9 +62,9 @@ public class RecyclerBlockEntity extends GenericMachineBlockEntity implements Bu // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { - return new ScreenHandlerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("recycler").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 55, 45, RecyclerBlockEntity::canRecycle) .outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue() - .syncCrafterValue().addInventory().create(this, syncID); + .addInventory().create(this, syncID); } } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/ResinBasinBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/ResinBasinBlockEntity.java index 5a5b8e20f..54da8f428 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/ResinBasinBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/ResinBasinBlockEntity.java @@ -55,13 +55,21 @@ public class ResinBasinBlockEntity extends MachineBaseBlockEntity { private int pouringTimer = 0; - public ResinBasinBlockEntity() { - super(TRBlockEntities.RESIN_BASIN); + public ResinBasinBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.RESIN_BASIN, pos, state); + + /* TODO is this the right place? */ + this.isFull = state.get(ResinBasinBlock.FULL); + + if (state.get(ResinBasinBlock.POURING)) { + this.isPouring = true; + pouringTimer = TechRebornConfig.sapTimeTicks; + } } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient) return; boolean shouldUpdateState = false; @@ -148,15 +156,8 @@ public class ResinBasinBlockEntity extends MachineBaseBlockEntity { } @Override - public void readNbt(BlockState blockState, NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); - - this.isFull = blockState.get(ResinBasinBlock.FULL); - - if (blockState.get(ResinBasinBlock.POURING)) { - this.isPouring = true; - pouringTimer = TechRebornConfig.sapTimeTicks; - } + public void readNbt(NbtCompound tagCompound) { + super.readNbt(tagCompound); } @Override diff --git a/src/main/java/techreborn/blockentity/machine/tier1/RollingMachineBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/RollingMachineBlockEntity.java index 58b90bb7c..1831fb5a4 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/RollingMachineBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/RollingMachineBlockEntity.java @@ -31,13 +31,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.recipe.Ingredient; import net.minecraft.screen.ScreenHandler; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.apache.commons.lang3.tuple.Pair; +import org.jetbrains.annotations.NotNull; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.ItemUtils; @@ -49,7 +52,6 @@ import techreborn.init.ModRecipes; import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -73,8 +75,8 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity public boolean locked = false; public int balanceSlot = 0; - public RollingMachineBlockEntity() { - super(TRBlockEntities.ROLLING_MACHINE); + public RollingMachineBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.ROLLING_MACHINE, pos, state); outputSlot = 9; } @@ -99,8 +101,8 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity } @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world.isClient) { return; } @@ -343,8 +345,8 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity } @Override - public void readNbt(BlockState blockState, final NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(final NbtCompound tagCompound) { + super.readNbt(tagCompound); this.isRunning = tagCompound.getBoolean("isRunning"); this.tickTime = tagCompound.getInt("tickTime"); this.locked = tagCompound.getBoolean("locked"); @@ -381,7 +383,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("rollingmachine").player(player.inventory) + return new ScreenHandlerBuilder("rollingmachine").player(player.getInventory()) .inventory().hotbar() .addInventory().blockEntity(this) .slot(0, 30, 22).slot(1, 48, 22).slot(2, 66, 22) diff --git a/src/main/java/techreborn/blockentity/machine/tier1/ScrapboxinatorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/ScrapboxinatorBlockEntity.java index f76a8d74b..9a8ba207d 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/ScrapboxinatorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/ScrapboxinatorBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -37,8 +39,8 @@ import techreborn.init.TRContent; public class ScrapboxinatorBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public ScrapboxinatorBlockEntity() { - super(TRBlockEntities.SCRAPBOXINATOR, "Scrapboxinator", TechRebornConfig.scrapboxinatorMaxInput, TechRebornConfig.scrapboxinatorMaxEnergy, TRContent.Machine.SCRAPBOXINATOR.block, 2); + public ScrapboxinatorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.SCRAPBOXINATOR, pos, state, "Scrapboxinator", TechRebornConfig.scrapboxinatorMaxInput, TechRebornConfig.scrapboxinatorMaxEnergy, TRContent.Machine.SCRAPBOXINATOR.block, 2); final int[] inputs = new int[]{0}; final int[] outputs = new int[]{1}; this.inventory = new RebornInventory<>(3, "ScrapboxinatorBlockEntity", 64, this); @@ -54,7 +56,7 @@ public class ScrapboxinatorBlockEntity extends GenericMachineBlockEntity impleme // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("scrapboxinator").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("scrapboxinator").player(player.getInventory()).inventory().hotbar().addInventory() .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); } diff --git a/src/main/java/techreborn/blockentity/machine/tier1/SoildCanningMachineBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/SoildCanningMachineBlockEntity.java index fb1ea94d1..a39b4c4f6 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/SoildCanningMachineBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/SoildCanningMachineBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -38,8 +40,8 @@ import techreborn.init.TRContent; public class SoildCanningMachineBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public SoildCanningMachineBlockEntity() { - super(TRBlockEntities.SOLID_CANNING_MACHINE, "SolidCanningMachine", TechRebornConfig.solidCanningMachineMaxInput, TechRebornConfig.solidCanningMachineMaxEnergy, TRContent.Machine.SOLID_CANNING_MACHINE.block, 3); + public SoildCanningMachineBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.SOLID_CANNING_MACHINE, pos, state, "SolidCanningMachine", TechRebornConfig.solidCanningMachineMaxInput, TechRebornConfig.solidCanningMachineMaxEnergy, TRContent.Machine.SOLID_CANNING_MACHINE.block, 3); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2}; this.inventory = new RebornInventory<>(4, "SolidCanningMachineBlockEntity", 64, this); @@ -49,7 +51,7 @@ public class SoildCanningMachineBlockEntity extends GenericMachineBlockEntity im // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("solidcanningmachine").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("solidcanningmachine").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this) .slot(0, 34, 47) .slot(1, 126, 47) diff --git a/src/main/java/techreborn/blockentity/machine/tier1/WireMillBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier1/WireMillBlockEntity.java index 265c1464c..fd9776d10 100644 --- a/src/main/java/techreborn/blockentity/machine/tier1/WireMillBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier1/WireMillBlockEntity.java @@ -24,10 +24,14 @@ package techreborn.blockentity.machine.tier1; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.recipes.RecipeCrafter; import reborncore.common.util.RebornInventory; import techreborn.blockentity.machine.GenericMachineBlockEntity; @@ -37,8 +41,8 @@ import techreborn.init.TRContent; public class WireMillBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider { - public WireMillBlockEntity() { - super(TRBlockEntities.WIRE_MILL, "WireMill", 32, 1000, TRContent.Machine.WIRE_MILL.block, 2); + public WireMillBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.WIRE_MILL, pos, state, "WireMill", 32, 1000, TRContent.Machine.WIRE_MILL.block, 2); final int[] inputs = new int[]{0}; final int[] outputs = new int[]{1}; this.inventory = new RebornInventory<>(3, "WireMillBlockEntity", 64, this); @@ -48,7 +52,7 @@ public class WireMillBlockEntity extends GenericMachineBlockEntity implements Bu // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("wiremill").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("wiremill").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this) .slot(0, 55, 45) .outputSlot(1, 101, 45) diff --git a/src/main/java/techreborn/blockentity/machine/tier3/ChunkLoaderBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier3/ChunkLoaderBlockEntity.java index 1b7ded4ac..72cb719f3 100644 --- a/src/main/java/techreborn/blockentity/machine/tier3/ChunkLoaderBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier3/ChunkLoaderBlockEntity.java @@ -54,8 +54,8 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT private int radius; private String ownerUdid; - public ChunkLoaderBlockEntity() { - super(TRBlockEntities.CHUNK_LOADER); + public ChunkLoaderBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.CHUNK_LOADER, pos, state); this.radius = 1; } @@ -77,6 +77,11 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT } } + @Override + public ItemStack getToolDrop(final PlayerEntity entityPlayer) { + return TRContent.Machine.CHUNK_LOADER.getStack(); + } + private void reload() { unloadAll(); load(); @@ -97,16 +102,7 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT } } - private void unloadAll() { - ChunkLoaderManager manager = ChunkLoaderManager.get(world); - manager.unloadChunkLoader(world, getPos()); - } - public ChunkPos getChunkPos() { - return new ChunkPos(getPos()); - } - - // MachineBaseBlockEntity @Override public void onBreak(World world, PlayerEntity playerEntity, BlockPos blockPos, BlockState blockState) { if (world.isClient) { @@ -123,20 +119,27 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT reload(); } + private void unloadAll() { + ChunkLoaderManager manager = ChunkLoaderManager.get(world); + manager.unloadChunkLoader(world, getPos()); + } + + public ChunkPos getChunkPos() { + return new ChunkPos(getPos()); + } + @Override public NbtCompound writeNbt(NbtCompound tagCompound) { super.writeNbt(tagCompound); tagCompound.putInt("radius", radius); - if (ownerUdid != null && !ownerUdid.isEmpty()){ - tagCompound.putString("ownerUdid", ownerUdid); - } + tagCompound.putString("ownerUdid", ownerUdid); inventory.write(tagCompound); return tagCompound; } @Override - public void readNbt(BlockState blockState, NbtCompound nbttagcompound) { - super.readNbt(blockState, nbttagcompound); + public void readNbt(NbtCompound nbttagcompound) { + super.readNbt(nbttagcompound); this.radius = nbttagcompound.getInt("radius"); this.ownerUdid = nbttagcompound.getString("ownerUdid"); if (!StringUtils.isBlank(ownerUdid)) { @@ -145,25 +148,11 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT inventory.read(nbttagcompound); } - // IToolDrop - @Override - public ItemStack getToolDrop(final PlayerEntity entityPlayer) { - return TRContent.Machine.CHUNK_LOADER.getStack(); - } - - // InventoryProvider @Override public RebornInventory getInventory() { return this.inventory; } - // BuiltScreenHandlerProvider - @Override - public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { - return new ScreenHandlerBuilder("chunkloader").player(player.inventory).inventory().hotbar().addInventory() - .blockEntity(this).sync(this::getRadius, this::setRadius).addInventory().create(this, syncID); - } - public int getRadius() { return radius; } @@ -172,5 +161,10 @@ public class ChunkLoaderBlockEntity extends MachineBaseBlockEntity implements IT this.radius = radius; } + @Override + public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { + return new ScreenHandlerBuilder("chunkloader").player(player.getInventory()).inventory().hotbar().addInventory() + .blockEntity(this).sync(this::getRadius, this::setRadius).addInventory().create(this, syncID); + } } diff --git a/src/main/java/techreborn/blockentity/machine/tier3/IndustrialCentrifugeBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier3/IndustrialCentrifugeBlockEntity.java index 5eafaa052..aa8fa42e0 100644 --- a/src/main/java/techreborn/blockentity/machine/tier3/IndustrialCentrifugeBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier3/IndustrialCentrifugeBlockEntity.java @@ -24,10 +24,12 @@ package techreborn.blockentity.machine.tier3; +import net.minecraft.block.BlockState; import net.minecraft.client.gui.screen.Screen; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; +import net.minecraft.util.math.BlockPos; import reborncore.api.IListInfoProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -46,8 +48,8 @@ import java.util.List; public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity implements BuiltScreenHandlerProvider, IListInfoProvider { - public IndustrialCentrifugeBlockEntity() { - super(TRBlockEntities.INDUSTRIAL_CENTRIFUGE, "IndustrialCentrifuge", TechRebornConfig.industrialCentrifugeMaxInput, TechRebornConfig.industrialCentrifugeMaxEnergy, TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block, 6); + public IndustrialCentrifugeBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.INDUSTRIAL_CENTRIFUGE, pos, state, "IndustrialCentrifuge", TechRebornConfig.industrialCentrifugeMaxInput, TechRebornConfig.industrialCentrifugeMaxEnergy, TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block, 6); final int[] inputs = new int[]{0, 1}; final int[] outputs = new int[]{2, 3, 4, 5}; this.inventory = new RebornInventory<>(7, "IndustrialCentrifugeBlockEntity", 64, this); @@ -57,7 +59,7 @@ public class IndustrialCentrifugeBlockEntity extends GenericMachineBlockEntity i // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("centrifuge").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("centrifuge").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this) .filterSlot(1, 40, 54, stack -> ItemUtils.isItemEqual(stack, DynamicCellItem.getEmptyCell(1), true, true)) .filterSlot(0, 40, 34, stack -> !ItemUtils.isItemEqual(stack, DynamicCellItem.getEmptyCell(1), true, true)) diff --git a/src/main/java/techreborn/blockentity/machine/tier3/MatterFabricatorBlockEntity.java b/src/main/java/techreborn/blockentity/machine/tier3/MatterFabricatorBlockEntity.java index 91d9b37e0..056973d6b 100644 --- a/src/main/java/techreborn/blockentity/machine/tier3/MatterFabricatorBlockEntity.java +++ b/src/main/java/techreborn/blockentity/machine/tier3/MatterFabricatorBlockEntity.java @@ -24,13 +24,17 @@ package techreborn.blockentity.machine.tier3; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.ItemUtils; import reborncore.common.util.RebornInventory; @@ -45,8 +49,8 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity public RebornInventory inventory = new RebornInventory<>(12, "MatterFabricatorBlockEntity", 64, this); private int amplifier = 0; - public MatterFabricatorBlockEntity() { - super(TRBlockEntities.MATTER_FABRICATOR); + public MatterFabricatorBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.MATTER_FABRICATOR, pos, state); } private boolean spaceForOutput() { @@ -121,8 +125,8 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity // TilePowerAcceptor @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world.isClient) { return; @@ -191,7 +195,7 @@ public class MatterFabricatorBlockEntity extends PowerAcceptorBlockEntity // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { - return new ScreenHandlerBuilder("matterfabricator").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("matterfabricator").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).slot(0, 30, 20).slot(1, 50, 20).slot(2, 70, 20).slot(3, 90, 20).slot(4, 110, 20) .slot(5, 130, 20).outputSlot(6, 40, 66).outputSlot(7, 60, 66).outputSlot(8, 80, 66) .outputSlot(9, 100, 66).outputSlot(10, 120, 66).energySlot(11, 8, 72).syncEnergyValue() diff --git a/src/main/java/techreborn/blockentity/storage/energy/AdjustableSUBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/AdjustableSUBlockEntity.java index ae4f8fa38..7aeb93657 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/AdjustableSUBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/AdjustableSUBlockEntity.java @@ -28,10 +28,13 @@ import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import reborncore.api.blockentity.IUpgrade; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.util.RebornInventory; import team.reborn.energy.EnergySide; import team.reborn.energy.EnergyTier; @@ -45,8 +48,8 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements private int OUTPUT = 64; // The current output public int superconductors = 0; - public AdjustableSUBlockEntity() { - super(TRBlockEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnergyTier.INSANE, TechRebornConfig.aesuMaxEnergy); + public AdjustableSUBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.ADJUSTABLE_SU, pos, state, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnergyTier.INSANE, TechRebornConfig.aesuMaxEnergy); } public int getMaxConfigOutput() { @@ -86,8 +89,8 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements // EnergyStorageBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null) { return; } @@ -144,8 +147,8 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements } @Override - public void readNbt(BlockState blockState, NbtCompound nbttagcompound) { - super.readNbt(blockState, nbttagcompound); + public void readNbt(NbtCompound nbttagcompound) { + super.readNbt(nbttagcompound); this.OUTPUT = nbttagcompound.getInt("output"); } @@ -158,7 +161,7 @@ public class AdjustableSUBlockEntity extends EnergyStorageBlockEntity implements // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, PlayerEntity player) { - return new ScreenHandlerBuilder("aesu").player(player.inventory).inventory().hotbar().armor() + return new ScreenHandlerBuilder("aesu").player(player.getInventory()).inventory().hotbar().armor() .complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45) .syncEnergyValue().sync(this::getCurrentOutput, this::setCurentOutput).addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/storage/energy/EnergyStorageBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/EnergyStorageBlockEntity.java index f6dcd7d9c..75178f0f5 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/EnergyStorageBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/EnergyStorageBlockEntity.java @@ -25,12 +25,16 @@ package techreborn.blockentity.storage.energy; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.api.blockentity.InventoryProvider; +import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import reborncore.common.util.RebornInventory; import team.reborn.energy.EnergySide; @@ -50,8 +54,8 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity implement public int maxOutput; public int maxStorage; - public EnergyStorageBlockEntity(BlockEntityType blockEntityType, String name, int invSize, Block wrenchDrop, EnergyTier tier, int maxStorage) { - super(blockEntityType); + public EnergyStorageBlockEntity(BlockEntityType blockEntityType, BlockPos pos, BlockState state, String name, int invSize, Block wrenchDrop, EnergyTier tier, int maxStorage) { + super(blockEntityType, pos, state); inventory = new RebornInventory<>(invSize, name + "BlockEntity", 64, this); this.wrenchDrop = wrenchDrop; this.tier = tier; @@ -65,8 +69,8 @@ public class EnergyStorageBlockEntity extends PowerAcceptorBlockEntity implement // PowerAcceptorBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null) { return; } diff --git a/src/main/java/techreborn/blockentity/storage/energy/HighVoltageSUBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/HighVoltageSUBlockEntity.java index 5a23da5b5..4b77388eb 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/HighVoltageSUBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/HighVoltageSUBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -40,13 +42,13 @@ public class HighVoltageSUBlockEntity extends EnergyStorageBlockEntity implement /** * MFSU should store 4M Energy with 512 E/t I/O */ - public HighVoltageSUBlockEntity() { - super(TRBlockEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnergyTier.HIGH, 4_000_000); + public HighVoltageSUBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.HIGH_VOLTAGE_SU, pos, state, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnergyTier.HIGH, 4_000_000); } @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("mfsu").player(player.inventory).inventory().hotbar().armor() + return new ScreenHandlerBuilder("mfsu").player(player.getInventory()).inventory().hotbar().armor() .complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45) .syncEnergyValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/storage/energy/LowVoltageSUBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/LowVoltageSUBlockEntity.java index 0bc2561de..1e68aecd7 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/LowVoltageSUBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/LowVoltageSUBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -37,13 +39,13 @@ import techreborn.init.TRContent; */ public class LowVoltageSUBlockEntity extends EnergyStorageBlockEntity implements BuiltScreenHandlerProvider { - public LowVoltageSUBlockEntity() { - super(TRBlockEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnergyTier.LOW, 40_000); + public LowVoltageSUBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.LOW_VOLTAGE_SU, pos, state, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnergyTier.LOW, 40_000); } @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("batbox").player(player.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("batbox").player(player.getInventory()).inventory().hotbar().addInventory() .blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue().addInventory().create(this, syncID); } } diff --git a/src/main/java/techreborn/blockentity/storage/energy/MediumVoltageSUBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/MediumVoltageSUBlockEntity.java index a52a4bc9c..8ef4ba23c 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/MediumVoltageSUBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/MediumVoltageSUBlockEntity.java @@ -24,7 +24,9 @@ package techreborn.blockentity.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; @@ -40,13 +42,13 @@ public class MediumVoltageSUBlockEntity extends EnergyStorageBlockEntity impleme /** * MFE should store 300k energy with 128 E/t I/O */ - public MediumVoltageSUBlockEntity() { - super(TRBlockEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnergyTier.MEDIUM, 300_000); + public MediumVoltageSUBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.MEDIUM_VOLTAGE_SU, pos, state, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnergyTier.MEDIUM, 300_000); } @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("mfe").player(player.inventory).inventory().hotbar().armor() + return new ScreenHandlerBuilder("mfe").player(player.getInventory()).inventory().hotbar().armor() .complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45) .syncEnergyValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java b/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java index c9e66ec10..113060d78 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java +++ b/src/main/java/techreborn/blockentity/storage/energy/idsu/IDSUManager.java @@ -38,7 +38,6 @@ public class IDSUManager extends PersistentState { private static final String KEY = "techreborn_idsu"; public IDSUManager() { - super(KEY); } @NotNull @@ -48,7 +47,7 @@ public class IDSUManager extends PersistentState { public static IDSUManager get(World world) { ServerWorld serverWorld = (ServerWorld) world; - return serverWorld.getPersistentStateManager().getOrCreate(IDSUManager::new, KEY); + return serverWorld.getPersistentStateManager().getOrCreate(IDSUManager::createFromTag, IDSUManager::new, KEY); } private final HashMap playerHashMap = new HashMap<>(); @@ -58,8 +57,13 @@ public class IDSUManager extends PersistentState { return playerHashMap.computeIfAbsent(uuid, s -> new IDSUPlayer()); } - @Override - public void fromNbt(NbtCompound tag) { + public static IDSUManager createFromTag(NbtCompound tag) { + IDSUManager idsuManager = new IDSUManager(); + idsuManager.fromTag(tag); + return idsuManager; + } + + public void fromTag(NbtCompound tag) { for (String uuid : tag.getKeys()) { playerHashMap.put(uuid, new IDSUPlayer(tag.getCompound(uuid))); } diff --git a/src/main/java/techreborn/blockentity/storage/energy/idsu/InterdimensionalSUBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/idsu/InterdimensionalSUBlockEntity.java index 40592eba6..143f96cb6 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/idsu/InterdimensionalSUBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/idsu/InterdimensionalSUBlockEntity.java @@ -27,6 +27,7 @@ package techreborn.blockentity.storage.energy.idsu; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.math.BlockPos; import org.apache.commons.lang3.StringUtils; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; @@ -45,8 +46,8 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl //This is the energy value that is synced to the client private double clientEnergy; - public InterdimensionalSUBlockEntity() { - super(TRBlockEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnergyTier.INSANE, TechRebornConfig.idsuMaxEnergy); + public InterdimensionalSUBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.INTERDIMENSIONAL_SU, pos, state, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnergyTier.INSANE, TechRebornConfig.idsuMaxEnergy); } @Override @@ -96,8 +97,8 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl } @Override - public void readNbt(BlockState blockState, NbtCompound nbttagcompound) { - super.readNbt(blockState, nbttagcompound); + public void readNbt(NbtCompound nbttagcompound) { + super.readNbt(nbttagcompound); this.ownerUdid = nbttagcompound.getString("ownerUdid"); } @@ -113,7 +114,7 @@ public class InterdimensionalSUBlockEntity extends EnergyStorageBlockEntity impl @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("idsu").player(player.inventory).inventory().hotbar().armor() + return new ScreenHandlerBuilder("idsu").player(player.getInventory()).inventory().hotbar().armor() .complete(8, 18).addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45) .syncEnergyValue().addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/storage/energy/lesu/LSUStorageBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/lesu/LSUStorageBlockEntity.java index 58b35f4a6..d17923b2c 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/lesu/LSUStorageBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/lesu/LSUStorageBlockEntity.java @@ -24,6 +24,7 @@ package techreborn.blockentity.storage.energy.lesu; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -40,8 +41,8 @@ public class LSUStorageBlockEntity extends MachineBaseBlockEntity public LesuNetwork network; - public LSUStorageBlockEntity() { - super(TRBlockEntities.LSU_STORAGE); + public LSUStorageBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.LSU_STORAGE, pos, state); } public final void findAndJoinNetwork(World world, BlockPos pos) { @@ -86,8 +87,8 @@ public class LSUStorageBlockEntity extends MachineBaseBlockEntity // TileMachineBase @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (network == null) { findAndJoinNetwork(world, pos); } else { diff --git a/src/main/java/techreborn/blockentity/storage/energy/lesu/LapotronicSUBlockEntity.java b/src/main/java/techreborn/blockentity/storage/energy/lesu/LapotronicSUBlockEntity.java index 992f151d7..a3541eb65 100644 --- a/src/main/java/techreborn/blockentity/storage/energy/lesu/LapotronicSUBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/energy/lesu/LapotronicSUBlockEntity.java @@ -25,12 +25,16 @@ package techreborn.blockentity.storage.energy.lesu; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.World; import reborncore.client.screen.BuiltScreenHandlerProvider; import reborncore.client.screen.builder.BuiltScreenHandler; import reborncore.client.screen.builder.ScreenHandlerBuilder; +import reborncore.common.blockentity.MachineBaseBlockEntity; import team.reborn.energy.EnergyTier; import techreborn.blockentity.storage.energy.EnergyStorageBlockEntity; import techreborn.blocks.storage.energy.LapotronicSUBlock; @@ -45,8 +49,8 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements private int connectedBlocks = 0; private final ArrayList countedNetworks = new ArrayList<>(); - public LapotronicSUBlockEntity() { - super(TRBlockEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.LOW, TechRebornConfig.lesuStoragePerBlock); + public LapotronicSUBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.LAPOTRONIC_SU, pos, state, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnergyTier.LOW, TechRebornConfig.lesuStoragePerBlock); checkOverfill = false; this.maxOutput = TechRebornConfig.lesuBaseOutput; } @@ -95,8 +99,8 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements // EnergyStorageBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world.isClient) { return; } @@ -125,7 +129,7 @@ public class LapotronicSUBlockEntity extends EnergyStorageBlockEntity implements // IContainerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("lesu").player(player.inventory).inventory().hotbar().armor().complete(8, 18) + return new ScreenHandlerBuilder("lesu").player(player.getInventory()).inventory().hotbar().armor().complete(8, 18) .addArmor().addInventory().blockEntity(this).energySlot(0, 62, 45).energySlot(1, 98, 45).syncEnergyValue() .sync(this::getConnectedBlocksNum, this::setConnectedBlocksNum).addInventory().create(this, syncID); } diff --git a/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java b/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java index 86c476fdd..c602080bd 100644 --- a/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/fluid/TankUnitBaseBlockEntity.java @@ -32,6 +32,8 @@ import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import org.apache.commons.lang3.text.WordUtils; import org.jetbrains.annotations.Nullable; import reborncore.api.IListInfoProvider; @@ -43,7 +45,6 @@ import reborncore.client.screen.builder.ScreenHandlerBuilder; import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.fluid.FluidUtil; import reborncore.common.fluid.FluidValue; -import reborncore.common.fluid.container.FluidInstance; import reborncore.common.util.RebornInventory; import reborncore.common.util.Tank; import techreborn.init.TRBlockEntities; @@ -54,24 +55,22 @@ import java.util.List; public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements InventoryProvider, IToolDrop, IListInfoProvider, BuiltScreenHandlerProvider { protected Tank tank; - private int serverMaxCapacity = -1; - protected RebornInventory inventory = new RebornInventory<>(2, "TankInventory", 64, this); private TRContent.TankUnit type; - public TankUnitBaseBlockEntity() { - super(TRBlockEntities.TANK_UNIT); + public TankUnitBaseBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.TANK_UNIT, pos, state); } - public TankUnitBaseBlockEntity(TRContent.TankUnit type) { - super(TRBlockEntities.TANK_UNIT); + public TankUnitBaseBlockEntity(BlockPos pos, BlockState state, TRContent.TankUnit type) { + super(TRBlockEntities.TANK_UNIT, pos, state); configureEntity(type); } private void configureEntity(TRContent.TankUnit type) { this.type = type; - this.tank = new Tank("TankStorage", serverMaxCapacity == -1 ? type.capacity : FluidValue.fromRaw(serverMaxCapacity), this); + this.tank = new Tank("TankStorage", type.capacity, this); } public ItemStack getDropWithNBT() { @@ -85,8 +84,8 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I // MachineBaseBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient()){ return; @@ -115,8 +114,8 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I } @Override - public void readNbt(BlockState blockState, final NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(final NbtCompound tagCompound) { + super.readNbt(tagCompound); if (tagCompound.contains("unitType")) { this.type = TRContent.TankUnit.valueOf(tagCompound.getString("unitType")); configureEntity(type); @@ -175,24 +174,9 @@ public class TankUnitBaseBlockEntity extends MachineBaseBlockEntity implements I // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity player) { - return new ScreenHandlerBuilder("tank").player(player.inventory).inventory().hotbar() + return new ScreenHandlerBuilder("tank").player(player.getInventory()).inventory().hotbar() .addInventory().blockEntity(this).fluidSlot(0, 100, 53).outputSlot(1, 140, 53) - .sync(tank) - .sync(this::getMaxCapacity, this::setMaxCapacity) - - .addInventory().create(this, syncID); - } - - // Sync between server/client if configs are mis-matched. - public int getMaxCapacity() { - return this.tank.getCapacity().getRawValue(); - } - - public void setMaxCapacity(int maxCapacity) { - FluidInstance instance = tank.getFluidInstance(); - this.tank = new Tank("TankStorage", FluidValue.fromRaw(maxCapacity), this); - this.tank.setFluidInstance(instance); - this.serverMaxCapacity = maxCapacity; + .sync(tank).addInventory().create(this, syncID); } @Nullable diff --git a/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java b/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java index ffab48428..b03cde488 100644 --- a/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java +++ b/src/main/java/techreborn/blockentity/storage/item/StorageUnitBaseBlockEntity.java @@ -63,7 +63,6 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement protected RebornInventory inventory; private int maxCapacity; - private int serverCapacity = -1; private ItemStack storeItemStack; @@ -73,22 +72,17 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement // the locked-in item, even if the stored amount drops to zero. private ItemStack lockedItemStack = ItemStack.EMPTY; - public StorageUnitBaseBlockEntity() { - super(TRBlockEntities.STORAGE_UNIT); + public StorageUnitBaseBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.STORAGE_UNIT, pos, state); } - public StorageUnitBaseBlockEntity(TRContent.StorageUnit type) { - super(TRBlockEntities.STORAGE_UNIT); + public StorageUnitBaseBlockEntity(BlockPos pos, BlockState state, TRContent.StorageUnit type) { + super(TRBlockEntities.STORAGE_UNIT, pos, state); configureEntity(type); } private void configureEntity(TRContent.StorageUnit type) { - - // Set capacity to local config unless overridden by server - if(serverCapacity == -1){ - this.maxCapacity = type.capacity; - } - + this.maxCapacity = type.capacity; storeItemStack = ItemStack.EMPTY; inventory = new RebornInventory<>(2, "ItemInventory", 64, this); @@ -242,10 +236,14 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement return storeItemStack.getCount() + inventory.getStack(OUTPUT_SLOT).getCount(); } + public int getMaxCapacity() { + return maxCapacity; + } + // MachineBaseBlockEntity @Override - public void tick() { - super.tick(); + public void tick(World world, BlockPos pos, BlockState state, MachineBaseBlockEntity blockEntity) { + super.tick(world, pos, state, blockEntity); if (world == null || world.isClient) { return; } @@ -285,8 +283,8 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement } @Override - public void readNbt(BlockState blockState, NbtCompound tagCompound) { - super.readNbt(blockState, tagCompound); + public void readNbt(NbtCompound tagCompound) { + super.readNbt(tagCompound); if (tagCompound.contains("unitType")) { this.type = TRContent.StorageUnit.valueOf(tagCompound.getString("unitType")); @@ -452,14 +450,13 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement // BuiltScreenHandlerProvider @Override public BuiltScreenHandler createScreenHandler(int syncID, final PlayerEntity playerEntity) { - return new ScreenHandlerBuilder("chest").player(playerEntity.inventory).inventory().hotbar().addInventory() + return new ScreenHandlerBuilder("chest").player(playerEntity.getInventory()).inventory().hotbar().addInventory() .blockEntity(this) .slot(INPUT_SLOT, 100, 53) .outputSlot(OUTPUT_SLOT, 140, 53) .sync(this::isLockedInt, this::setLockedInt) .sync(this::getStoredStackNBT, this::setStoredStackFromNBT) .sync(this::getStoredAmount, this::setStoredAmount) - .sync(this::getMaxCapacity, this::setMaxCapacity) .addInventory().create(this, syncID); // Note that inventory is synced, and it gets the stack from that @@ -482,16 +479,6 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement this.storedAmount = storedAmount; } - // Sync between server/client if configs are mis-matched. - public int getMaxCapacity() { - return this.maxCapacity; - } - - public void setMaxCapacity(int maxCapacity) { - this.maxCapacity = maxCapacity; - this.serverCapacity = maxCapacity; - } - public NbtCompound getStoredStackNBT() { NbtCompound tag = new NbtCompound(); getStoredStack().writeNbt(tag); diff --git a/src/main/java/techreborn/blockentity/transformers/EVTransformerBlockEntity.java b/src/main/java/techreborn/blockentity/transformers/EVTransformerBlockEntity.java index 6b906fbf0..ba4843856 100644 --- a/src/main/java/techreborn/blockentity/transformers/EVTransformerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/transformers/EVTransformerBlockEntity.java @@ -24,6 +24,8 @@ package techreborn.blockentity.transformers; +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; import team.reborn.energy.EnergyTier; import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; @@ -33,8 +35,8 @@ import techreborn.init.TRContent; */ public class EVTransformerBlockEntity extends TransformerBlockEntity { - public EVTransformerBlockEntity() { - super(TRBlockEntities.EV_TRANSFORMER, "EVTransformer", TRContent.Machine.EV_TRANSFORMER.block, EnergyTier.INSANE); + public EVTransformerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.EV_TRANSFORMER, pos, state, "EVTransformer", TRContent.Machine.EV_TRANSFORMER.block, EnergyTier.INSANE); } } diff --git a/src/main/java/techreborn/blockentity/transformers/HVTransformerBlockEntity.java b/src/main/java/techreborn/blockentity/transformers/HVTransformerBlockEntity.java index 350bd3493..b74fa31a8 100644 --- a/src/main/java/techreborn/blockentity/transformers/HVTransformerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/transformers/HVTransformerBlockEntity.java @@ -24,6 +24,8 @@ package techreborn.blockentity.transformers; +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; import team.reborn.energy.EnergyTier; import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; @@ -33,8 +35,8 @@ import techreborn.init.TRContent; */ public class HVTransformerBlockEntity extends TransformerBlockEntity { - public HVTransformerBlockEntity() { - super(TRBlockEntities.HV_TRANSFORMER, "HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnergyTier.EXTREME); + public HVTransformerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.HV_TRANSFORMER, pos, state, "HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnergyTier.EXTREME); } } diff --git a/src/main/java/techreborn/blockentity/transformers/LVTransformerBlockEntity.java b/src/main/java/techreborn/blockentity/transformers/LVTransformerBlockEntity.java index e7eeede5d..7bbb24112 100644 --- a/src/main/java/techreborn/blockentity/transformers/LVTransformerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/transformers/LVTransformerBlockEntity.java @@ -24,6 +24,8 @@ package techreborn.blockentity.transformers; +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; import team.reborn.energy.EnergyTier; import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; @@ -33,8 +35,8 @@ import techreborn.init.TRContent; */ public class LVTransformerBlockEntity extends TransformerBlockEntity { - public LVTransformerBlockEntity() { - super(TRBlockEntities.LV_TRANSFORMER, "LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnergyTier.MEDIUM); + public LVTransformerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.LV_TRANSFORMER, pos, state, "LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnergyTier.MEDIUM); } } diff --git a/src/main/java/techreborn/blockentity/transformers/MVTransformerBlockEntity.java b/src/main/java/techreborn/blockentity/transformers/MVTransformerBlockEntity.java index dea989149..ecedde67c 100644 --- a/src/main/java/techreborn/blockentity/transformers/MVTransformerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/transformers/MVTransformerBlockEntity.java @@ -24,6 +24,8 @@ package techreborn.blockentity.transformers; +import net.minecraft.block.BlockState; +import net.minecraft.util.math.BlockPos; import team.reborn.energy.EnergyTier; import techreborn.init.TRBlockEntities; import techreborn.init.TRContent; @@ -33,7 +35,7 @@ import techreborn.init.TRContent; */ public class MVTransformerBlockEntity extends TransformerBlockEntity { - public MVTransformerBlockEntity() { - super(TRBlockEntities.MV_TRANSFORMER, "MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnergyTier.HIGH); + public MVTransformerBlockEntity(BlockPos pos, BlockState state) { + super(TRBlockEntities.MV_TRANSFORMER, pos, state, "MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnergyTier.HIGH); } } diff --git a/src/main/java/techreborn/blockentity/transformers/TransformerBlockEntity.java b/src/main/java/techreborn/blockentity/transformers/TransformerBlockEntity.java index 90db1b8a3..726cd2b3e 100644 --- a/src/main/java/techreborn/blockentity/transformers/TransformerBlockEntity.java +++ b/src/main/java/techreborn/blockentity/transformers/TransformerBlockEntity.java @@ -25,12 +25,14 @@ package techreborn.blockentity.transformers; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import reborncore.api.IListInfoProvider; import reborncore.api.IToolDrop; @@ -57,8 +59,8 @@ public class TransformerBlockEntity extends PowerAcceptorBlockEntity implements public int maxOutput; public int maxStorage; - public TransformerBlockEntity(BlockEntityType blockEntityType, String name, Block wrenchDrop, EnergyTier tier) { - super(blockEntityType); + public TransformerBlockEntity(BlockEntityType blockEntityType, BlockPos pos, BlockState state, String name, Block wrenchDrop, EnergyTier tier) { + super(blockEntityType, pos, state); this.wrenchDrop = wrenchDrop; this.inputTier = tier; if (tier != EnergyTier.MICRO) { diff --git a/src/main/java/techreborn/blocks/GenericMachineBlock.java b/src/main/java/techreborn/blocks/GenericMachineBlock.java index b0400a042..5276b5fda 100644 --- a/src/main/java/techreborn/blocks/GenericMachineBlock.java +++ b/src/main/java/techreborn/blocks/GenericMachineBlock.java @@ -25,12 +25,13 @@ package techreborn.blocks; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; -import java.util.function.Supplier; +import java.util.function.BiFunction; /** * @author drcrazy @@ -38,32 +39,30 @@ import java.util.function.Supplier; public class GenericMachineBlock extends BlockMachineBase { private final IMachineGuiHandler gui; - Supplier blockEntityClass; + BiFunction blockEntityClass; - public GenericMachineBlock(IMachineGuiHandler gui, Supplier blockEntityClass) { + public GenericMachineBlock(IMachineGuiHandler gui, BiFunction blockEntityClass) { super(); this.blockEntityClass = blockEntityClass; this.gui = gui; } - public GenericMachineBlock(Block.Settings settings, IMachineGuiHandler gui, Supplier blockEntityClass) { + public GenericMachineBlock(Block.Settings settings, IMachineGuiHandler gui, BiFunction blockEntityClass) { super(settings); this.blockEntityClass = blockEntityClass; this.gui = gui; } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { if (blockEntityClass == null) { return null; } - return blockEntityClass.get(); + return blockEntityClass.apply(pos, state); } - @Override public IMachineGuiHandler getGui() { return gui; } - } diff --git a/src/main/java/techreborn/blocks/cable/CableBlock.java b/src/main/java/techreborn/blocks/cable/CableBlock.java index 282cac742..1229d7dc7 100644 --- a/src/main/java/techreborn/blocks/cable/CableBlock.java +++ b/src/main/java/techreborn/blocks/cable/CableBlock.java @@ -26,6 +26,8 @@ package techreborn.blocks.cable; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; +import net.minecraft.block.entity.BlockEntityTicker; +import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; @@ -148,8 +150,13 @@ public class CableBlock extends BlockWithEntity implements Waterloggable { @Nullable @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new CableBlockEntity(type); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new CableBlockEntity(pos, state, type); + } + + @Override + public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + return (world1, pos, state1, blockEntity) -> ((CableBlockEntity) blockEntity).tick(world1, pos, state1, (CableBlockEntity) blockEntity); } // Block diff --git a/src/main/java/techreborn/blocks/cable/CableShapeUtil.java b/src/main/java/techreborn/blocks/cable/CableShapeUtil.java index 3ee67b116..6d1783229 100644 --- a/src/main/java/techreborn/blocks/cable/CableShapeUtil.java +++ b/src/main/java/techreborn/blocks/cable/CableShapeUtil.java @@ -62,7 +62,7 @@ public final class CableShapeUtil { double z = dir == Direction.NORTH ? 0 : dir == Direction.SOUTH ? 16D : size; double y = dir == Direction.DOWN ? 0 : dir == Direction.UP ? 16D : size; - VoxelShape shape = Block.createCuboidShape(x, y, z, 16.0D - size, 16.0D - size, 16.0D - size); + VoxelShape shape = VoxelShapes.cuboidUnchecked(x, y, z, 16.0D - size, 16.0D - size, 16.0D - size); connections.add(shape); } } diff --git a/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java b/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java index 02e853cea..ee9a8309c 100644 --- a/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java +++ b/src/main/java/techreborn/blocks/generator/BlockFusionControlComputer.java @@ -34,7 +34,6 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; import net.minecraft.world.World; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; @@ -83,8 +82,8 @@ public class BlockFusionControlComputer extends BlockMachineBase { } @Override - public void onSteppedOn(final World worldIn, final BlockPos pos, final Entity entityIn) { - super.onSteppedOn(worldIn, pos, entityIn); + public void onSteppedOn(final World worldIn, final BlockPos pos, final BlockState state, final Entity entityIn) { + super.onSteppedOn(worldIn, pos, state, entityIn); if (worldIn.getBlockEntity(pos) instanceof FusionControlComputerBlockEntity) { if (((FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos)).craftingTickTime != 0 && ((FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos)).isMultiblockValid()) { @@ -94,8 +93,8 @@ public class BlockFusionControlComputer extends BlockMachineBase { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new FusionControlComputerBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new FusionControlComputerBlockEntity(pos, state); } @Override diff --git a/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java b/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java index cb6cceff4..8c4d37f06 100644 --- a/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java +++ b/src/main/java/techreborn/blocks/generator/BlockSolarPanel.java @@ -27,7 +27,6 @@ package techreborn.blocks.generator; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; import net.minecraft.world.World; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; @@ -49,8 +48,8 @@ public class BlockSolarPanel extends BlockMachineBase { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new SolarPanelBlockEntity(panelType); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new SolarPanelBlockEntity(pos, state, panelType); } @Override diff --git a/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java b/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java index 22abd2116..99967b840 100644 --- a/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java +++ b/src/main/java/techreborn/blocks/generator/GenericGeneratorBlock.java @@ -32,14 +32,14 @@ import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.powerSystem.PowerAcceptorBlockEntity; import techreborn.blocks.GenericMachineBlock; -import java.util.function.Supplier; +import java.util.function.BiFunction; /** * An extension of {@link GenericMachineBlock} that provides utilities * for generators, like comparator output based on energy. */ public class GenericGeneratorBlock extends GenericMachineBlock { - public GenericGeneratorBlock(IMachineGuiHandler gui, Supplier blockEntityClass) { + public GenericGeneratorBlock(IMachineGuiHandler gui, BiFunction blockEntityClass) { super(gui, blockEntityClass); } diff --git a/src/main/java/techreborn/blocks/lighting/LampBlock.java b/src/main/java/techreborn/blocks/lighting/LampBlock.java index 5cd75205a..470882ce5 100644 --- a/src/main/java/techreborn/blocks/lighting/LampBlock.java +++ b/src/main/java/techreborn/blocks/lighting/LampBlock.java @@ -109,8 +109,8 @@ public class LampBlock extends BaseBlockEntityProvider { // BaseTileBlock @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new LampBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new LampBlockEntity(pos, state); } // Block diff --git a/src/main/java/techreborn/blocks/machine/tier1/PlayerDetectorBlock.java b/src/main/java/techreborn/blocks/machine/tier1/PlayerDetectorBlock.java index 4f42ea3a7..a17ea6ede 100644 --- a/src/main/java/techreborn/blocks/machine/tier1/PlayerDetectorBlock.java +++ b/src/main/java/techreborn/blocks/machine/tier1/PlayerDetectorBlock.java @@ -65,8 +65,8 @@ public class PlayerDetectorBlock extends BlockMachineBase { // BlockMachineBase @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new PlayerDectectorBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new PlayerDectectorBlockEntity(pos, state); } @Override diff --git a/src/main/java/techreborn/blocks/machine/tier1/ResinBasinBlock.java b/src/main/java/techreborn/blocks/machine/tier1/ResinBasinBlock.java index b4c2837aa..0144e4f65 100644 --- a/src/main/java/techreborn/blocks/machine/tier1/ResinBasinBlock.java +++ b/src/main/java/techreborn/blocks/machine/tier1/ResinBasinBlock.java @@ -46,16 +46,16 @@ import reborncore.common.util.WorldUtils; import techreborn.init.TRContent; import java.util.UUID; -import java.util.function.Supplier; +import java.util.function.BiFunction; public class ResinBasinBlock extends BaseBlockEntityProvider { public static final DirectionProperty FACING = Properties.HORIZONTAL_FACING; public static final BooleanProperty POURING = BooleanProperty.of("pouring"); public static final BooleanProperty FULL = BooleanProperty.of("full"); - Supplier blockEntityClass; + BiFunction blockEntityClass; - public ResinBasinBlock(Supplier blockEntityClass) { + public ResinBasinBlock(BiFunction blockEntityClass) { super(Block.Settings.of(Material.WOOD).strength(2F, 2F)); this.blockEntityClass = blockEntityClass; @@ -99,11 +99,11 @@ public class ResinBasinBlock extends BaseBlockEntityProvider { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { if (blockEntityClass == null) { return null; } - return blockEntityClass.get(); + return blockEntityClass.apply(pos, state); } @Override diff --git a/src/main/java/techreborn/blocks/misc/BlockAlarm.java b/src/main/java/techreborn/blocks/misc/BlockAlarm.java index 2afb09fff..e6a750f23 100644 --- a/src/main/java/techreborn/blocks/misc/BlockAlarm.java +++ b/src/main/java/techreborn/blocks/misc/BlockAlarm.java @@ -100,8 +100,8 @@ public class BlockAlarm extends BaseBlockEntityProvider { // BaseTileBlock @Nullable @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new AlarmBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new AlarmBlockEntity(pos, state); } // Block diff --git a/src/main/java/techreborn/blocks/misc/BlockComputerCube.java b/src/main/java/techreborn/blocks/misc/BlockComputerCube.java index 6066fb370..49067b953 100644 --- a/src/main/java/techreborn/blocks/misc/BlockComputerCube.java +++ b/src/main/java/techreborn/blocks/misc/BlockComputerCube.java @@ -26,6 +26,7 @@ package techreborn.blocks.misc; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.sound.SoundCategory; @@ -35,6 +36,7 @@ import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import org.jetbrains.annotations.Nullable; import reborncore.api.ToolManager; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; @@ -71,4 +73,10 @@ public class BlockComputerCube extends BlockMachineBase { } return ActionResult.PASS; } + + @Nullable + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return null; + } } diff --git a/src/main/java/techreborn/blocks/misc/BlockMachineCasing.java b/src/main/java/techreborn/blocks/misc/BlockMachineCasing.java index 4d5757e63..b12526789 100644 --- a/src/main/java/techreborn/blocks/misc/BlockMachineCasing.java +++ b/src/main/java/techreborn/blocks/misc/BlockMachineCasing.java @@ -30,7 +30,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Material; import net.minecraft.block.entity.BlockEntity; import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import reborncore.common.multiblock.BlockMultiblockBase; import techreborn.blockentity.machine.multiblock.casing.MachineCasingBlockEntity; @@ -53,8 +53,8 @@ public class BlockMachineCasing extends BlockMultiblockBase { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new MachineCasingBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new MachineCasingBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/misc/BlockRubberLog.java b/src/main/java/techreborn/blocks/misc/BlockRubberLog.java index 57cda1a5e..5f45b2b20 100644 --- a/src/main/java/techreborn/blocks/misc/BlockRubberLog.java +++ b/src/main/java/techreborn/blocks/misc/BlockRubberLog.java @@ -38,7 +38,6 @@ import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.Properties; import net.minecraft.tag.BlockTags; -import net.minecraft.tag.Tag; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -88,10 +87,10 @@ public class BlockRubberLog extends PillarBlock { } } - @Override + /* FIXME @Override public boolean isIn(Tag tagIn) { return tagIn == BlockTags.LOGS; - } + }*/ @SuppressWarnings("deprecation") @Override @@ -148,7 +147,7 @@ public class BlockRubberLog extends PillarBlock { } else { stack.damage(1, playerIn, player -> player.sendToolBreakStatus(hand)); } - if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) { + if (!playerIn.getInventory().insertStack(TRContent.Parts.SAP.getStack())) { WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(hitResult.getSide())); } if (playerIn instanceof ServerPlayerEntity) { diff --git a/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java index 4e46c5bfe..18f2773da 100644 --- a/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/AdjustableSUBlock.java @@ -24,8 +24,9 @@ package techreborn.blocks.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.storage.energy.AdjustableSUBlockEntity; import techreborn.client.GuiType; @@ -36,8 +37,8 @@ public class AdjustableSUBlock extends EnergyStorageBlock { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new AdjustableSUBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new AdjustableSUBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/storage/energy/EnergyStorageBlock.java b/src/main/java/techreborn/blocks/storage/energy/EnergyStorageBlock.java index f99162bbe..a6f9ed100 100644 --- a/src/main/java/techreborn/blocks/storage/energy/EnergyStorageBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/EnergyStorageBlock.java @@ -80,9 +80,9 @@ public abstract class EnergyStorageBlock extends BaseBlockEntityProvider { public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { super.onPlaced(worldIn, pos, state, placer, stack); Direction facing = placer.getHorizontalFacing().getOpposite(); - if (placer.pitch < -50) { + if (placer.getPitch() < -50) { facing = Direction.DOWN; - } else if (placer.pitch > 50) { + } else if (placer.getPitch() > 50) { facing = Direction.UP; } setFacing(facing, worldIn, pos); diff --git a/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java index 84c31f7bb..d35a622f5 100644 --- a/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/HighVoltageSUBlock.java @@ -24,8 +24,9 @@ package techreborn.blocks.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.storage.energy.HighVoltageSUBlockEntity; import techreborn.client.GuiType; @@ -39,8 +40,8 @@ public class HighVoltageSUBlock extends EnergyStorageBlock { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new HighVoltageSUBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new HighVoltageSUBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java index 8c3dd6240..d8b842195 100644 --- a/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/InterdimensionalSUBlock.java @@ -30,7 +30,6 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; import net.minecraft.world.World; import techreborn.blockentity.storage.energy.idsu.InterdimensionalSUBlockEntity; import techreborn.client.GuiType; @@ -42,8 +41,8 @@ public class InterdimensionalSUBlock extends EnergyStorageBlock { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new InterdimensionalSUBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new InterdimensionalSUBlockEntity(pos, state); } @Override diff --git a/src/main/java/techreborn/blocks/storage/energy/LSUStorageBlock.java b/src/main/java/techreborn/blocks/storage/energy/LSUStorageBlock.java index 269d93d9f..d119b519f 100644 --- a/src/main/java/techreborn/blocks/storage/energy/LSUStorageBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/LSUStorageBlock.java @@ -35,7 +35,6 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; import net.minecraft.world.World; import reborncore.api.ToolManager; import reborncore.common.BaseBlockEntityProvider; @@ -69,8 +68,8 @@ public class LSUStorageBlock extends BaseBlockEntityProvider { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new LSUStorageBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new LSUStorageBlockEntity(pos, state); } @Override diff --git a/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java index a4b7a28eb..6581da8de 100644 --- a/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/LapotronicSUBlock.java @@ -24,8 +24,9 @@ package techreborn.blocks.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.storage.energy.lesu.LapotronicSUBlockEntity; import techreborn.client.GuiType; @@ -36,8 +37,8 @@ public class LapotronicSUBlock extends EnergyStorageBlock { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new LapotronicSUBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new LapotronicSUBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java index 9de06a76d..65b4a7cf7 100644 --- a/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/LowVoltageSUBlock.java @@ -24,8 +24,9 @@ package techreborn.blocks.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.storage.energy.LowVoltageSUBlockEntity; import techreborn.client.GuiType; @@ -39,7 +40,7 @@ public class LowVoltageSUBlock extends EnergyStorageBlock { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new LowVoltageSUBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new LowVoltageSUBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java b/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java index 0a22c8794..36751eefc 100644 --- a/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java +++ b/src/main/java/techreborn/blocks/storage/energy/MediumVoltageSUBlock.java @@ -24,8 +24,9 @@ package techreborn.blocks.storage.energy; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.storage.energy.MediumVoltageSUBlockEntity; import techreborn.client.GuiType; @@ -39,8 +40,8 @@ public class MediumVoltageSUBlock extends EnergyStorageBlock { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new MediumVoltageSUBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new MediumVoltageSUBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java b/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java index 37904e760..a2858fb0b 100644 --- a/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java +++ b/src/main/java/techreborn/blocks/storage/fluid/TankUnitBlock.java @@ -35,7 +35,6 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; import net.minecraft.world.World; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; @@ -59,8 +58,8 @@ public class TankUnitBlock extends BlockMachineBase { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new TankUnitBaseBlockEntity(unitType); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new TankUnitBaseBlockEntity(pos, state, unitType); } @Override @@ -114,7 +113,7 @@ public class TankUnitBlock extends BlockMachineBase { selectedStack.increment(1); didInsert = true; }else { - didInsert = playerIn.inventory.insertStack(item); + didInsert = playerIn.getInventory().insertStack(item); } diff --git a/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java b/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java index f4c01dafa..f335ca95e 100644 --- a/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java +++ b/src/main/java/techreborn/blocks/storage/item/StorageUnitBlock.java @@ -25,7 +25,6 @@ package techreborn.blocks.storage.item; import net.minecraft.block.BlockState; -import net.minecraft.block.Material; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; @@ -36,7 +35,6 @@ import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; import net.minecraft.world.World; import reborncore.api.blockentity.IMachineGuiHandler; import reborncore.common.blocks.BlockMachineBase; @@ -51,13 +49,13 @@ public class StorageUnitBlock extends BlockMachineBase { public final TRContent.StorageUnit unitType; public StorageUnitBlock(TRContent.StorageUnit unitType) { - super((Settings.of(unitType.name.equals("crude") ? Material.WOOD : Material.METAL).strength(2.0F, 2.0F))); + super(); this.unitType = unitType; } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new StorageUnitBaseBlockEntity(unitType); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new StorageUnitBaseBlockEntity(pos, state, unitType); } @Override @@ -74,10 +72,10 @@ public class StorageUnitBlock extends BlockMachineBase { (!storageEntity.isLocked() && storageEntity.isEmpty() && (!(itemInHand instanceof ToolItem))))) { // Add item which is the same type (in users inventory) into storage - for (int i = 0; i < playerIn.inventory.size() && !storageEntity.isFull(); i++) { - ItemStack curStack = playerIn.inventory.getStack(i); + for (int i = 0; i < playerIn.getInventory().size() && !storageEntity.isFull(); i++) { + ItemStack curStack = playerIn.getInventory().getStack(i); if (curStack.getItem() == itemInHand) { - playerIn.inventory.setStack(i, storageEntity.processInput(curStack)); + playerIn.getInventory().setStack(i, storageEntity.processInput(curStack)); } } diff --git a/src/main/java/techreborn/blocks/transformers/BlockEVTransformer.java b/src/main/java/techreborn/blocks/transformers/BlockEVTransformer.java index e06924890..1c0d41342 100644 --- a/src/main/java/techreborn/blocks/transformers/BlockEVTransformer.java +++ b/src/main/java/techreborn/blocks/transformers/BlockEVTransformer.java @@ -24,8 +24,9 @@ package techreborn.blocks.transformers; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.transformers.EVTransformerBlockEntity; /** @@ -38,8 +39,8 @@ public class BlockEVTransformer extends BlockTransformer { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new EVTransformerBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new EVTransformerBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/transformers/BlockHVTransformer.java b/src/main/java/techreborn/blocks/transformers/BlockHVTransformer.java index 4ec857179..3a1726043 100644 --- a/src/main/java/techreborn/blocks/transformers/BlockHVTransformer.java +++ b/src/main/java/techreborn/blocks/transformers/BlockHVTransformer.java @@ -24,8 +24,9 @@ package techreborn.blocks.transformers; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.transformers.HVTransformerBlockEntity; /** @@ -38,8 +39,8 @@ public class BlockHVTransformer extends BlockTransformer { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new HVTransformerBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new HVTransformerBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/transformers/BlockLVTransformer.java b/src/main/java/techreborn/blocks/transformers/BlockLVTransformer.java index 7d117c7a9..af93a6a4b 100644 --- a/src/main/java/techreborn/blocks/transformers/BlockLVTransformer.java +++ b/src/main/java/techreborn/blocks/transformers/BlockLVTransformer.java @@ -24,8 +24,9 @@ package techreborn.blocks.transformers; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.transformers.LVTransformerBlockEntity; /** @@ -38,7 +39,7 @@ public class BlockLVTransformer extends BlockTransformer { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new LVTransformerBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new LVTransformerBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/transformers/BlockMVTransformer.java b/src/main/java/techreborn/blocks/transformers/BlockMVTransformer.java index 21da9e75b..2d19ae33e 100644 --- a/src/main/java/techreborn/blocks/transformers/BlockMVTransformer.java +++ b/src/main/java/techreborn/blocks/transformers/BlockMVTransformer.java @@ -24,8 +24,9 @@ package techreborn.blocks.transformers; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.world.BlockView; +import net.minecraft.util.math.BlockPos; import techreborn.blockentity.transformers.MVTransformerBlockEntity; /** @@ -38,8 +39,8 @@ public class BlockMVTransformer extends BlockTransformer { } @Override - public BlockEntity createBlockEntity(BlockView worldIn) { - return new MVTransformerBlockEntity(); + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new MVTransformerBlockEntity(pos, state); } } diff --git a/src/main/java/techreborn/blocks/transformers/BlockTransformer.java b/src/main/java/techreborn/blocks/transformers/BlockTransformer.java index 80330faec..8d0ebd51d 100644 --- a/src/main/java/techreborn/blocks/transformers/BlockTransformer.java +++ b/src/main/java/techreborn/blocks/transformers/BlockTransformer.java @@ -75,9 +75,9 @@ public abstract class BlockTransformer extends BaseBlockEntityProvider { ItemStack stack) { super.onPlaced(worldIn, pos, state, placer, stack); Direction facing = placer.getHorizontalFacing().getOpposite(); - if (placer.pitch < -50) { + if (placer.getPitch() < -50) { facing = Direction.DOWN; - } else if (placer.pitch > 50) { + } else if (placer.getPitch() > 50) { facing = Direction.UP; } setFacing(facing, worldIn, pos); diff --git a/src/main/java/techreborn/client/gui/GuiAESU.java b/src/main/java/techreborn/client/gui/GuiAESU.java index e818a1d50..8381811b5 100644 --- a/src/main/java/techreborn/client/gui/GuiAESU.java +++ b/src/main/java/techreborn/client/gui/GuiAESU.java @@ -50,10 +50,10 @@ public class GuiAESU extends GuiBase { @Override public void init() { super.init(); - addButton(new GuiButtonUpDown(x + 121, y + 79, this, b -> onClick(256), UpDownButtonType.FASTFORWARD)); - addButton(new GuiButtonUpDown(x + 121 + 12, y + 79, this, b -> onClick(64), UpDownButtonType.FORWARD)); - addButton(new GuiButtonUpDown(x + 121 + 24, y + 79, this, b -> onClick(-64), UpDownButtonType.REWIND)); - addButton(new GuiButtonUpDown(x + 121 + 36, y + 79, this, b -> onClick(-256), UpDownButtonType.FASTREWIND)); + addDrawableChild(new GuiButtonUpDown(x + 121, y + 79, this, b -> onClick(256), UpDownButtonType.FASTFORWARD)); + addDrawableChild(new GuiButtonUpDown(x + 121 + 12, y + 79, this, b -> onClick(64), UpDownButtonType.FORWARD)); + addDrawableChild(new GuiButtonUpDown(x + 121 + 24, y + 79, this, b -> onClick(-64), UpDownButtonType.REWIND)); + addDrawableChild(new GuiButtonUpDown(x + 121 + 36, y + 79, this, b -> onClick(-256), UpDownButtonType.FASTREWIND)); } @Override diff --git a/src/main/java/techreborn/client/gui/GuiChunkLoader.java b/src/main/java/techreborn/client/gui/GuiChunkLoader.java index f6174ef30..191df268f 100644 --- a/src/main/java/techreborn/client/gui/GuiChunkLoader.java +++ b/src/main/java/techreborn/client/gui/GuiChunkLoader.java @@ -49,12 +49,12 @@ public class GuiChunkLoader extends GuiBase { public void init() { super.init(); - addButton(new GuiButtonUpDown(x + 64, y + 40, this, b -> onClick(5), UpDownButtonType.FASTFORWARD)); - addButton(new GuiButtonUpDown(x + 64 + 12, y + 40, this, b -> onClick(1), UpDownButtonType.FORWARD)); - addButton(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND)); - addButton(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND)); + addDrawableChild(new GuiButtonUpDown(x + 64, y + 40, this, b -> onClick(5), UpDownButtonType.FASTFORWARD)); + addDrawableChild(new GuiButtonUpDown(x + 64 + 12, y + 40, this, b -> onClick(1), UpDownButtonType.FORWARD)); + addDrawableChild(new GuiButtonUpDown(x + 64 + 24, y + 40, this, b -> onClick(-1), UpDownButtonType.REWIND)); + addDrawableChild(new GuiButtonUpDown(x + 64 + 36, y + 40, this, b -> onClick(-5), UpDownButtonType.FASTREWIND)); - addButton(new GuiButtonSimple(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))); + addDrawableChild(new GuiButtonSimple(x + 10, y + 70, 155, 20, new LiteralText("Toggle Loaded Chunks"), b -> ClientChunkManager.toggleLoadedChunks(blockEntity.getPos()))); } @Override diff --git a/src/main/java/techreborn/client/gui/GuiFusionReactor.java b/src/main/java/techreborn/client/gui/GuiFusionReactor.java index 1b1dd8b0d..dbe504901 100644 --- a/src/main/java/techreborn/client/gui/GuiFusionReactor.java +++ b/src/main/java/techreborn/client/gui/GuiFusionReactor.java @@ -56,10 +56,10 @@ public class GuiFusionReactor extends GuiBase { @Override public void init() { super.init(); - addButton(new GuiButtonUpDown(x + 121, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(5), UpDownButtonType.FASTFORWARD)); - addButton(new GuiButtonUpDown(x + 121 + 12, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(1), UpDownButtonType.FORWARD)); - addButton(new GuiButtonUpDown(x + 121 + 24, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-5), UpDownButtonType.REWIND)); - addButton(new GuiButtonUpDown(x + 121 + 36, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-1), UpDownButtonType.FASTREWIND)); + addDrawableChild(new GuiButtonUpDown(x + 121, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(5), UpDownButtonType.FASTFORWARD)); + addDrawableChild(new GuiButtonUpDown(x + 121 + 12, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(1), UpDownButtonType.FORWARD)); + addDrawableChild(new GuiButtonUpDown(x + 121 + 24, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-5), UpDownButtonType.REWIND)); + addDrawableChild(new GuiButtonUpDown(x + 121 + 36, y + 79, this, (ButtonWidget buttonWidget) -> sendSizeChange(-1), UpDownButtonType.FASTREWIND)); } @Override diff --git a/src/main/java/techreborn/client/gui/GuiIronFurnace.java b/src/main/java/techreborn/client/gui/GuiIronFurnace.java index 93847fcbb..67e4c9bca 100644 --- a/src/main/java/techreborn/client/gui/GuiIronFurnace.java +++ b/src/main/java/techreborn/client/gui/GuiIronFurnace.java @@ -25,6 +25,7 @@ package techreborn.client.gui; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; @@ -48,6 +49,7 @@ public class GuiIronFurnace extends GuiBase { IronFurnaceBlockEntity blockEntity; + public GuiIronFurnace(int syncID, PlayerEntity player, IronFurnaceBlockEntity furnace) { super(player, furnace, furnace.createScreenHandler(syncID, player)); this.blockEntity = furnace; @@ -60,14 +62,11 @@ public class GuiIronFurnace extends GuiBase { @Override public void init() { super.init(); - addButton(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, LiteralText.EMPTY, b -> onClick()) { + addSelectableChild(new GuiButtonSimple(getGuiLeft() + 116, getGuiTop() + 57, 18, 18, LiteralText.EMPTY, b -> onClick()) { @Override public void renderToolTip(MatrixStack matrixStack, int mouseX, int mouseY) { - PlayerEntity player = playerInventory.player; - if (player == null) { - return; - } + PlayerEntity player = MinecraftClient.getInstance().player; String message = "Experience: "; float furnaceExp = blockEntity.experience; @@ -94,14 +93,13 @@ public class GuiIronFurnace extends GuiBase { List list = new ArrayList<>(); list.add(new LiteralText(message)); renderTooltip(matrixStack, list, mouseX, mouseY); - GlStateManager.disableLighting(); - GlStateManager.color4f(1, 1, 1, 1); + RenderSystem.setShaderColor(1, 1, 1, 1); } @Override - public void renderBackground(MatrixStack matrixStack, MinecraftClient mc, int mouseX, int mouseY) { - mc.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y); + protected void renderBackground(MatrixStack matrices, MinecraftClient client, int mouseX, int mouseY) { + client.getItemRenderer().renderInGuiWithOverrides(new ItemStack(Items.EXPERIENCE_BOTTLE), x, y); } }); } diff --git a/src/main/java/techreborn/client/gui/GuiManual.java b/src/main/java/techreborn/client/gui/GuiManual.java index fee0e5b33..3386f532d 100644 --- a/src/main/java/techreborn/client/gui/GuiManual.java +++ b/src/main/java/techreborn/client/gui/GuiManual.java @@ -60,20 +60,20 @@ public class GuiManual extends Screen { public void init() { int y = (height / 2) - guiHeight / 2; y += 40; - addButton(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, new TranslatableText("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { + addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 10, 60, 20, new TranslatableText("techreborn.manual.wikibtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { if (t) { Util.getOperatingSystem().open("http://wiki.techreborn.ovh"); } this.client.openScreen(this); }, "http://wiki.techreborn.ovh", false)))); - addButton(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, new TranslatableText("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { + addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 60, 60, 20, new TranslatableText("techreborn.manual.discordbtn"), var1 -> client.openScreen(new ConfirmChatLinkScreen(t -> { if (t) { Util.getOperatingSystem().open("https://discord.gg/teamreborn"); } this.client.openScreen(this); }, "https://discord.gg/teamreborn", false)))); if (TechRebornConfig.allowManualRefund) { - addButton(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, new TranslatableText("techreborn.manual.refundbtn"), var1 -> { + addSelectableChild(new GuiButtonExtended((width / 2 - 30), y + 110, 60, 20, new TranslatableText("techreborn.manual.refundbtn"), var1 -> { NetworkManager.sendToServer(ServerboundPackets.createRefundPacket()); this.client.openScreen(null); })); diff --git a/src/main/java/techreborn/client/render/entitys/CableCoverRenderer.java b/src/main/java/techreborn/client/render/entitys/CableCoverRenderer.java index 9291eb6af..4dbd0ca79 100644 --- a/src/main/java/techreborn/client/render/entitys/CableCoverRenderer.java +++ b/src/main/java/techreborn/client/render/entitys/CableCoverRenderer.java @@ -31,18 +31,17 @@ import net.minecraft.client.render.RenderLayers; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.BlockRenderManager; -import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import techreborn.blockentity.cable.CableBlockEntity; import techreborn.blocks.cable.CableBlock; import java.util.Random; -public class CableCoverRenderer extends BlockEntityRenderer { +public class CableCoverRenderer implements BlockEntityRenderer { - public CableCoverRenderer(BlockEntityRenderDispatcher dispatcher) { - super(dispatcher); + public CableCoverRenderer(BlockEntityRendererFactory.Context ctx) { } @Override diff --git a/src/main/java/techreborn/client/render/entitys/NukeRenderer.java b/src/main/java/techreborn/client/render/entitys/NukeRenderer.java index 2b4f45e65..4fa7d8d13 100644 --- a/src/main/java/techreborn/client/render/entitys/NukeRenderer.java +++ b/src/main/java/techreborn/client/render/entitys/NukeRenderer.java @@ -25,26 +25,25 @@ package techreborn.client.render.entitys; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.TntMinecartEntityRenderer; import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3f; +import org.jetbrains.annotations.Nullable; import techreborn.entities.EntityNukePrimed; import techreborn.init.TRContent; -import org.jetbrains.annotations.Nullable; - /** * Created by Mark on 13/03/2016. */ public class NukeRenderer extends EntityRenderer { - public NukeRenderer(EntityRenderDispatcher renderManager) { - super(renderManager); + public NukeRenderer(EntityRendererFactory.Context ctx) { + super(ctx); this.shadowRadius = 0.5F; } @@ -58,8 +57,8 @@ public class NukeRenderer extends EntityRenderer { public void render(EntityNukePrimed entity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { matrixStack.push(); matrixStack.translate(0.0D, 0.5D, 0.0D); - if ((float) entity.getFuseTimer() - g + 1.0F < 10.0F) { - float h = 1.0F - ((float) entity.getFuseTimer() - g + 1.0F) / 10.0F; + if ((float) entity.getFuse() - g + 1.0F < 10.0F) { + float h = 1.0F - ((float) entity.getFuse() - g + 1.0F) / 10.0F; h = MathHelper.clamp(h, 0.0F, 1.0F); h *= h; h *= h; @@ -69,7 +68,7 @@ public class NukeRenderer extends EntityRenderer { matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-90.0F)); matrixStack.translate(-0.5D, -0.5D, 0.5D); - TntMinecartEntityRenderer.renderFlashingBlock(TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuseTimer() / 5 % 2 == 0); + TntMinecartEntityRenderer.renderFlashingBlock(TRContent.NUKE.getDefaultState(), matrixStack, vertexConsumerProvider, i, entity.getFuse() / 5 % 2 == 0); matrixStack.pop(); super.render(entity, f, g, matrixStack, vertexConsumerProvider, i); } diff --git a/src/main/java/techreborn/client/render/entitys/StorageUnitRenderer.java b/src/main/java/techreborn/client/render/entitys/StorageUnitRenderer.java index 756f0cd82..5590242c1 100644 --- a/src/main/java/techreborn/client/render/entitys/StorageUnitRenderer.java +++ b/src/main/java/techreborn/client/render/entitys/StorageUnitRenderer.java @@ -29,8 +29,8 @@ import net.minecraft.client.font.TextRenderer; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; @@ -41,9 +41,9 @@ import techreborn.blockentity.storage.item.StorageUnitBaseBlockEntity; /** * Created by drcrazy on 07-Jan-20 for TechReborn-1.15. */ -public class StorageUnitRenderer extends BlockEntityRenderer { - public StorageUnitRenderer(BlockEntityRenderDispatcher dispatcher) { - super(dispatcher); +public class StorageUnitRenderer implements BlockEntityRenderer { + + public StorageUnitRenderer(BlockEntityRendererFactory.Context ctx) { } @Override @@ -74,12 +74,12 @@ public class StorageUnitRenderer extends BlockEntityRenderer { +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; + +public class TurbineRenderer implements BlockEntityRenderer { private static final TurbineModel MODEL = new TurbineModel(); public static final Identifier TEXTURE = new Identifier("techreborn:textures/block/machines/generators/wind_mill_turbine.png"); - - public TurbineRenderer(BlockEntityRenderDispatcher dispatcher) { - super(dispatcher); + + public TurbineRenderer(BlockEntityRendererFactory.Context ctx) { } @Override @@ -71,33 +74,40 @@ public class TurbineRenderer extends BlockEntityRenderer { public TurbineModel() { super(RenderLayer::getEntityCutoutNoCull); - textureWidth = 64; - textureHeight = 64; - base = new ModelPart(this); + ModelPart.Cuboid[] baseCuboids = { + new ModelPart.Cuboid(0, 0, -2.0F, -2.0F, -1.0F, 4F, 4F, 2F, 0F, 0F, 0F, false, 64F, 64F), + new ModelPart.Cuboid(0, 6, -1.0F, -1.0F, -2.0F, 2F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F) + }; + base = new ModelPart(Arrays.asList(baseCuboids), new HashMap() { + { + ModelPart.Cuboid[] blade1Cuboids = { + new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F) + }; + ModelPart blade1 = new ModelPart(Arrays.asList(blade1Cuboids) , Collections.emptyMap()); + blade1.setPivot(0.0F, 0.0F, 0.0F); + setRotation(blade1, -0.5236F, 0.0F, 0.0F); + put("blade1", blade1); + + ModelPart.Cuboid[] blade2Cuboids = { + new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F) + }; + ModelPart blade2 = new ModelPart(Arrays.asList(blade2Cuboids) , Collections.emptyMap()); + blade2.setPivot(0.0F, 0.0F, 0.0F); + setRotation(blade2, -0.5236F, 0.0F, 2.0944F); + put("blade2", blade2); + + ModelPart.Cuboid[] blade3Cuboids = { + new ModelPart.Cuboid(0, 9, -24.0F, -2.0F, -1.075F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F) + }; + ModelPart blade3 = new ModelPart(Arrays.asList(blade3Cuboids) , Collections.emptyMap()); + blade3.setPivot(0.0F, 0.0F, 0.0F); + setRotation(blade3, -0.5236F, 0.0F, -2.0944F); + put("blade3", blade3); + } + }); base.setPivot(0.0F, 24.0F, 0.0F); - base.addCuboid(null, -2.0F, -2.0F, -1.0F, 4, 4, 2, 0.0F, 0, 0); - base.addCuboid(null, -1.0F, -1.0F, -2.0F, 2, 2, 1, 0.0F, 0, 6); - - ModelPart blade1 = new ModelPart(this); - blade1.setPivot(0.0F, 0.0F, 0.0F); - setRotation(blade1, -0.5236F, 0.0F, 0.0F); - blade1.addCuboid(null, -24.0F, -1.0F, -0.5F, 24, 2, 1, 0.0F, 0, 9); - - ModelPart blade2 = new ModelPart(this); - blade2.setPivot(0.0F, 0.0F, 0.0F); - setRotation(blade2, -0.5236F, 0.0F, 2.0944F); - blade2.addCuboid(null, -24.0F, -1.0F, -0.5F, 24, 2, 1, 0.0F, 0, 9); - - ModelPart blade3 = new ModelPart(this); - blade3.setPivot(0.0F, 0.0F, 0.0F); - setRotation(blade3, -0.5236F, 0.0F, -2.0944F); - blade3.addCuboid(null, -24.0F, -2.0F, -1.075F, 24, 2, 1, 0.0F, 0, 9); - - base.addChild(blade1); - base.addChild(blade2); - base.addChild(blade3); } private void setRotation(ModelPart model, float x, float y, float z) { diff --git a/src/main/java/techreborn/client/screen/DestructoPackScreenHandler.java b/src/main/java/techreborn/client/screen/DestructoPackScreenHandler.java index 42c8b0745..a0bcf5fee 100644 --- a/src/main/java/techreborn/client/screen/DestructoPackScreenHandler.java +++ b/src/main/java/techreborn/client/screen/DestructoPackScreenHandler.java @@ -56,12 +56,12 @@ public class DestructoPackScreenHandler extends ScreenHandler { for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { - this.addSlot(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + this.addSlot(new Slot(player.getInventory(), j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { - this.addSlot(new Slot(player.inventory, i, 8 + i * 18, 142)); + this.addSlot(new Slot(player.getInventory(), i, 8 + i * 18, 142)); } } } diff --git a/src/main/java/techreborn/compat/rei/ReiPlugin.java b/src/main/java/techreborn/compat/rei/ReiPlugin.java index 7f71fbda7..f5a52f44d 100644 --- a/src/main/java/techreborn/compat/rei/ReiPlugin.java +++ b/src/main/java/techreborn/compat/rei/ReiPlugin.java @@ -404,7 +404,7 @@ public class ReiPlugin implements REIPluginV0 { final int iconHeight = sprite.getHeight(); int offsetHeight = drawHeight; - RenderSystem.color3f((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F); + RenderSystem.setShaderColor((color >> 16 & 255) / 255.0F, (float) (color >> 8 & 255) / 255.0F, (float) (color & 255) / 255.0F, 1F); int iteration = 0; while (offsetHeight != 0) { diff --git a/src/main/java/techreborn/config/TechRebornConfig.java b/src/main/java/techreborn/config/TechRebornConfig.java index 2653acd05..f757f0246 100644 --- a/src/main/java/techreborn/config/TechRebornConfig.java +++ b/src/main/java/techreborn/config/TechRebornConfig.java @@ -292,12 +292,6 @@ public class TechRebornConfig { @Config(config = "items", category = "power", key = "quantumSuitFireExtinguishCost", comment = "Quantum Suit Cost for Fire Extinguish") public static double fireExtinguishCost = 50; - @Config(config = "items", category = "power", key = "quantumSuitEnableSprint", comment = "Enable Sprint Speed increase for Quantum Legs") - public static boolean quantumSuitEnableSprint = true; - - @Config(config = "items", category = "power", key = "quantumSuitEnableFlight", comment = "Enable Flight for Quantum Chest") - public static boolean quantumSuitEnableFlight = true; - @Config(config = "items", category = "power", key = "quantumSuitDamageAbsorbCost", comment = "Quantum Suit Cost for Damage Absorbed") public static double damageAbsorbCost = 10; diff --git a/src/main/java/techreborn/entities/EntityNukePrimed.java b/src/main/java/techreborn/entities/EntityNukePrimed.java index eeee8a6e4..657f60ee1 100644 --- a/src/main/java/techreborn/entities/EntityNukePrimed.java +++ b/src/main/java/techreborn/entities/EntityNukePrimed.java @@ -60,9 +60,9 @@ public class EntityNukePrimed extends TntEntity { this.setVelocity(this.getVelocity().multiply(0.7D, -0.5D, 0.7D)); } - setFuse(getFuseTimer() - 1); - if (this.getFuseTimer() <= 0) { - this.remove(); + setFuse(getFuse() - 1); + if (this.getFuse() <= 0) { + this.remove(RemovalReason.KILLED); if (!this.world.isClient) { this.explodeNuke(); } diff --git a/src/main/java/techreborn/events/StackToolTipHandler.java b/src/main/java/techreborn/events/StackToolTipHandler.java index 442bb4045..7ad444838 100644 --- a/src/main/java/techreborn/events/StackToolTipHandler.java +++ b/src/main/java/techreborn/events/StackToolTipHandler.java @@ -27,7 +27,6 @@ package techreborn.events; import com.google.common.collect.Maps; import net.fabricmc.fabric.api.client.item.v1.ItemTooltipCallback; import net.minecraft.block.Block; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.item.TooltipContext; import net.minecraft.item.Item; @@ -35,7 +34,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.text.Text; import net.minecraft.util.registry.Registry; import reborncore.common.BaseBlockEntityProvider; -import techreborn.TechReborn; import techreborn.init.TRContent; import techreborn.items.UpgradeItem; import techreborn.utils.ToolTipAssistUtils; @@ -55,12 +53,7 @@ public class StackToolTipHandler implements ItemTooltipCallback { public void getTooltip(ItemStack stack, TooltipContext tooltipContext, List tooltipLines) { Item item = stack.getItem(); - // Can currently be executed by a ForkJoinPool.commonPool-worker when REI is in async search mode - // We skip this method until a thread-safe solution is in place - if (!MinecraftClient.getInstance().isOnThread()) - return; - - if (!ITEM_ID.computeIfAbsent(item, StackToolTipHandler::isTRItem)) + if (!ITEM_ID.computeIfAbsent(item, this::isTRItem)) return; // Machine info and upgrades helper section @@ -78,7 +71,7 @@ public class StackToolTipHandler implements ItemTooltipCallback { } } - private static boolean isTRItem(Item item) { + private boolean isTRItem(Item item) { return Registry.ITEM.getId(item).getNamespace().equals("techreborn"); } } diff --git a/src/main/java/techreborn/init/ModLoot.java b/src/main/java/techreborn/init/ModLoot.java index b03958f9e..740c85e1b 100644 --- a/src/main/java/techreborn/init/ModLoot.java +++ b/src/main/java/techreborn/init/ModLoot.java @@ -28,7 +28,7 @@ import net.fabricmc.fabric.api.loot.v1.FabricLootPoolBuilder; import net.fabricmc.fabric.api.loot.v1.event.LootTableLoadingCallback; import net.minecraft.item.ItemConvertible; import net.minecraft.loot.LootPool; -import net.minecraft.loot.UniformLootTableRange; +import net.minecraft.loot.provider.number.UniformLootNumberProvider; import net.minecraft.loot.entry.ItemEntry; import net.minecraft.loot.entry.LootPoolEntry; import net.minecraft.loot.function.SetCountLootFunction; @@ -73,17 +73,17 @@ public class ModLoot { LootPool poolBasic = FabricLootPoolBuilder.builder().withEntry(copperIngot).withEntry(tinIngot) .withEntry(leadIngot).withEntry(silverIngot).withEntry(refinedronIngot).withEntry(advancedalloyIngot) - .withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootTableRange.between(1.0f, 2.0f)) + .withEntry(basicFrame).withEntry(basicCircuit).withEntry(rubberSapling).rolls(UniformLootNumberProvider.create(1.0f, 2.0f)) .build(); LootPool poolAdvanced = FabricLootPoolBuilder.builder().withEntry(aluminumIngot).withEntry(electrumIngot) .withEntry(invarIngot).withEntry(nickelIngot).withEntry(steelIngot).withEntry(zincIngot) - .withEntry(advancedFrame).withEntry(advancedCircuit).withEntry(dataStorageChip).rolls(UniformLootTableRange.between(1.0f, 3.0f)) + .withEntry(advancedFrame).withEntry(advancedCircuit).withEntry(dataStorageChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f)) .build(); LootPool poolIndustrial = FabricLootPoolBuilder.builder().withEntry(chromeIngot).withEntry(iridiumIngot) .withEntry(platinumIngot).withEntry(titaniumIngot).withEntry(tungstenIngot).withEntry(tungstensteelIngot) - .withEntry(industrialFrame).withEntry(industrialCircuit).withEntry(energyFlowChip).rolls(UniformLootTableRange.between(1.0f, 3.0f)) + .withEntry(industrialFrame).withEntry(industrialCircuit).withEntry(energyFlowChip).rolls(UniformLootNumberProvider.create(1.0f, 3.0f)) .build(); LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, ident, supplier, setter) -> { @@ -149,7 +149,7 @@ public class ModLoot { */ private static LootPoolEntry makeEntry(ItemConvertible item, int weight) { return ItemEntry.builder(item).weight(weight) - .apply(SetCountLootFunction.builder(UniformLootTableRange.between(1.0f, 2.0f))).build(); + .apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(1.0f, 2.0f))).build(); } diff --git a/src/main/java/techreborn/init/TRBlockEntities.java b/src/main/java/techreborn/init/TRBlockEntities.java index 3c9245714..f460bf2ca 100644 --- a/src/main/java/techreborn/init/TRBlockEntities.java +++ b/src/main/java/techreborn/init/TRBlockEntities.java @@ -24,11 +24,14 @@ package techreborn.init; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.item.ItemConvertible; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; import org.apache.commons.lang3.Validate; import techreborn.TechReborn; @@ -69,6 +72,7 @@ import techreborn.blockentity.transformers.MVTransformerBlockEntity; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.BiFunction; import java.util.function.Supplier; public class TRBlockEntities { @@ -136,16 +140,16 @@ public class TRBlockEntities { public static final BlockEntityType WIRE_MILL = register(WireMillBlockEntity::new, "wire_mill", TRContent.Machine.WIRE_MILL); public static final BlockEntityType GREENHOUSE_CONTROLLER = register(GreenhouseControllerBlockEntity::new, "greenhouse_controller", TRContent.Machine.GREENHOUSE_CONTROLLER); - public static BlockEntityType register(Supplier supplier, String name, ItemConvertible... items) { + public static BlockEntityType register(BiFunction supplier, String name, ItemConvertible... items) { return register(supplier, name, Arrays.stream(items).map(itemConvertible -> Block.getBlockFromItem(itemConvertible.asItem())).toArray(Block[]::new)); } - public static BlockEntityType register(Supplier supplier, String name, Block... blocks) { + public static BlockEntityType register(BiFunction supplier, String name, Block... blocks) { Validate.isTrue(blocks.length > 0, "no blocks for blockEntity entity type!"); - return register(new Identifier(TechReborn.MOD_ID, name).toString(), BlockEntityType.Builder.create(supplier, blocks)); + return register(new Identifier(TechReborn.MOD_ID, name).toString(), FabricBlockEntityTypeBuilder.create((pos, state) -> supplier.apply(pos, state), blocks)); } - public static BlockEntityType register(String id, BlockEntityType.Builder builder) { + public static BlockEntityType register(String id, FabricBlockEntityTypeBuilder builder) { BlockEntityType blockEntityType = builder.build(null); Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(id), blockEntityType); TRBlockEntities.TYPES.add(blockEntityType); diff --git a/src/main/java/techreborn/init/TRDispenserBehavior.java b/src/main/java/techreborn/init/TRDispenserBehavior.java index a48d22bfa..5f635fbbb 100644 --- a/src/main/java/techreborn/init/TRDispenserBehavior.java +++ b/src/main/java/techreborn/init/TRDispenserBehavior.java @@ -40,6 +40,8 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.math.Position; import net.minecraft.world.WorldAccess; import reborncore.common.crafting.RebornRecipe; +import reborncore.common.fluid.container.ItemFluidInfo; +import techreborn.TechReborn; import techreborn.config.TechRebornConfig; import techreborn.items.DynamicCellItem; @@ -78,7 +80,13 @@ public class TRDispenserBehavior { if (cell.getFluid(stack) == Fluids.EMPTY) { // fill cell if (block instanceof FluidDrainable) { - Fluid fluid = ((FluidDrainable) block).tryDrainFluid(iWorld, blockPos, blockState); + ItemStack fluidContainer = ((FluidDrainable) block).tryDrainFluid(iWorld, blockPos, blockState); + Fluid fluid = null; + if (fluidContainer.getItem() instanceof ItemFluidInfo) { + fluid = ((ItemFluidInfo) fluidContainer.getItem()).getFluid(fluidContainer); + } else { + TechReborn.LOGGER.debug("Could not get Fluid from ItemStack " + fluidContainer.getItem()); + } if (!(fluid instanceof FlowableFluid)) { return super.dispenseSilently(pointer, stack); } else { diff --git a/src/main/java/techreborn/items/DynamicCellItem.java b/src/main/java/techreborn/items/DynamicCellItem.java index 6211224f0..543cd30d7 100644 --- a/src/main/java/techreborn/items/DynamicCellItem.java +++ b/src/main/java/techreborn/items/DynamicCellItem.java @@ -98,7 +98,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo { } private void insertOrDropStack(PlayerEntity playerEntity, ItemStack stack) { - if (!playerEntity.inventory.insertStack(stack)) { + if (!playerEntity.getInventory().insertStack(stack)) { playerEntity.dropStack(stack); } } @@ -184,8 +184,9 @@ public class DynamicCellItem extends Item implements ItemFluidInfo { if (world.canPlayerModifyAt(player, hitPos) && player.canPlaceOn(placePos, side, stack)) { if (containedFluid == Fluids.EMPTY) { if (hitState.getBlock() instanceof FluidDrainable) { - Fluid drainFluid = ((FluidDrainable) hitState.getBlock()).tryDrainFluid(world, hitPos, hitState); - if (drainFluid != Fluids.EMPTY) { + ItemStack itemStack = ((FluidDrainable) hitState.getBlock()).tryDrainFluid(world, hitPos, hitState); + if (!itemStack.isEmpty() && itemStack.getItem() instanceof ItemFluidInfo) { + Fluid drainFluid = ((ItemFluidInfo) itemStack.getItem()).getFluid(itemStack); if (stack.getCount() == 1) { stack = getCellWithFluid(drainFluid, 1); } else { diff --git a/src/main/java/techreborn/items/armor/CloakingDeviceItem.java b/src/main/java/techreborn/items/armor/CloakingDeviceItem.java index dd88cd351..6a03afec7 100644 --- a/src/main/java/techreborn/items/armor/CloakingDeviceItem.java +++ b/src/main/java/techreborn/items/armor/CloakingDeviceItem.java @@ -33,7 +33,7 @@ import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.collection.DefaultedList; import reborncore.api.items.ArmorRemoveHandler; -import reborncore.api.items.ArmorTickable; +import reborncore.api.items.ArmorBlockEntityTicker; import reborncore.common.powerSystem.PowerSystem; import reborncore.common.util.ItemUtils; import team.reborn.energy.Energy; @@ -45,7 +45,7 @@ import techreborn.config.TechRebornConfig; import techreborn.init.TRArmorMaterials; import techreborn.utils.InitUtils; -public class CloakingDeviceItem extends TRArmourItem implements EnergyHolder, ArmorTickable, ArmorRemoveHandler { +public class CloakingDeviceItem extends TRArmourItem implements EnergyHolder, ArmorBlockEntityTicker, ArmorRemoveHandler { public static int maxCharge = TechRebornConfig.cloakingDeviceCharge; public static int cost = TechRebornConfig.cloackingDeviceCost; diff --git a/src/main/java/techreborn/items/armor/QuantumSuitItem.java b/src/main/java/techreborn/items/armor/QuantumSuitItem.java index 056851748..c7c78ed97 100644 --- a/src/main/java/techreborn/items/armor/QuantumSuitItem.java +++ b/src/main/java/techreborn/items/armor/QuantumSuitItem.java @@ -41,7 +41,7 @@ import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.collection.DefaultedList; import reborncore.api.items.ArmorRemoveHandler; -import reborncore.api.items.ArmorTickable; +import reborncore.api.items.ArmorBlockEntityTicker; import reborncore.api.items.ItemStackModifiers; import reborncore.common.powerSystem.PowerSystem; import reborncore.common.util.ItemUtils; @@ -52,7 +52,7 @@ import techreborn.TechReborn; import techreborn.config.TechRebornConfig; import techreborn.utils.InitUtils; -public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers, ArmorTickable, ArmorRemoveHandler, EnergyHolder { +public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers, ArmorBlockEntityTicker, ArmorRemoveHandler, EnergyHolder { public final double flyCost = TechRebornConfig.quantumSuitFlyingCost; public final double swimCost = TechRebornConfig.quantumSuitSwimmingCost; @@ -60,10 +60,6 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers, public final double sprintingCost = TechRebornConfig.quantumSuitSprintingCost; public final double fireExtinguishCost = TechRebornConfig.fireExtinguishCost; - public final boolean enableSprint = TechRebornConfig.quantumSuitEnableSprint; - public final boolean enableFlight = TechRebornConfig.quantumSuitEnableFlight; - - public QuantumSuitItem(ArmorMaterial material, EquipmentSlot slot) { super(material, slot, new Item.Settings().group(TechReborn.ITEMGROUP).maxDamage(-1).maxCount(1)); } @@ -72,7 +68,7 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers, public void getAttributeModifiers(EquipmentSlot equipmentSlot, ItemStack stack, Multimap attributes) { attributes.removeAll(EntityAttributes.GENERIC_MOVEMENT_SPEED); - if (this.slot == EquipmentSlot.LEGS && equipmentSlot == EquipmentSlot.LEGS && enableSprint) { + if (this.slot == EquipmentSlot.LEGS && equipmentSlot == EquipmentSlot.LEGS) { if (Energy.of(stack).getEnergy() > sprintingCost) { attributes.put(EntityAttributes.GENERIC_MOVEMENT_SPEED, new EntityAttributeModifier(MODIFIERS[equipmentSlot.getEntitySlotId()], "Movement Speed", 0.15, EntityAttributeModifier.Operation.ADDITION)); } @@ -95,24 +91,22 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers, } break; case CHEST: - if (enableFlight){ - if (Energy.of(stack).getEnergy() > flyCost && !TechReborn.elytraPredicate.test(playerEntity)) { - playerEntity.abilities.allowFlying = true; - if (playerEntity.abilities.flying) { - Energy.of(stack).use(flyCost); - } - playerEntity.setOnGround(true); - } else { - playerEntity.abilities.allowFlying = false; - playerEntity.abilities.flying = false; + if (Energy.of(stack).getEnergy() > flyCost && !TechReborn.elytraPredicate.test(playerEntity)) { + playerEntity.getAbilities().allowFlying = true; + if (playerEntity.getAbilities().flying) { + Energy.of(stack).use(flyCost); } + playerEntity.setOnGround(true); + } else { + playerEntity.getAbilities().allowFlying = false; + playerEntity.getAbilities().flying = false; } if (playerEntity.isOnFire() && Energy.of(stack).getEnergy() > fireExtinguishCost) { playerEntity.extinguish(); } break; case LEGS: - if (playerEntity.isSprinting() && enableSprint) { + if (playerEntity.isSprinting()) { Energy.of(stack).use(sprintingCost); } break; @@ -135,10 +129,10 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers, @Override public void onRemoved(PlayerEntity playerEntity) { - if (this.slot == EquipmentSlot.CHEST && enableFlight) { + if (this.slot == EquipmentSlot.CHEST) { if (!playerEntity.isCreative() && !playerEntity.isSpectator()) { - playerEntity.abilities.allowFlying = false; - playerEntity.abilities.flying = false; + playerEntity.getAbilities().allowFlying = false; + playerEntity.getAbilities().flying = false; } } } diff --git a/src/main/java/techreborn/items/tool/ChainsawItem.java b/src/main/java/techreborn/items/tool/ChainsawItem.java index f76530c65..1d3ef44c0 100644 --- a/src/main/java/techreborn/items/tool/ChainsawItem.java +++ b/src/main/java/techreborn/items/tool/ChainsawItem.java @@ -68,7 +68,7 @@ public class ChainsawItem extends AxeItem implements EnergyHolder, ItemDurabilit @Override public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) { if (Energy.of(stack).getEnergy() >= cost - && (state.getMaterial() == Material.WOOD || state.getMaterial() == Material.NETHER_WOOD)) { + && (state.getMaterial() == Material.WOOD)) { return poweredSpeed; } return unpoweredSpeed; diff --git a/src/main/java/techreborn/items/tool/DebugToolItem.java b/src/main/java/techreborn/items/tool/DebugToolItem.java index f2276766e..c07d6cd8a 100644 --- a/src/main/java/techreborn/items/tool/DebugToolItem.java +++ b/src/main/java/techreborn/items/tool/DebugToolItem.java @@ -27,12 +27,10 @@ package techreborn.items.tool; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.command.BlockDataObject; import net.minecraft.item.Item; import net.minecraft.item.ItemUsageContext; import net.minecraft.state.property.Property; import net.minecraft.text.LiteralText; -import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; import net.minecraft.util.Formatting; @@ -61,32 +59,23 @@ public class DebugToolItem extends Item { return ActionResult.FAIL; } sendMessage(context, new LiteralText(getRegistryName(block))); - for (Entry, Comparable> entry : blockState.getEntries().entrySet()) { sendMessage(context, new LiteralText(getPropertyString(entry))); } - BlockEntity blockEntity = context.getWorld().getBlockEntity(context.getBlockPos()); - if (blockEntity == null) { - return ActionResult.SUCCESS; + if (blockEntity != null) { + sendMessage(context, new LiteralText(getBlockEntityType(blockEntity))); + if (Energy.valid(blockEntity)) { + sendMessage(context, new LiteralText(getRCPower(blockEntity))); + } } - - sendMessage(context, new LiteralText(getBlockEntityType(blockEntity))); - - if (Energy.valid(blockEntity)) { - sendMessage(context, new LiteralText(getRCPower(blockEntity))); - } - - sendMessage(context, getBlockEntityTags(blockEntity)); - return ActionResult.SUCCESS; } - private void sendMessage(ItemUsageContext context, Text message) { - if (context.getWorld().isClient || context.getPlayer() == null) { - return; + private void sendMessage(ItemUsageContext context, Text string) { + if (!context.getWorld().isClient) { + context.getPlayer().sendSystemMessage(string, Util.NIL_UUID); } - context.getPlayer().sendSystemMessage(message, Util.NIL_UUID); } private String getPropertyString(Entry, Comparable> entryIn) { @@ -113,7 +102,7 @@ public class DebugToolItem extends Item { private String getBlockEntityType(BlockEntity blockEntity) { String s = "" + Formatting.GREEN; - s += "Block Entity: "; + s += "Tile Entity: "; s += Formatting.BLUE; s += blockEntity.getType().toString(); @@ -130,13 +119,4 @@ public class DebugToolItem extends Item { return s; } - - private Text getBlockEntityTags(BlockEntity blockEntity){ - MutableText s = new LiteralText("BlockEntity Tags:").formatted(Formatting.GREEN); - - BlockDataObject bdo = new BlockDataObject(blockEntity, blockEntity.getPos()); - s.append(bdo.getNbt().toText()); - - return s; - } } diff --git a/src/main/java/techreborn/items/tool/DrillItem.java b/src/main/java/techreborn/items/tool/DrillItem.java index ff914c70f..aea6c752c 100644 --- a/src/main/java/techreborn/items/tool/DrillItem.java +++ b/src/main/java/techreborn/items/tool/DrillItem.java @@ -93,11 +93,10 @@ public class DrillItem extends PickaxeItem implements EnergyHolder, ItemDurabili return true; } // More checks to fix #2225 - // Pass stack to fix #2348 - if (Items.DIAMOND_SHOVEL.getMiningSpeedMultiplier(new ItemStack(Items.DIAMOND_SHOVEL), blockIn) > 1.0f) { + if (Items.DIAMOND_SHOVEL.getMiningSpeedMultiplier(null, blockIn) > 1.0f) { return true; } - return Items.DIAMOND_PICKAXE.getMiningSpeedMultiplier(new ItemStack(Items.DIAMOND_SHOVEL), blockIn) > 1.0f; + return Items.DIAMOND_PICKAXE.getMiningSpeedMultiplier(null, blockIn) > 1.0f; } // MiningToolItem diff --git a/src/main/java/techreborn/items/tool/JackhammerItem.java b/src/main/java/techreborn/items/tool/JackhammerItem.java index 0d4683f12..876f4cf35 100644 --- a/src/main/java/techreborn/items/tool/JackhammerItem.java +++ b/src/main/java/techreborn/items/tool/JackhammerItem.java @@ -57,7 +57,7 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur protected final float unpoweredSpeed = 0.5F; public JackhammerItem(int energyCapacity, EnergyTier tier, int cost) { - super(ToolMaterials.DIAMOND, (int) ToolMaterials.DIAMOND.getAttackDamage(), 1F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1)); + super(ToolMaterials.DIAMOND, (int) ToolMaterials.DIAMOND.getAttackDamage(), 1F, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1)); this.maxCharge = energyCapacity; this.tier = tier; this.cost = cost; @@ -111,11 +111,6 @@ public class JackhammerItem extends PickaxeItem implements EnergyHolder, ItemDur } // Item - @Override - public boolean isDamageable() { - return false; - } - @Override public boolean isEnchantable(ItemStack stack) { return true; diff --git a/src/main/java/techreborn/items/tool/advanced/RockCutterItem.java b/src/main/java/techreborn/items/tool/advanced/RockCutterItem.java index f34423fa8..c7a1fa748 100644 --- a/src/main/java/techreborn/items/tool/advanced/RockCutterItem.java +++ b/src/main/java/techreborn/items/tool/advanced/RockCutterItem.java @@ -55,7 +55,7 @@ public class RockCutterItem extends PickaxeItem implements EnergyHolder, ItemDur // 400k FE with 1k FE\t charge rate public RockCutterItem() { - super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1)); + super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1)); } // PickaxeItem diff --git a/src/main/java/techreborn/items/tool/industrial/OmniToolItem.java b/src/main/java/techreborn/items/tool/industrial/OmniToolItem.java index 6949f924d..51b0489dd 100644 --- a/src/main/java/techreborn/items/tool/industrial/OmniToolItem.java +++ b/src/main/java/techreborn/items/tool/industrial/OmniToolItem.java @@ -69,7 +69,7 @@ public class OmniToolItem extends PickaxeItem implements EnergyHolder, ItemDurab // 4M FE max charge with 1k charge rate public OmniToolItem() { - super(ToolMaterials.DIAMOND, 3, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1)); + super(ToolMaterials.DIAMOND, 3, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1)); this.miningLevel = MiningLevel.DIAMOND.intLevel; } diff --git a/src/main/java/techreborn/packets/ServerboundPackets.java b/src/main/java/techreborn/packets/ServerboundPackets.java index bc0fcea62..56e763113 100644 --- a/src/main/java/techreborn/packets/ServerboundPackets.java +++ b/src/main/java/techreborn/packets/ServerboundPackets.java @@ -121,12 +121,12 @@ public class ServerboundPackets { return; } server.execute(() -> { - for (int i = 0; i < player.inventory.size(); i++) { - ItemStack stack = player.inventory.getStack(i); + for (int i = 0; i < player.getInventory().size(); i++) { + ItemStack stack = player.getInventory().getStack(i); if (stack.getItem() == TRContent.MANUAL) { - player.inventory.removeStack(i); - player.inventory.insertStack(new ItemStack(Items.BOOK)); - player.inventory.insertStack(TRContent.Ingots.REFINED_IRON.getStack()); + player.getInventory().removeStack(i); + player.getInventory().insertStack(new ItemStack(Items.BOOK)); + player.getInventory().insertStack(TRContent.Ingots.REFINED_IRON.getStack()); return; } } diff --git a/src/main/java/techreborn/utils/TagUtils.java b/src/main/java/techreborn/utils/TagUtils.java index b11fdb005..0bd175676 100644 --- a/src/main/java/techreborn/utils/TagUtils.java +++ b/src/main/java/techreborn/utils/TagUtils.java @@ -29,7 +29,7 @@ import net.minecraft.fluid.Fluid; import net.minecraft.item.Item; import net.minecraft.tag.Tag; import net.minecraft.tag.TagGroup; -import net.minecraft.tag.TagGroupLoader; +import net.minecraft.util.registry.Registry; import net.minecraft.world.World; public class TagUtils { @@ -39,14 +39,14 @@ public class TagUtils { } public static TagGroup getAllBlockTags(World world) { - return world.getTagManager().getBlocks(); + return world.getTagManager().getOrCreateTagGroup(Registry.BLOCK_KEY); } public static TagGroup getAllItemTags(World world) { - return world.getTagManager().getItems(); + return world.getTagManager().getOrCreateTagGroup(Registry.ITEM_KEY); } public static TagGroup getAllFluidTags(World world) { - return world.getTagManager().getFluids(); + return world.getTagManager().getOrCreateTagGroup(Registry.FLUID_KEY); } } diff --git a/src/main/java/techreborn/world/DataDrivenFeature.java b/src/main/java/techreborn/world/DataDrivenFeature.java index 746d9579f..f61f6fc1f 100644 --- a/src/main/java/techreborn/world/DataDrivenFeature.java +++ b/src/main/java/techreborn/world/DataDrivenFeature.java @@ -37,6 +37,7 @@ import net.minecraft.util.JsonHelper; import net.minecraft.util.registry.BuiltinRegistries; import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.gen.GenerationStep; +import net.minecraft.world.gen.YOffset; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.OreFeatureConfig; @@ -65,7 +66,7 @@ public class DataDrivenFeature { this(identifier, biomeSelector, Feature.ORE.configure( new OreFeatureConfig(ruleTest, blockState, veinSize) ) - .rangeOf(maxY) + .uniformRange(YOffset.getBottom(), YOffset.fixed(maxY)) .spreadHorizontally() .repeat(veinCount), GenerationStep.Feature.UNDERGROUND_ORES); } diff --git a/src/main/java/techreborn/world/DefaultWorldGen.java b/src/main/java/techreborn/world/DefaultWorldGen.java index 451159ce0..7d91bfa04 100644 --- a/src/main/java/techreborn/world/DefaultWorldGen.java +++ b/src/main/java/techreborn/world/DefaultWorldGen.java @@ -27,21 +27,24 @@ package techreborn.world; import com.google.gson.JsonElement; import net.fabricmc.fabric.api.biome.v1.BiomeSelectionContext; import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; +import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.structure.rule.BlockStateMatchRuleTest; import net.minecraft.structure.rule.RuleTest; import net.minecraft.util.Identifier; import net.minecraft.util.Pair; +import net.minecraft.util.collection.DataPool; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.util.registry.Registry; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.GenerationStep; -import net.minecraft.world.gen.UniformIntDistribution; import net.minecraft.world.gen.decorator.ChanceDecoratorConfig; import net.minecraft.world.gen.feature.ConfiguredFeature; import net.minecraft.world.gen.feature.OreFeatureConfig; import net.minecraft.world.gen.feature.TreeFeatureConfig; import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize; +import net.minecraft.world.gen.stateprovider.BlockStateProvider; import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider; import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider; import net.minecraft.world.gen.trunk.StraightTrunkPlacer; @@ -66,8 +69,8 @@ public class DefaultWorldGen { private static final RuleTest END_STONE = new BlockStateMatchRuleTest(Blocks.END_STONE.getDefaultState()); private static ConfiguredFeature getRubberTree() { - WeightedBlockStateProvider logProvider = new WeightedBlockStateProvider(); - logProvider.addState(TRContent.RUBBER_LOG.getDefaultState(), 10); + DataPool.Builder logPoolBuilder = DataPool.builder() + .add(TRContent.RUBBER_LOG.getDefaultState(), 10); Arrays.stream(Direction.values()) .filter(direction -> direction.getAxis().isHorizontal()) @@ -75,17 +78,20 @@ public class DefaultWorldGen { .with(BlockRubberLog.HAS_SAP, true) .with(BlockRubberLog.SAP_SIDE, direction) ) - .forEach(state -> logProvider.addState(state, 1)); + .forEach(state -> logPoolBuilder.add(state, 1)); + + BlockStateProvider logProvider = new WeightedBlockStateProvider(logPoolBuilder.build()); + TreeFeatureConfig treeFeatureConfig = new TreeFeatureConfig.Builder( logProvider, - new SimpleBlockStateProvider(TRContent.RUBBER_LEAVES.getDefaultState()), - new RubberTreeFeature.FoliagePlacer(UniformIntDistribution.of(2, 0), UniformIntDistribution.of(0, 0), 3, 3, TRContent.RUBBER_LEAVES.getDefaultState()), new StraightTrunkPlacer(6, 3, 0), + new SimpleBlockStateProvider(TRContent.RUBBER_LEAVES.getDefaultState()), + new SimpleBlockStateProvider(TRContent.RUBBER_SAPLING.getDefaultState()), + new RubberTreeFeature.FoliagePlacer(UniformIntProvider.create(2, 0), UniformIntProvider.create(0, 0), 3, 3, TRContent.RUBBER_LEAVES.getDefaultState()), new TwoLayersFeatureSize(1, 0, 1) ).build(); - return WorldGenerator.RUBBER_TREE_FEATURE.configure(treeFeatureConfig) .decorate(WorldGenerator.RUBBER_TREE_DECORATOR .configure(new ChanceDecoratorConfig(50) @@ -107,7 +113,6 @@ public class DefaultWorldGen { addOre.accept(BiomeSelectors.foundInTheEnd(), END_STONE, TRContent.Ores.TUNGSTEN); addOre.accept(BiomeSelectors.foundInOverworld(), OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.BAUXITE); - addOre.accept(BiomeSelectors.foundInOverworld(), OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.COPPER); addOre.accept(BiomeSelectors.foundInOverworld(), OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.GALENA); addOre.accept(BiomeSelectors.foundInOverworld(), OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.IRIDIUM); addOre.accept(BiomeSelectors.foundInOverworld(), OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, TRContent.Ores.LEAD); diff --git a/src/main/java/techreborn/world/RubberTreeFeature.java b/src/main/java/techreborn/world/RubberTreeFeature.java index 41441a053..7fead8609 100644 --- a/src/main/java/techreborn/world/RubberTreeFeature.java +++ b/src/main/java/techreborn/world/RubberTreeFeature.java @@ -27,17 +27,16 @@ package techreborn.world; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockBox; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ModifiableTestableWorld; -import net.minecraft.world.gen.UniformIntDistribution; +import net.minecraft.util.math.intprovider.IntProvider; +import net.minecraft.world.TestableWorld; import net.minecraft.world.gen.feature.TreeFeature; import net.minecraft.world.gen.feature.TreeFeatureConfig; import net.minecraft.world.gen.foliage.BlobFoliagePlacer; import net.minecraft.world.gen.foliage.FoliagePlacerType; import java.util.Random; -import java.util.Set; +import java.util.function.BiConsumer; /** * @author drcrazy @@ -61,20 +60,20 @@ public class RubberTreeFeature extends TreeFeature { private final int spireHeight; private final BlockState spireBlockState; - public FoliagePlacer(UniformIntDistribution radius, UniformIntDistribution offset, int height, int spireHeight, BlockState spireBlockState) { + public FoliagePlacer(IntProvider radius, IntProvider offset, int height, int spireHeight, BlockState spireBlockState) { super(radius, offset, height); this.spireHeight = spireHeight; this.spireBlockState = spireBlockState; } @Override - protected void generate(ModifiableTestableWorld world, Random random, TreeFeatureConfig config, int trunkHeight, TreeNode treeNode, int foliageHeight, int radius, Set leaves, int i, BlockBox blockBox) { - super.generate(world, random, config, trunkHeight, treeNode, foliageHeight, radius, leaves, i, blockBox); + protected void generate(TestableWorld world, BiConsumer replacer, Random random, TreeFeatureConfig config, int trunkHeight, TreeNode treeNode, int foliageHeight, int radius, int offset) { + super.generate(world, replacer, random, config, trunkHeight, treeNode, foliageHeight, radius, offset); - spawnSpike(world, treeNode.getCenter()); + spawnSpike(world, treeNode.getCenter(), replacer); } - private void spawnSpike(ModifiableTestableWorld world, BlockPos pos) { + private void spawnSpike(TestableWorld world, BlockPos pos, BiConsumer replacer) { final int startScan = pos.getY(); BlockPos topPos = null; @@ -89,7 +88,7 @@ public class RubberTreeFeature extends TreeFeature { if (topPos == null) return; for (int i = 0; i < spireHeight; i++) { - world.setBlockState(pos.up(i), spireBlockState, 19); + replacer.accept(pos.up(i), spireBlockState); } } diff --git a/src/main/java/techreborn/world/WorldGenerator.java b/src/main/java/techreborn/world/WorldGenerator.java index 58a5a837c..77e668b67 100644 --- a/src/main/java/techreborn/world/WorldGenerator.java +++ b/src/main/java/techreborn/world/WorldGenerator.java @@ -69,10 +69,15 @@ public class WorldGenerator { worldGenObseravable.listen(WorldGenerator::applyToActiveRegistry); ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(new WorldGenConfigReloader()); DynamicRegistrySetupCallback.EVENT.register(registryManager -> { - worldGenObseravable.pushA(registryManager.get(BuiltinRegistries.CONFIGURED_FEATURE.getKey())); + worldGenObseravable.pushA(registryManager.getMutable(BuiltinRegistries.CONFIGURED_FEATURE.getKey())); }); BiomeModifications.create(new Identifier("techreborn", "features")).add(ModificationPhase.ADDITIONS, BiomeSelectors.all(), (biomeSelectionContext, biomeModificationContext) -> { + if (!worldGenObseravable.hasBoth()) { + LOGGER.warn("TR world gen not ready for biome modification"); + return; + } + for (DataDrivenFeature feature : worldGenObseravable.getB()) { if (feature.getBiomeSelector().test(biomeSelectionContext)) { biomeModificationContext.getGenerationSettings().addFeature(feature.getGenerationStep(), feature.getRegistryKey()); diff --git a/src/main/resources/assets/techreborn/models/block/cube_ctm_base.json b/src/main/resources/assets/techreborn/models/block/cube_ctm_base.json deleted file mode 100644 index d5a5caeb9..000000000 --- a/src/main/resources/assets/techreborn/models/block/cube_ctm_base.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "elements": [ - { - "from": [ 0, 0, 0 ], - "to": [ 16, 16, 16 ], - "faces": { - "down": { "texture": "#down", "cullface": "down", "tintindex": 0 }, - "up": { "texture": "#up", "cullface": "up", "tintindex": 0 }, - "north": { "texture": "#north", "cullface": "north", "tintindex": 0 }, - "south": { "texture": "#south", "cullface": "south", "tintindex": 0 }, - "west": { "texture": "#west", "cullface": "west", "tintindex": 0 }, - "east": { "texture": "#east", "cullface": "east", "tintindex": 0 } - } - } - ] -} diff --git a/src/main/resources/assets/techreborn/models/block/cube_ctmh_base.json b/src/main/resources/assets/techreborn/models/block/cube_ctmh_base.json deleted file mode 100644 index 6ceef2b71..000000000 --- a/src/main/resources/assets/techreborn/models/block/cube_ctmh_base.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "parent": "minecraft:block/cube_all", - "elements": [ - { - "from": [ 0, 0, 0 ], - "to": [ 16, 16, 16 ], - "faces": { - "down": { "texture": "#down", "cullface": "down" }, - "up": { "texture": "#up", "cullface": "up" }, - "north": { "texture": "#north", "cullface": "north", "tintindex": 0 }, - "south": { "texture": "#south", "cullface": "south", "tintindex": 0 }, - "west": { "texture": "#west", "cullface": "west", "tintindex": 0 }, - "east": { "texture": "#east", "cullface": "east", "tintindex": 0 } - } - } - ] -} diff --git a/src/main/resources/assets/techreborn/models/block/machines/structure/advanced_machine_casing.json b/src/main/resources/assets/techreborn/models/block/machines/structure/advanced_machine_casing.json index fded50593..3006bdfe8 100644 --- a/src/main/resources/assets/techreborn/models/block/machines/structure/advanced_machine_casing.json +++ b/src/main/resources/assets/techreborn/models/block/machines/structure/advanced_machine_casing.json @@ -1,10 +1,6 @@ { - "parent": "techreborn:block/cube_ctmh_base", + "parent": "minecraft:block/cube_all", "textures": { "all": "techreborn:block/machines/structure/tier2_casing" - }, - "ctm_version": 1, - "ctm_overrides": { - "0": "techreborn:block/machines/structure/tier2_casing_ctmh" } } diff --git a/src/main/resources/assets/techreborn/models/block/machines/structure/basic_machine_casing.json b/src/main/resources/assets/techreborn/models/block/machines/structure/basic_machine_casing.json index effec4acc..bfaca083f 100644 --- a/src/main/resources/assets/techreborn/models/block/machines/structure/basic_machine_casing.json +++ b/src/main/resources/assets/techreborn/models/block/machines/structure/basic_machine_casing.json @@ -1,10 +1,6 @@ { - "parent": "techreborn:block/cube_ctmh_base", + "parent": "minecraft:block/cube_all", "textures": { "all": "techreborn:block/machines/structure/tier1_casing" - }, - "ctm_version": 1, - "ctm_overrides": { - "0": "techreborn:block/machines/structure/tier1_casing_ctmh" } } diff --git a/src/main/resources/assets/techreborn/models/block/machines/structure/industrial_machine_casing.json b/src/main/resources/assets/techreborn/models/block/machines/structure/industrial_machine_casing.json index bf92c41db..4f1664f7f 100644 --- a/src/main/resources/assets/techreborn/models/block/machines/structure/industrial_machine_casing.json +++ b/src/main/resources/assets/techreborn/models/block/machines/structure/industrial_machine_casing.json @@ -1,10 +1,6 @@ { - "parent": "techreborn:block/cube_ctmh_base", + "parent": "minecraft:block/cube_all", "textures": { "all": "techreborn:block/machines/structure/tier3_casing" - }, - "ctm_version": 1, - "ctm_overrides": { - "0": "techreborn:block/machines/structure/tier3_casing_ctmh" } } diff --git a/src/main/resources/assets/techreborn/models/block/rubber/rubber_leaves.json b/src/main/resources/assets/techreborn/models/block/rubber/rubber_leaves.json index b6b45605f..8d34b0345 100644 --- a/src/main/resources/assets/techreborn/models/block/rubber/rubber_leaves.json +++ b/src/main/resources/assets/techreborn/models/block/rubber/rubber_leaves.json @@ -1,7 +1,6 @@ { "parent": "minecraft:block/leaves", "textures": { - "all": "techreborn:block/rubber_leaves", - "particle":"techreborn:block/rubber_leaves" + "all": "techreborn:block/rubber_leaves" } } diff --git a/src/main/resources/assets/techreborn/textures/block/machines/energy/ev_multi_ctm.ctx b/src/main/resources/assets/techreborn/textures/block/machines/energy/ev_multi_ctm.ctx new file mode 100644 index 000000000..899ceebdf --- /dev/null +++ b/src/main/resources/assets/techreborn/textures/block/machines/energy/ev_multi_ctm.ctx @@ -0,0 +1,7 @@ +{ + "type":"CTM", + "textures":[ + "./ev_multi_side", + "./ev_multi_side_ctm" + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/textures/block/machines/energy/lapotronic_su_front.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/machines/energy/lapotronic_su_front.png.mcmeta deleted file mode 100644 index 15cec8580..000000000 --- a/src/main/resources/assets/techreborn/textures/block/machines/energy/lapotronic_su_front.png.mcmeta +++ /dev/null @@ -1,16 +0,0 @@ -{ - "ctm":{ - "ctm_version": 1, - "type":"CTM", - "textures":[ - "techreborn:block/machines/energy/lapotronic_su_front_ctm" - ], - "extra":{ - "ignore_states":true, - "connect_to":[ - {"block":"techreborn:lsu_storage"}, - {"block":"techreborn:lapotronic_su"} - ] - } - } -} diff --git a/src/main/resources/assets/techreborn/textures/block/machines/energy/lapotronic_su_side.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/machines/energy/lapotronic_su_side.png.mcmeta index 0d319cd13..e4c81852d 100644 --- a/src/main/resources/assets/techreborn/textures/block/machines/energy/lapotronic_su_side.png.mcmeta +++ b/src/main/resources/assets/techreborn/textures/block/machines/energy/lapotronic_su_side.png.mcmeta @@ -3,14 +3,7 @@ "ctm_version": 1, "type":"CTM", "textures":[ - "techreborn:block/machines/energy/lapotronic_su_side_ctm" - ], - "extra":{ - "ignore_states":true, - "connect_to":[ - {"block":"techreborn:lsu_storage"}, - {"block":"techreborn:lapotronic_su"} - ] - } + "techreborn:blocks/machines/energy/ev_multi_side_ctm" + ] } } diff --git a/src/main/resources/assets/techreborn/textures/block/machines/structure/tier1_casing_ctm.ctx b/src/main/resources/assets/techreborn/textures/block/machines/structure/tier1_casing_ctm.ctx new file mode 100644 index 000000000..2701abf91 --- /dev/null +++ b/src/main/resources/assets/techreborn/textures/block/machines/structure/tier1_casing_ctm.ctx @@ -0,0 +1,7 @@ +{ + "type":"CTMH", + "textures":[ + "./tier1_casing", + "./tier1_casing_ctmh" + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/textures/block/machines/structure/tier1_casing_ctmh.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/machines/structure/tier1_casing_ctmh.png.mcmeta deleted file mode 100644 index ddec0e9b1..000000000 --- a/src/main/resources/assets/techreborn/textures/block/machines/structure/tier1_casing_ctmh.png.mcmeta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ctm": { - "ctm_version": 1, - "type": "ctm_horizontal", - "extra": { - "connect_inside": true - } - } -} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/textures/block/machines/structure/tier2_casing_ctmh.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/machines/structure/tier2_casing_ctmh.png.mcmeta deleted file mode 100644 index ddec0e9b1..000000000 --- a/src/main/resources/assets/techreborn/textures/block/machines/structure/tier2_casing_ctmh.png.mcmeta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ctm": { - "ctm_version": 1, - "type": "ctm_horizontal", - "extra": { - "connect_inside": true - } - } -} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/textures/block/machines/structure/tier3_casing_ctmh.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/machines/structure/tier3_casing_ctmh.png.mcmeta deleted file mode 100644 index ddec0e9b1..000000000 --- a/src/main/resources/assets/techreborn/textures/block/machines/structure/tier3_casing_ctmh.png.mcmeta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ctm": { - "ctm_version": 1, - "type": "ctm_horizontal", - "extra": { - "connect_inside": true - } - } -} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/textures/block/reinforced_glass.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/reinforced_glass.png.mcmeta deleted file mode 100644 index 0427a47bf..000000000 --- a/src/main/resources/assets/techreborn/textures/block/reinforced_glass.png.mcmeta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ctm":{ - "ctm_version": 1, - "type":"CTM", - "textures":[ - "techreborn:block/reinforced_glass_ctm" - ] - } -} diff --git a/src/main/resources/assets/techreborn/textures/block/storage/iridium_reinforced_stone_storage_block.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/storage/iridium_reinforced_stone_storage_block.png.mcmeta deleted file mode 100644 index 7c3c96e2a..000000000 --- a/src/main/resources/assets/techreborn/textures/block/storage/iridium_reinforced_stone_storage_block.png.mcmeta +++ /dev/null @@ -1,12 +0,0 @@ -{ - "ctm":{ - "ctm_version": 1, - "type":"CTM", - "textures":[ - "techreborn:block/storage/iridum_reinforced_stone_storage_block_ctm" - ], - "extra":{ - "ignore_states":true - } - } -} diff --git a/src/main/resources/assets/techreborn/textures/block/storage/iridium_reinforced_tungstensteel_storage_block.png.mcmeta b/src/main/resources/assets/techreborn/textures/block/storage/iridium_reinforced_tungstensteel_storage_block.png.mcmeta deleted file mode 100644 index 29f3a942e..000000000 --- a/src/main/resources/assets/techreborn/textures/block/storage/iridium_reinforced_tungstensteel_storage_block.png.mcmeta +++ /dev/null @@ -1,12 +0,0 @@ -{ - "ctm":{ - "ctm_version": 1, - "type":"CTM", - "textures":[ - "techreborn:block/storage/iridium_reinforced_tungstensteel_storage_block_ctm" - ], - "extra":{ - "ignore_states":true - } - } -} diff --git a/src/main/resources/data/c/tags/blocks/copper_blocks.json b/src/main/resources/data/c/tags/blocks/copper_blocks.json deleted file mode 100644 index 19d864718..000000000 --- a/src/main/resources/data/c/tags/blocks/copper_blocks.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "techreborn:copper_storage_block" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/blocks/copper_ores.json b/src/main/resources/data/c/tags/blocks/copper_ores.json deleted file mode 100644 index 947537264..000000000 --- a/src/main/resources/data/c/tags/blocks/copper_ores.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "techreborn:copper_ore" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/items/copper_blocks.json b/src/main/resources/data/c/tags/items/copper_blocks.json deleted file mode 100644 index 19d864718..000000000 --- a/src/main/resources/data/c/tags/items/copper_blocks.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "techreborn:copper_storage_block" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/items/copper_ingots.json b/src/main/resources/data/c/tags/items/copper_ingots.json deleted file mode 100644 index d294db02d..000000000 --- a/src/main/resources/data/c/tags/items/copper_ingots.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "techreborn:copper_ingot" - ] -} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/items/copper_ores.json b/src/main/resources/data/c/tags/items/copper_ores.json index 947537264..de4fa1438 100644 --- a/src/main/resources/data/c/tags/items/copper_ores.json +++ b/src/main/resources/data/c/tags/items/copper_ores.json @@ -1,6 +1,6 @@ { - "replace": false, - "values": [ - "techreborn:copper_ore" - ] -} \ No newline at end of file + "replace": false, + "values": [ + "minecraft:copper_ore" + ] +} diff --git a/src/main/resources/data/c/tags/items/planks_that_burn.json b/src/main/resources/data/c/tags/items/planks_that_burn.json deleted file mode 100644 index b2abca0a2..000000000 --- a/src/main/resources/data/c/tags/items/planks_that_burn.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "replace": false, - "values": [ - "techreborn:rubber_planks" - ] -} diff --git a/src/main/resources/data/minecraft/tags/blocks/slabs.json b/src/main/resources/data/minecraft/tags/blocks/slabs.json index 5f7d8e348..18e1ad146 100644 --- a/src/main/resources/data/minecraft/tags/blocks/slabs.json +++ b/src/main/resources/data/minecraft/tags/blocks/slabs.json @@ -6,7 +6,6 @@ "techreborn:brass_storage_block_slab", "techreborn:bronze_storage_block_slab", "techreborn:chrome_storage_block_slab", - "techreborn:copper_storage_block_slab", "techreborn:electrum_storage_block_slab", "techreborn:invar_storage_block_slab", "techreborn:iridium_storage_block_slab", @@ -29,4 +28,4 @@ "techreborn:yellow_garnet_storage_block_slab", "techreborn:zinc_storage_block_slab" ] -} \ No newline at end of file +} diff --git a/src/main/resources/data/minecraft/tags/blocks/stairs.json b/src/main/resources/data/minecraft/tags/blocks/stairs.json index 3c1305244..831a6d2cf 100644 --- a/src/main/resources/data/minecraft/tags/blocks/stairs.json +++ b/src/main/resources/data/minecraft/tags/blocks/stairs.json @@ -6,7 +6,6 @@ "techreborn:brass_storage_block_stairs", "techreborn:bronze_storage_block_stairs", "techreborn:chrome_storage_block_stairs", - "techreborn:copper_storage_block_stairs", "techreborn:electrum_storage_block_stairs", "techreborn:invar_storage_block_stairs", "techreborn:iridium_storage_block_stairs", @@ -29,4 +28,4 @@ "techreborn:yellow_garnet_storage_block_stairs", "techreborn:zinc_storage_block_stairs" ] -} \ No newline at end of file +} diff --git a/src/main/resources/data/minecraft/tags/blocks/walls.json b/src/main/resources/data/minecraft/tags/blocks/walls.json index b5ed5f310..99933348d 100644 --- a/src/main/resources/data/minecraft/tags/blocks/walls.json +++ b/src/main/resources/data/minecraft/tags/blocks/walls.json @@ -5,7 +5,6 @@ "techreborn:brass_storage_block_wall", "techreborn:bronze_storage_block_wall", "techreborn:chrome_storage_block_wall", - "techreborn:copper_storage_block_wall", "techreborn:electrum_storage_block_wall", "techreborn:invar_storage_block_wall", "techreborn:iridium_storage_block_wall", @@ -28,4 +27,4 @@ "techreborn:yellow_garnet_storage_block_wall", "techreborn:zinc_storage_block_wall" ] -} \ No newline at end of file +} diff --git a/src/main/resources/data/techreborn/advancements/root.json b/src/main/resources/data/techreborn/advancements/root.json index 0cfd25de3..343572df1 100644 --- a/src/main/resources/data/techreborn/advancements/root.json +++ b/src/main/resources/data/techreborn/advancements/root.json @@ -19,22 +19,12 @@ "conditions": { "items": [ { - "item": "techreborn:copper_ore" + "item": "techreborn:lead_ore" } ] } }, "ore2_in_inventory": { - "trigger": "minecraft:inventory_changed", - "conditions": { - "items": [ - { - "item": "techreborn:lead_ore" - } - ] - } - }, - "ore3_in_inventory": { "trigger": "minecraft:inventory_changed", "conditions": { "items": [ @@ -44,7 +34,7 @@ ] } }, - "ore4_in_inventory": { + "ore3_in_inventory": { "trigger": "minecraft:inventory_changed", "conditions": { "items": [ @@ -56,6 +46,6 @@ } }, "requirements": [ - ["ore_in_inventory", "ore2_in_inventory","ore3_in_inventory", "ore4_in_inventory"] + ["ore_in_inventory", "ore2_in_inventory","ore3_in_inventory"] ] } diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot.json index 12cbba96d..57bd58a4f 100644 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot.json +++ b/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot.json @@ -5,7 +5,7 @@ "ingredients": [ { "count": 3, - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" }, { "tag": "c:zinc_ingots" diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot_from_dust_alt.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot_from_dust_alt.json index f34520340..697e9bfa9 100644 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot_from_dust_alt.json +++ b/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot_from_dust_alt.json @@ -5,7 +5,7 @@ "ingredients": [ { "count": 3, - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" }, { "tag": "c:zinc_dusts" diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot.json index a11bf3c2d..c4a5c5714 100644 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot.json +++ b/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot.json @@ -8,7 +8,7 @@ }, { "count": 3, - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } ], "results": [ diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot_from_dust_alt.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot_from_dust_alt.json index 7dbc8ae67..d8da82c0d 100644 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot_from_dust_alt.json +++ b/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot_from_dust_alt.json @@ -8,7 +8,7 @@ }, { "count": 3, - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } ], "results": [ diff --git a/src/main/resources/data/techreborn/recipes/blast_furnace/refined_iron_ingot_from_iron_ore.json b/src/main/resources/data/techreborn/recipes/blast_furnace/refined_iron_ingot_from_iron_ore.json index 861b7da46..54cec5d42 100644 --- a/src/main/resources/data/techreborn/recipes/blast_furnace/refined_iron_ingot_from_iron_ore.json +++ b/src/main/resources/data/techreborn/recipes/blast_furnace/refined_iron_ingot_from_iron_ore.json @@ -5,7 +5,7 @@ "heat": 1000, "ingredients": [ { - "tag": "c:iron_ores" + "item": "minecraft:iron_ore" }, { "fluid": "techreborn:calcium_carbonate", diff --git a/src/main/resources/data/techreborn/recipes/blast_furnace/steel_ingot_from_refined_iron.json b/src/main/resources/data/techreborn/recipes/blast_furnace/steel_ingot_from_refined_iron.json index 81c679d7e..ac74bbb7c 100644 --- a/src/main/resources/data/techreborn/recipes/blast_furnace/steel_ingot_from_refined_iron.json +++ b/src/main/resources/data/techreborn/recipes/blast_furnace/steel_ingot_from_refined_iron.json @@ -8,7 +8,7 @@ "item": "techreborn:refined_iron_ingot" }, { - "tag": "c:coal_dusts", + "item": "techreborn:coal_dust", "count": 4 } ], diff --git a/src/main/resources/data/techreborn/recipes/centrifuge/lava_cell.json b/src/main/resources/data/techreborn/recipes/centrifuge/lava_cell.json index a3af7d7da..f2d65dfef 100644 --- a/src/main/resources/data/techreborn/recipes/centrifuge/lava_cell.json +++ b/src/main/resources/data/techreborn/recipes/centrifuge/lava_cell.json @@ -15,7 +15,7 @@ "count": 16 }, { - "item": "techreborn:copper_ingot", + "item": "minecraft:copper_ingot", "count": 4 }, { @@ -25,4 +25,4 @@ "item": "techreborn:tungsten_small_dust" } ] -} \ No newline at end of file +} diff --git a/src/main/resources/data/techreborn/recipes/compressor/copper_plate.json b/src/main/resources/data/techreborn/recipes/compressor/copper_plate.json index ef58d0ead..77903af70 100644 --- a/src/main/resources/data/techreborn/recipes/compressor/copper_plate.json +++ b/src/main/resources/data/techreborn/recipes/compressor/copper_plate.json @@ -4,7 +4,7 @@ "time": 300, "ingredients": [ { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } ], "results": [ diff --git a/src/main/resources/data/techreborn/recipes/compressor/copper_plate_from_block.json b/src/main/resources/data/techreborn/recipes/compressor/copper_plate_from_block.json index 022eba66f..aea8c9ad1 100644 --- a/src/main/resources/data/techreborn/recipes/compressor/copper_plate_from_block.json +++ b/src/main/resources/data/techreborn/recipes/compressor/copper_plate_from_block.json @@ -4,13 +4,13 @@ "time": 300, "ingredients": [ { - "tag": "c:copper_blocks" + "item": "minecraft:copper_block" } ], "results": [ { "item": "techreborn:copper_plate", - "count": 9 + "count": 4 } ] -} \ No newline at end of file +} diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/cable/copper_cable.json b/src/main/resources/data/techreborn/recipes/crafting_table/cable/copper_cable.json index af840eda5..d0f280040 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/cable/copper_cable.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/cable/copper_cable.json @@ -5,7 +5,7 @@ ], "key": { "I": { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } }, "result": { diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable.json b/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable.json index 44158389c..e0c448d43 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable.json @@ -7,7 +7,7 @@ ], "key": { "I": { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" }, "R": { "item": "techreborn:rubber" diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable_alt.json b/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable_alt.json index 933afe770..7c3080ccb 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable_alt.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/cable/insulated_copper_cable_alt.json @@ -7,7 +7,7 @@ ], "key": { "I": { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" }, "R": { "item": "techreborn:rubber" diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_ingot.json b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_ingot.json new file mode 100644 index 000000000..f4f60ac7f --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_ingot.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "techreborn:copper_ingot" + } + ], + "result": { + "item": "minecraft:copper_ingot", + "count": 1 + } +} diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_ore.json b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_ore.json new file mode 100644 index 000000000..81301a126 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_ore.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "techreborn:copper_ore" + } + ], + "result": { + "item": "minecraft:copper_ore", + "count": 1 + } +} diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_slab.json b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_slab.json new file mode 100644 index 000000000..b3d016f07 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_slab.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "techreborn:copper_storage_block_slab" + } + ], + "result": { + "item": "minecraft:copper_ingot", + "count": 4 + } +} diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_stair.json b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_stair.json new file mode 100644 index 000000000..9a97ee7a7 --- /dev/null +++ b/src/main/resources/data/techreborn/recipes/crafting_table/conversion/copper_stair.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "techreborn:copper_storage_block_stairs" + } + ], + "result": { + "item": "minecraft:copper_ingot", + "count": 9 + } +} diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/ingot/copper_nugget_from_nugget.json b/src/main/resources/data/techreborn/recipes/crafting_table/ingot/copper_nugget_from_nugget.json index d739f1061..f1056ce80 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/ingot/copper_nugget_from_nugget.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/ingot/copper_nugget_from_nugget.json @@ -11,6 +11,6 @@ } }, "result": { - "item": "techreborn:copper_ingot" + "item": "minecraft:copper_ingot" } -} \ No newline at end of file +} diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/machine/lv_transformer.json b/src/main/resources/data/techreborn/recipes/crafting_table/machine/lv_transformer.json index 15aa292b8..90457bd1a 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/machine/lv_transformer.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/machine/lv_transformer.json @@ -10,7 +10,7 @@ "tag": "minecraft:planks" }, "C": { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" }, "W": { "item": "techreborn:insulated_copper_cable" diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/nugget/copper_nugget.json b/src/main/resources/data/techreborn/recipes/crafting_table/nugget/copper_nugget.json index 8ab9a9ebf..02668390a 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/nugget/copper_nugget.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/nugget/copper_nugget.json @@ -2,7 +2,7 @@ "type": "minecraft:crafting_shapeless", "ingredients": [ { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } ], "result": { diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/parts/helium_coolant_cell_360k.json b/src/main/resources/data/techreborn/recipes/crafting_table/parts/helium_coolant_cell_360k.json index c0d3932ef..c6a1786e5 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/parts/helium_coolant_cell_360k.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/parts/helium_coolant_cell_360k.json @@ -7,7 +7,7 @@ ], "key": { "C": { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" }, "T": { "tag": "c:tin_ingots" diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/parts/nak_coolant_cell_360k.json b/src/main/resources/data/techreborn/recipes/crafting_table/parts/nak_coolant_cell_360k.json index 85ade27cf..1171da0ae 100644 --- a/src/main/resources/data/techreborn/recipes/crafting_table/parts/nak_coolant_cell_360k.json +++ b/src/main/resources/data/techreborn/recipes/crafting_table/parts/nak_coolant_cell_360k.json @@ -7,7 +7,7 @@ ], "key": { "C": { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" }, "T": { "tag": "c:tin_ingots" diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block.json b/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block.json deleted file mode 100644 index 019de381a..000000000 --- a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern": [ - "AAA", - "AAA", - "AAA" - ], - "key": { - "A": { - "tag": "c:copper_ingots" - } - }, - "result": { - "item": "techreborn:copper_storage_block" - } -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_slab.json b/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_slab.json deleted file mode 100644 index f5a50a368..000000000 --- a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_slab.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern": [ - "###" - ], - "key": { - "#": { - "item": "techreborn:copper_storage_block" - } - }, - "result": { - "item": "techreborn:copper_storage_block_slab", - "count": 6 - } -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_slab_stonecutting.json b/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_slab_stonecutting.json deleted file mode 100644 index 9d52b2700..000000000 --- a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_slab_stonecutting.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "minecraft:stonecutting", - "ingredient": { - "item": "techreborn:copper_storage_block" - }, - "result": "techreborn:copper_storage_block_slab", - "count": 2 -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_stair.json b/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_stair.json deleted file mode 100644 index edf50e382..000000000 --- a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_stair.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern": [ - "# ", - "## ", - "###" - ], - "key": { - "#": { - "item": "techreborn:copper_storage_block" - } - }, - "result": { - "item": "techreborn:copper_storage_block_stairs", - "count": 4 - } -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_stair_stonecutting.json b/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_stair_stonecutting.json deleted file mode 100644 index bf1e3faf6..000000000 --- a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_stair_stonecutting.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "minecraft:stonecutting", - "ingredient": { - "item": "techreborn:copper_storage_block" - }, - "result": "techreborn:copper_storage_block_stairs", - "count": 1 -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_wall.json b/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_wall.json deleted file mode 100644 index 0849695a2..000000000 --- a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_wall.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "minecraft:crafting_shaped", - "pattern": [ - "###", - "###" - ], - "key": { - "#": { - "item": "techreborn:copper_storage_block" - } - }, - "result": { - "item": "techreborn:copper_storage_block_wall", - "count": 6 - } -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_wall_stonecutting.json b/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_wall_stonecutting.json deleted file mode 100644 index 45a8691b1..000000000 --- a/src/main/resources/data/techreborn/recipes/crafting_table/storage_block/copper_storage_block_wall_stonecutting.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "minecraft:stonecutting", - "ingredient": { - "item": "techreborn:copper_storage_block" - }, - "result": "techreborn:copper_storage_block_wall", - "count": 1 -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/extractor/clay_ball.json b/src/main/resources/data/techreborn/recipes/extractor/clay_ball.json deleted file mode 100644 index e05b530cf..000000000 --- a/src/main/resources/data/techreborn/recipes/extractor/clay_ball.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "techreborn:extractor", - "power": 10, - "time": 300, - "ingredients": [ - { - "item": "minecraft:clay" - } - ], - "results": [ - { - "item": "minecraft:clay_ball", - "count": 4 - } - ] -} diff --git a/src/main/resources/data/techreborn/recipes/grinder/bonemeal.json b/src/main/resources/data/techreborn/recipes/grinder/bonemeal.json index 28fa964a4..8e979de56 100644 --- a/src/main/resources/data/techreborn/recipes/grinder/bonemeal.json +++ b/src/main/resources/data/techreborn/recipes/grinder/bonemeal.json @@ -4,7 +4,8 @@ "time": 170, "ingredients" : [ { - "item": "minecraft:bone" + "item": "minecraft:bone", + "count": 2 } ], "results" : [ diff --git a/src/main/resources/data/techreborn/recipes/grinder/copper_dust_from_ingot.json b/src/main/resources/data/techreborn/recipes/grinder/copper_dust_from_ingot.json index b22f086ab..edfdc7ce0 100644 --- a/src/main/resources/data/techreborn/recipes/grinder/copper_dust_from_ingot.json +++ b/src/main/resources/data/techreborn/recipes/grinder/copper_dust_from_ingot.json @@ -4,7 +4,7 @@ "time": 200, "ingredients": [ { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } ], "results": [ diff --git a/src/main/resources/data/techreborn/recipes/industrial_grinder/end_stone_bricks_with_water.json b/src/main/resources/data/techreborn/recipes/industrial_grinder/end_stone_bricks_with_water.json index a6d563ec0..643ff17d1 100644 --- a/src/main/resources/data/techreborn/recipes/industrial_grinder/end_stone_bricks_with_water.json +++ b/src/main/resources/data/techreborn/recipes/industrial_grinder/end_stone_bricks_with_water.json @@ -8,7 +8,7 @@ }, "ingredients": [ { - "item": "minecraft:end_stone_bricks" + "item": "minecraft:end_stone" } ], "results": [ diff --git a/src/main/resources/data/techreborn/recipes/rolling_machine/cupronickel_heating_coil.json b/src/main/resources/data/techreborn/recipes/rolling_machine/cupronickel_heating_coil.json index c680abb5e..76a859aab 100644 --- a/src/main/resources/data/techreborn/recipes/rolling_machine/cupronickel_heating_coil.json +++ b/src/main/resources/data/techreborn/recipes/rolling_machine/cupronickel_heating_coil.json @@ -11,7 +11,7 @@ "tag": "c:nickel_ingots" }, "C": { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } }, "result": { diff --git a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head.json b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head.json index 524ca822f..2af4e1f4a 100644 --- a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head.json +++ b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head.json @@ -10,7 +10,7 @@ { "item": "minecraft:player_head", "count": 3, - "nbt": { + "tag": { "SkullOwner": "modmuss50" } } diff --git a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_1.json b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_1.json index 4707a27aa..ccfd13ef0 100644 --- a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_1.json +++ b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_1.json @@ -10,7 +10,7 @@ { "item": "minecraft:player_head", "count": 3, - "nbt": { + "tag": { "SkullOwner": "Gigabit101" } } diff --git a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_2.json b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_2.json index 59df33239..3c2266788 100644 --- a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_2.json +++ b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_2.json @@ -10,8 +10,8 @@ { "item": "minecraft:player_head", "count": 3, - "nbt": { - "SkullOwner": "ProspectorDev" + "tag": { + "SkullOwner": "ProfProspector" } } ], diff --git a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_3.json b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_3.json index f2bc0ea14..3576e535d 100644 --- a/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_3.json +++ b/src/main/resources/data/techreborn/recipes/scrapbox/auto/player_head_3.json @@ -10,7 +10,7 @@ { "item": "minecraft:player_head", "count": 3, - "nbt": { + "tag": { "SkullOwner": "Rushmead" } } diff --git a/src/main/resources/data/techreborn/recipes/smelting/copper_ingot.json b/src/main/resources/data/techreborn/recipes/smelting/copper_ingot.json deleted file mode 100644 index c54ab541e..000000000 --- a/src/main/resources/data/techreborn/recipes/smelting/copper_ingot.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "minecraft:smelting", - "ingredient": { - "tag": "c:copper_ores" - }, - "result": "techreborn:copper_ingot", - "experience": 0.5, - "cookingtime": 200 -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/smelting/copper_ingot_from_dust.json b/src/main/resources/data/techreborn/recipes/smelting/copper_ingot_from_dust.json index e759f54dc..6afbf2a6d 100644 --- a/src/main/resources/data/techreborn/recipes/smelting/copper_ingot_from_dust.json +++ b/src/main/resources/data/techreborn/recipes/smelting/copper_ingot_from_dust.json @@ -3,7 +3,7 @@ "ingredient": { "tag": "c:copper_dusts" }, - "result": "techreborn:copper_ingot", + "result": "minecraft:copper_ingot", "experience": 0.5, "cookingtime": 200 -} \ No newline at end of file +} diff --git a/src/main/resources/data/techreborn/recipes/wire_mill/copper_cable.json b/src/main/resources/data/techreborn/recipes/wire_mill/copper_cable.json index d9a2e0c22..c63bd4e71 100644 --- a/src/main/resources/data/techreborn/recipes/wire_mill/copper_cable.json +++ b/src/main/resources/data/techreborn/recipes/wire_mill/copper_cable.json @@ -4,7 +4,7 @@ "time": 200, "ingredients": [ { - "tag": "c:copper_ingots" + "item": "minecraft:copper_ingot" } ], "results": [ diff --git a/src/main/resources/data/techreborn/techreborn/features/bauxite_ore.json b/src/main/resources/data/techreborn/techreborn/features/bauxite_ore.json index 86fd63f3d..a7dbf6d21 100644 --- a/src/main/resources/data/techreborn/techreborn/features/bauxite_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/bauxite_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:bauxite_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 10 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:bauxite_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":10},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/cinnabar_ore.json b/src/main/resources/data/techreborn/techreborn/features/cinnabar_ore.json index 9513d01f4..e6073db24 100644 --- a/src/main/resources/data/techreborn/techreborn/features/cinnabar_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/cinnabar_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "nether", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_nether", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:cinnabar_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 126 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_nether","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:cinnabar_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":126}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/copper_ore.json b/src/main/resources/data/techreborn/techreborn/features/copper_ore.json deleted file mode 100644 index 6a58d28d6..000000000 --- a/src/main/resources/data/techreborn/techreborn/features/copper_ore.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:copper_ore" - }, - "size": 8 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 16 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/galena_ore.json b/src/main/resources/data/techreborn/techreborn/features/galena_ore.json index 6f0357d3a..b6e0ef963 100644 --- a/src/main/resources/data/techreborn/techreborn/features/galena_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/galena_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:galena_ore" - }, - "size": 8 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 16 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:galena_ore"}}],"size":8,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":16},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/iridium_ore.json b/src/main/resources/data/techreborn/techreborn/features/iridium_ore.json index 3fb0bcee0..6b3116d34 100644 --- a/src/main/resources/data/techreborn/techreborn/features/iridium_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/iridium_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:iridium_ore" - }, - "size": 3 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:iridium_ore"}}],"size":3,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/lead_ore.json b/src/main/resources/data/techreborn/techreborn/features/lead_ore.json index d2517014e..1f0cb308b 100644 --- a/src/main/resources/data/techreborn/techreborn/features/lead_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/lead_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:lead_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 16 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:lead_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":16},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/peridot_ore.json b/src/main/resources/data/techreborn/techreborn/features/peridot_ore.json index b7d57f341..cabc1d173 100644 --- a/src/main/resources/data/techreborn/techreborn/features/peridot_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/peridot_ore.json @@ -1,52 +1 @@ -{ - "biomeSelector": "end", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "block_state": { - "Name": "minecraft:end_stone" - }, - "predicate_type": "minecraft:blockstate_match" - }, - "state": { - "Name": "techreborn:peridot_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 250 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"block_state":{"Name":"minecraft:end_stone"},"predicate_type":"minecraft:blockstate_match"},"state":{"Name":"techreborn:peridot_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":250}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/pyrite_ore.json b/src/main/resources/data/techreborn/techreborn/features/pyrite_ore.json index 0476266fe..4e9cdb51a 100644 --- a/src/main/resources/data/techreborn/techreborn/features/pyrite_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/pyrite_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "nether", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_nether", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:pyrite_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 126 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_nether","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:pyrite_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":126}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/rubber_tree.json b/src/main/resources/data/techreborn/techreborn/features/rubber_tree.json index 6b62a0534..2f9172d48 100644 --- a/src/main/resources/data/techreborn/techreborn/features/rubber_tree.json +++ b/src/main/resources/data/techreborn/techreborn/features/rubber_tree.json @@ -1,129 +1 @@ -{ - "biomeSelector": [ - "forest", - "taiga", - "swamp" - ], - "generationStep": "VEGETAL_DECORATION", - "configuredFeature": { - "config": { - "feature": { - "config": { - "max_water_depth": 0, - "ignore_vines": false, - "heightmap": "OCEAN_FLOOR", - "minimum_size": { - "limit": 1, - "lower_size": 0, - "upper_size": 1, - "type": "minecraft:two_layers_feature_size" - }, - "decorators": [], - "trunk_provider": { - "entries": [ - { - "weight": 10, - "data": { - "Properties": { - "shouldsap": "true", - "hassap": "false", - "facing": "north", - "axis": "y" - }, - "Name": "techreborn:rubber_log" - } - }, - { - "weight": 1, - "data": { - "Properties": { - "shouldsap": "true", - "hassap": "true", - "facing": "north", - "axis": "y" - }, - "Name": "techreborn:rubber_log" - } - }, - { - "weight": 1, - "data": { - "Properties": { - "shouldsap": "true", - "hassap": "true", - "facing": "south", - "axis": "y" - }, - "Name": "techreborn:rubber_log" - } - }, - { - "weight": 1, - "data": { - "Properties": { - "shouldsap": "true", - "hassap": "true", - "facing": "west", - "axis": "y" - }, - "Name": "techreborn:rubber_log" - } - }, - { - "weight": 1, - "data": { - "Properties": { - "shouldsap": "true", - "hassap": "true", - "facing": "east", - "axis": "y" - }, - "Name": "techreborn:rubber_log" - } - } - ], - "type": "minecraft:weighted_state_provider" - }, - "leaves_provider": { - "state": { - "Properties": { - "persistent": "false", - "distance": "7" - }, - "Name": "techreborn:rubber_leaves" - }, - "type": "minecraft:simple_state_provider" - }, - "foliage_placer": { - "height": 3, - "spireHeight": 3, - "spireBlockState": { - "Properties": { - "persistent": "false", - "distance": "7" - }, - "Name": "techreborn:rubber_leaves" - }, - "radius": 2, - "offset": 0, - "type": "techreborn:rubber_tree" - }, - "trunk_placer": { - "base_height": 6, - "height_rand_a": 3, - "height_rand_b": 0, - "type": "minecraft:straight_trunk_placer" - } - }, - "type": "techreborn:rubber_tree" - }, - "decorator": { - "config": { - "chance": 50 - }, - "type": "techreborn:rubber_tree" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"VEGETAL_DECORATION","configuredFeature":{"config":{"feature":{"config":{"decorators":[],"ignore_vines":false,"force_dirt":false,"dirt_provider":{"state":{"Name":"minecraft:dirt"},"type":"minecraft:simple_state_provider"},"minimum_size":{"limit":1,"lower_size":0,"upper_size":1,"type":"minecraft:two_layers_feature_size"},"trunk_provider":{"entries":[{"weight":10,"data":{"Properties":{"shouldsap":"true","hassap":"false","facing":"north","axis":"y"},"Name":"techreborn:rubber_log"}},{"weight":1,"data":{"Properties":{"shouldsap":"true","hassap":"true","facing":"north","axis":"y"},"Name":"techreborn:rubber_log"}},{"weight":1,"data":{"Properties":{"shouldsap":"true","hassap":"true","facing":"south","axis":"y"},"Name":"techreborn:rubber_log"}},{"weight":1,"data":{"Properties":{"shouldsap":"true","hassap":"true","facing":"west","axis":"y"},"Name":"techreborn:rubber_log"}},{"weight":1,"data":{"Properties":{"shouldsap":"true","hassap":"true","facing":"east","axis":"y"},"Name":"techreborn:rubber_log"}}],"type":"minecraft:weighted_state_provider"},"trunk_placer":{"base_height":6,"height_rand_a":3,"height_rand_b":0,"type":"minecraft:straight_trunk_placer"},"foliage_provider":{"state":{"Properties":{"persistent":"false","distance":"7"},"Name":"techreborn:rubber_leaves"},"type":"minecraft:simple_state_provider"},"foliage_placer":{"height":3,"spireHeight":3,"spireBlockState":{"Properties":{"persistent":"false","distance":"7"},"Name":"techreborn:rubber_leaves"},"radius":2,"offset":0,"type":"techreborn:rubber_tree"}},"type":"techreborn:rubber_tree"},"decorator":{"config":{"chance":50},"type":"techreborn:rubber_tree"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/ruby_ore.json b/src/main/resources/data/techreborn/techreborn/features/ruby_ore.json index 48965b696..5e82887b4 100644 --- a/src/main/resources/data/techreborn/techreborn/features/ruby_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/ruby_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:ruby_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:ruby_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/sapphire_ore.json b/src/main/resources/data/techreborn/techreborn/features/sapphire_ore.json index 8efe483bc..2c83869c2 100644 --- a/src/main/resources/data/techreborn/techreborn/features/sapphire_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/sapphire_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:sapphire_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:sapphire_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/sheldonite_ore.json b/src/main/resources/data/techreborn/techreborn/features/sheldonite_ore.json index d8cb523c5..a43f821c9 100644 --- a/src/main/resources/data/techreborn/techreborn/features/sheldonite_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/sheldonite_ore.json @@ -1,52 +1 @@ -{ - "biomeSelector": "end", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "block_state": { - "Name": "minecraft:end_stone" - }, - "predicate_type": "minecraft:blockstate_match" - }, - "state": { - "Name": "techreborn:sheldonite_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 250 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"block_state":{"Name":"minecraft:end_stone"},"predicate_type":"minecraft:blockstate_match"},"state":{"Name":"techreborn:sheldonite_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":250}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/silver_ore.json b/src/main/resources/data/techreborn/techreborn/features/silver_ore.json index 721000b31..c990f9f70 100644 --- a/src/main/resources/data/techreborn/techreborn/features/silver_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/silver_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:silver_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 16 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:silver_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":16},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/sodalite_ore.json b/src/main/resources/data/techreborn/techreborn/features/sodalite_ore.json index 2c063a2d6..d443e6590 100644 --- a/src/main/resources/data/techreborn/techreborn/features/sodalite_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/sodalite_ore.json @@ -1,52 +1 @@ -{ - "biomeSelector": "end", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "block_state": { - "Name": "minecraft:end_stone" - }, - "predicate_type": "minecraft:blockstate_match" - }, - "state": { - "Name": "techreborn:sodalite_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 250 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"block_state":{"Name":"minecraft:end_stone"},"predicate_type":"minecraft:blockstate_match"},"state":{"Name":"techreborn:sodalite_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":250}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/sphalerite_ore.json b/src/main/resources/data/techreborn/techreborn/features/sphalerite_ore.json index 5343f3715..7fcccbde3 100644 --- a/src/main/resources/data/techreborn/techreborn/features/sphalerite_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/sphalerite_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "nether", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_nether", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:sphalerite_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 126 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_nether","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:sphalerite_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":126}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/tin_ore.json b/src/main/resources/data/techreborn/techreborn/features/tin_ore.json index d544c3620..6a91b5435 100644 --- a/src/main/resources/data/techreborn/techreborn/features/tin_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/tin_ore.json @@ -1,50 +1 @@ -{ - "biomeSelector": "overworld", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "tag": "minecraft:base_stone_overworld", - "predicate_type": "minecraft:tag_match" - }, - "state": { - "Name": "techreborn:tin_ore" - }, - "size": 8 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 60 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 16 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"tag":"minecraft:base_stone_overworld","predicate_type":"minecraft:tag_match"},"state":{"Name":"techreborn:tin_ore"}}],"size":8,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":60}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":16},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/techreborn/features/tungsten_ore.json b/src/main/resources/data/techreborn/techreborn/features/tungsten_ore.json index 2d7de2c06..5d376c571 100644 --- a/src/main/resources/data/techreborn/techreborn/features/tungsten_ore.json +++ b/src/main/resources/data/techreborn/techreborn/features/tungsten_ore.json @@ -1,52 +1 @@ -{ - "biomeSelector": "end", - "generationStep": "UNDERGROUND_ORES", - "configuredFeature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "feature": { - "config": { - "target": { - "block_state": { - "Name": "minecraft:end_stone" - }, - "predicate_type": "minecraft:blockstate_match" - }, - "state": { - "Name": "techreborn:tungsten_ore" - }, - "size": 6 - }, - "type": "minecraft:ore" - }, - "decorator": { - "config": { - "bottom_offset": 0, - "top_offset": 0, - "maximum": 250 - }, - "type": "minecraft:range" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": {}, - "type": "minecraft:square" - } - }, - "type": "minecraft:decorated" - }, - "decorator": { - "config": { - "count": 3 - }, - "type": "minecraft:count" - } - }, - "type": "minecraft:decorated" - } -} \ No newline at end of file +{"biomeSelector":"overworld","generationStep":"UNDERGROUND_ORES","configuredFeature":{"config":{"feature":{"config":{"feature":{"config":{"feature":{"config":{"targets":[{"target":{"block_state":{"Name":"minecraft:end_stone"},"predicate_type":"minecraft:blockstate_match"},"state":{"Name":"techreborn:tungsten_ore"}}],"size":6,"discard_chance_on_air_exposure":0.0},"type":"minecraft:ore"},"decorator":{"config":{"bottom_inclusive":{"above_bottom":0},"top_inclusive":{"absolute":250}},"type":"minecraft:range"}},"type":"minecraft:decorated"},"decorator":{"config":{},"type":"minecraft:square"}},"type":"minecraft:decorated"},"decorator":{"config":{"count":3},"type":"minecraft:count"}},"type":"minecraft:decorated"}} \ No newline at end of file