diff --git a/src/main/java/techreborn/blocks/BlockFlare.java b/src/main/java/techreborn/blocks/BlockFlare.java deleted file mode 100644 index 941fe3c8e..000000000 --- a/src/main/java/techreborn/blocks/BlockFlare.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.blocks; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.IBlockReader; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import techreborn.TechReborn; -import techreborn.tiles.TileEntityFlare; -import java.util.List; - -/** - * Created by modmuss50 on 06/11/2016. - */ -public class BlockFlare extends BlockContainer { - - public static final AxisAlignedBB FLARE_BB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.1D, 1.0D); - - public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); - - public BlockFlare() { - super(Material.REDSTONE_LIGHT); - setCreativeTab(TechReborn.TAB); - setTranslationKey("techreborn.flare"); - this.setDefaultState(this.blockState.getBaseState().with(COLOR, EnumDyeColor.WHITE)); - } - - @Override - public TileEntity createNewTileEntity(IBlockReader worldIn) { - if (worldIn.isRemote) { //Only needed on the client - return new TileEntityFlare(); - } - return null; - } - - @Override - public int damageDropped(IBlockState state) { - return (state.getValue(COLOR)).getMetadata(); - } - - @OnlyIn(Dist.CLIENT) - public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) { - for (EnumDyeColor enumdyecolor : EnumDyeColor.values()) { - list.add(new ItemStack(itemIn, 1, enumdyecolor.getMetadata())); - } - } - - @Override - protected BlockStateContainer createBlockState() { - return new BlockStateContainer(this, COLOR); - } - - @Override - @OnlyIn(Dist.CLIENT) - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT; - } - - public boolean isFullCube() { - return false; - } - - @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { - return FLARE_BB; - } - - @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - return FLARE_BB; - } -} diff --git a/src/main/java/techreborn/init/TRTileEntities.java b/src/main/java/techreborn/init/TRTileEntities.java index bf008b2cd..b7fd76de3 100644 --- a/src/main/java/techreborn/init/TRTileEntities.java +++ b/src/main/java/techreborn/init/TRTileEntities.java @@ -4,7 +4,7 @@ * Copyright (c) 2018 TechReborn * * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal + * of this software and associated documentation files (the "Software"); to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is @@ -25,112 +25,97 @@ package techreborn.init; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraft.tileentity.TileEntityType; import reborncore.common.tile.TileMachineBase; -import techreborn.TechReborn; import techreborn.tiles.*; import techreborn.tiles.cable.TileCable; import techreborn.tiles.fusionReactor.TileFusionControlComputer; -import techreborn.tiles.generator.*; +import techreborn.tiles.generator.TileLightningRod; +import techreborn.tiles.generator.TilePlasmaGenerator; +import techreborn.tiles.generator.TileSolarPanel; import techreborn.tiles.generator.advanced.*; import techreborn.tiles.generator.basic.TileSolidFuelGenerator; import techreborn.tiles.generator.basic.TileWaterMill; import techreborn.tiles.generator.basic.TileWindMill; -import techreborn.tiles.storage.idsu.TileInterdimensionalSU; -import techreborn.tiles.storage.lesu.TileLSUStorage; -import techreborn.tiles.storage.lesu.TileLapotronicSU; import techreborn.tiles.lighting.TileLamp; +import techreborn.tiles.machine.iron.TileIronAlloyFurnace; +import techreborn.tiles.machine.iron.TileIronFurnace; import techreborn.tiles.machine.multiblock.*; +import techreborn.tiles.machine.tier1.*; import techreborn.tiles.storage.TileAdjustableSU; import techreborn.tiles.storage.TileHighVoltageSU; import techreborn.tiles.storage.TileLowVoltageSU; import techreborn.tiles.storage.TileMediumVoltageSU; -import techreborn.tiles.machine.iron.TileIronAlloyFurnace; -import techreborn.tiles.machine.iron.TileIronFurnace; -import techreborn.tiles.machine.tier1.*; +import techreborn.tiles.storage.idsu.TileInterdimensionalSU; +import techreborn.tiles.storage.lesu.TileLSUStorage; +import techreborn.tiles.storage.lesu.TileLapotronicSU; import techreborn.tiles.transformers.TileHVTransformer; import techreborn.tiles.transformers.TileLVTransformer; import techreborn.tiles.transformers.TileMVTransformer; -import java.util.Arrays; +public class TRTileEntities { -public enum TRTileEntities { + public static final TileEntityType THERMAL_GEN = register(TileThermalGenerator.class, "thermal_generator"); + public static final TileEntityType QUANTUM_TANK = register(TileQuantumTank.class, "quantum_tank"); + public static final TileEntityType QUANTUM_CHEST = register(TileQuantumChest.class, "quantum_chest"); + public static final TileEntityType DIGITAL_CHEST = register(TileDigitalChest.class, "digital_chest"); + public static final TileEntityType INDUSTRIAL_CENTRIFUGE = register(TileIndustrialCentrifuge.class, "industrial_centrifuge"); + public static final TileEntityType ROLLING_MACHINE = register(TileRollingMachine.class, "rolling_machine"); + public static final TileEntityType INDUSTRIAL_BLAST_FURNACE = register(TileIndustrialBlastFurnace.class, "industrial_blast_furnace"); + public static final TileEntityType ALLOY_SMELTER = register(TileAlloySmelter.class, "alloy_smelter"); + public static final TileEntityType INDUSTRIAL_GRINDER = register(TileIndustrialGrinder.class, "industrial_grinder"); + public static final TileEntityType IMPLOSION_COMPRESSOR = register(TileImplosionCompressor.class, "implosion_compressor"); + public static final TileEntityType MATTER_FABRICATOR = register(TileMatterFabricator.class, "matter_fabricator"); + public static final TileEntityType CHUNK_LOADER = register(TileChunkLoader.class, "chunk_loader"); + public static final TileEntityType CHARGE_O_MAT = register(TileChargeOMat.class, "charge_o_mat"); + public static final TileEntityType PLAYER_DETECTOR = register(TilePlayerDectector.class, "player_detector"); + public static final TileEntityType CABLE = register(TileCable.class, "cable"); + public static final TileEntityType MACHINE_CASINGS = register(TileMachineCasing.class, "machine_casing"); + public static final TileEntityType DRAGON_EGG_SYPHON = register(TileDragonEggSyphon.class, "dragon_egg_syphon"); + public static final TileEntityType ASSEMBLY_MACHINE = register(TileAssemblingMachine.class, "assembly_machine"); + public static final TileEntityType DIESEL_GENERATOR = register(TileDieselGenerator.class, "diesel_generator"); + public static final TileEntityType INDUSTRIAL_ELECTROLYZER = register(TileIndustrialElectrolyzer.class, "industrial_electrolyzer"); + public static final TileEntityType SEMI_FLUID_GENERATOR = register(TileSemiFluidGenerator.class, "semi_fluid_generator"); + public static final TileEntityType GAS_TURBINE = register(TileGasTurbine.class, "gas_turbine"); + public static final TileEntityType IRON_ALLOY_FURNACE = register(TileIronAlloyFurnace.class, "iron_alloy_furnace"); + public static final TileEntityType CHEMICAL_REACTOR = register(TileChemicalReactor.class, "chemical_reactor"); + public static final TileEntityType INTERDIMENSIONAL_SU = register(TileInterdimensionalSU.class, "interdimensional_su"); + public static final TileEntityType ADJUSTABLE_SU = register(TileAdjustableSU.class, "adjustable_su"); + public static final TileEntityType LAPOTRONIC_SU = register(TileLapotronicSU.class, "lapotronic_su"); + public static final TileEntityType LSU_STORAGE = register(TileLSUStorage.class, "lsu_storage"); + public static final TileEntityType DISTILLATION_TOWER = register(TileDistillationTower.class, "distillation_tower"); + public static final TileEntityType VACUUM_FREEZER = register(TileVacuumFreezer.class, "vacuum_freezer"); + public static final TileEntityType FUSION_CONTROL_COMPUTER = register(TileFusionControlComputer.class, "fusion_control_computer"); + public static final TileEntityType LIGHTNING_ROD = register(TileLightningRod.class, "lightning_rod"); + public static final TileEntityType INDUSTRIAL_SAWMILL = register(TileIndustrialSawmill.class, "industrial_sawmill"); + public static final TileEntityType GRINDER = register(TileGrinder.class, "grinder"); + public static final TileEntityType SOLID_FUEL_GENEREATOR = register(TileSolidFuelGenerator.class, "solid_fuel_generator"); + public static final TileEntityType EXTRACTOR = register(TileExtractor.class, "extractor"); + public static final TileEntityType COMPRESSOR = register(TileCompressor.class, "compressor"); + public static final TileEntityType ELECTRIC_FURNACE = register(TileElectricFurnace.class, "electric_furnace"); + public static final TileEntityType SOLAR_PANEL = register(TileSolarPanel.class, "solar_panel"); + public static final TileEntityType CREATIVE_QUANTUM_TANK = register(TileCreativeQuantumTank.class, "creative_quantum_tank"); + public static final TileEntityType CREATIVE_QUANTUM_CHEST = register(TileCreativeQuantumChest.class, "creative_quantum_chest"); + public static final TileEntityType WATER_MILL = register(TileWaterMill.class, "water_mill"); + public static final TileEntityType WIND_MILL = register(TileWindMill.class, "wind_mill"); + public static final TileEntityType MACHINE_BASE = register(TileMachineBase.class, "machine_base"); + public static final TileEntityType RECYCLER = register(TileRecycler.class, "recycler"); + public static final TileEntityType LOW_VOLTAGE_SU = register(TileLowVoltageSU.class, "low_voltage_su"); + public static final TileEntityType MEDIUM_VOLTAGE_SU = register(TileMediumVoltageSU.class, "medium_voltage_su"); + public static final TileEntityType HIGH_VOLTAGE_SU = register(TileHighVoltageSU.class, "high_voltage_su"); + public static final TileEntityType LV_TRANSFORMER = register(TileLVTransformer.class, "lv_transformer"); + public static final TileEntityType MV_TRANSFORMER = register(TileMVTransformer.class, "mv_transformer"); + public static final TileEntityType HV_TRANSFORMER = register(TileHVTransformer.class, "hv_transformer"); + public static final TileEntityType AUTO_CRAFTING_TABLE = register(TileAutoCraftingTable.class, "auto_crafting_table"); + public static final TileEntityType IRON_FURNACE = register(TileIronFurnace.class, "iron_furnace"); + public static final TileEntityType SCRAPBOXINATOR = register(TileScrapboxinator.class, "scrapboxinator"); + public static final TileEntityType PLASMA_GENERATOR = register(TilePlasmaGenerator.class, "plasma_generator"); + public static final TileEntityType LAMP = register(TileLamp.class, "lamp"); + public static final TileEntityType ALARM = register(TileAlarm.class, "alarm"); + public static final TileEntityType FLUID_REPLICATOR = register(TileFluidReplicator.class, "fluid_replicator"); - THERMAL_GEN(TileThermalGenerator.class, "thermal_generator"), - QUANTUM_TANK(TileQuantumTank.class, "quantum_tank"), - QUANTUM_CHEST(TileQuantumChest.class, "quantum_chest"), - DIGITAL_CHEST(TileDigitalChest.class, "digital_chest"), - INDUSTRIAL_CENTRIFUGE(TileIndustrialCentrifuge.class, "industrial_centrifuge"), - ROLLING_MACHINE(TileRollingMachine.class, "rolling_machine"), - INDUSTRIAL_BLAST_FURNACE(TileIndustrialBlastFurnace.class, "industrial_blast_furnace"), - ALLOY_SMELTER(TileAlloySmelter.class, "alloy_smelter"), - INDUSTRIAL_GRINDER(TileIndustrialGrinder.class, "industrial_grinder"), - IMPLOSION_COMPRESSOR(TileImplosionCompressor.class, "implosion_compressor"), - MATTER_FABRICATOR(TileMatterFabricator.class, "matter_fabricator"), - CHUNK_LOADER(TileChunkLoader.class, "chunk_loader"), - CHARGE_O_MAT(TileChargeOMat.class, "charge_o_mat"), - PLAYER_DETECTOR(TilePlayerDectector.class, "player_detector"), - CABLE(TileCable.class, "cable"), - MACHINE_CASINGS(TileMachineCasing.class, "machine_casing"), - DRAGON_EGG_SYPHON(TileDragonEggSyphon.class, "dragon_egg_syphon"), - ASSEMBLY_MACHINE(TileAssemblingMachine.class, "assembly_machine"), - DIESEL_GENERATOR(TileDieselGenerator.class, "diesel_generator"), - INDUSTRIAL_ELECTROLYZER(TileIndustrialElectrolyzer.class, "industrial_electrolyzer"), - SEMI_FLUID_GENERATOR(TileSemiFluidGenerator.class, "semi_fluid_generator"), - GAS_TURBINE(TileGasTurbine.class, "gas_turbine"), - IRON_ALLOY_FURNACE(TileIronAlloyFurnace.class, "iron_alloy_furnace"), - CHEMICAL_REACTOR(TileChemicalReactor.class, "chemical_reactor"), - INTERDIMENSIONAL_SU(TileInterdimensionalSU.class, "interdimensional_su"), - ADJUSTABLE_SU(TileAdjustableSU.class, "adjustable_su"), - LAPOTRONIC_SU(TileLapotronicSU.class, "lapotronic_su"), - LSU_STORAGE(TileLSUStorage.class, "lsu_storage"), - DISTILLATION_TOWER(TileDistillationTower.class, "distillation_tower"), - VACUUM_FREEZER(TileVacuumFreezer.class, "vacuum_freezer"), - FUSION_CONTROL_COMPUTER(TileFusionControlComputer.class, "fusion_control_computer"), - LIGHTNING_ROD(TileLightningRod.class, "lightning_rod"), - INDUSTRIAL_SAWMILL(TileIndustrialSawmill.class, "industrial_sawmill"), - GRINDER(TileGrinder.class, "grinder"), - SOLID_FUEL_GENEREATOR(TileSolidFuelGenerator.class, "solid_fuel_generator"), - EXTRACTOR(TileExtractor.class, "extractor"), - COMPRESSOR(TileCompressor.class, "compressor"), - ELECTRIC_FURNACE(TileElectricFurnace.class, "electric_furnace"), - SOLAR_PANEL(TileSolarPanel.class, "solar_panel"), - CREATIVE_QUANTUM_TANK(TileCreativeQuantumTank.class, "creative_quantum_tank"), - CREATIVE_QUANTUM_CHEST(TileCreativeQuantumChest.class, "creative_quantum_chest"), - WATER_MILL(TileWaterMill.class, "water_mill"), - WIND_MILL(TileWindMill.class, "wind_mill"), - MACHINE_BASE(TileMachineBase.class, "machine_base"), - RECYCLER(TileRecycler.class, "recycler"), - LOW_VOLTAGE_SU(TileLowVoltageSU.class, "low_voltage_su"), - MEDIUM_VOLTAGE_SU(TileMediumVoltageSU.class, "medium_voltage_su"), - HIGH_VOLTAGE_SU(TileHighVoltageSU.class, "high_voltage_su"), - LV_TRANSFORMER(TileLVTransformer.class, "lv_transformer"), - MV_TRANSFORMER(TileMVTransformer.class, "mv_transformer"), - HV_TRANSFORMER(TileHVTransformer.class, "hv_transformer"), - AUTO_CRAFTING_TABLE(TileAutoCraftingTable.class, "auto_crafting_table"), - IRON_FURNACE(TileIronFurnace.class, "iron_furnace"), - SCRAPBOXINATOR(TileScrapboxinator.class, "scrapboxinator"), - PLASMA_GENERATOR(TilePlasmaGenerator.class, "plasma_generator"), - LAMP(TileLamp.class, "lamp"), - ALARM(TileAlarm.class, "alarm"), - FLUID_REPLICATOR(TileFluidReplicator.class, "fluid_replicator"); - - public Class tileClass; - public ResourceLocation name; - - TRTileEntities(Class tileClass, ResourceLocation name) { - this.tileClass = tileClass; - this.name = name; - } - TRTileEntities(Class tileClass, String name) { - this(tileClass, new ResourceLocation(TechReborn.MOD_ID, name)); - } - - - public static void init(){ - Arrays.stream(TRTileEntities.values()) - .forEach(modTileEntities -> GameRegistry.registerTileEntity(modTileEntities.tileClass, modTileEntities.name)); + public static TileEntityType register(Class tClass, String name) { + return null; } } diff --git a/src/main/java/techreborn/tiles/TileAlarm.java b/src/main/java/techreborn/tiles/TileAlarm.java index a12264a1d..60544db9a 100644 --- a/src/main/java/techreborn/tiles/TileAlarm.java +++ b/src/main/java/techreborn/tiles/TileAlarm.java @@ -30,6 +30,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ITickable; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; @@ -41,12 +42,17 @@ import reborncore.common.util.ChatUtils; import techreborn.blocks.BlockAlarm; import techreborn.init.ModSounds; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.utils.MessageIDs; public class TileAlarm extends TileEntity implements ITickable, IToolDrop { private int selectedSound = 1; - + + public TileAlarm() { + super(TRTileEntities.ALARM); + } + public void rightClick() { if (!world.isRemote) { if (selectedSound < 3) { @@ -76,10 +82,11 @@ public class TileAlarm extends TileEntity super.read(compound); } - @Override - public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) { - return false; - } + //TODO 1.13 seems to be gone? +// @Override +// public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate) { +// return false; +// } // ITickable @Override diff --git a/src/main/java/techreborn/tiles/TileChargeOMat.java b/src/main/java/techreborn/tiles/TileChargeOMat.java index 0da965daa..951ebe84d 100644 --- a/src/main/java/techreborn/tiles/TileChargeOMat.java +++ b/src/main/java/techreborn/tiles/TileChargeOMat.java @@ -39,6 +39,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileChargeOMat extends TilePowerAcceptor @@ -54,7 +55,7 @@ public class TileChargeOMat extends TilePowerAcceptor public Inventory inventory = new Inventory<>(6, "TileChargeOMat", 64, this).withConfiguredAccess(); public TileChargeOMat() { - super(); + super(TRTileEntities.CHARGE_O_MAT); } // TilePowerAcceptor diff --git a/src/main/java/techreborn/tiles/TileChunkLoader.java b/src/main/java/techreborn/tiles/TileChunkLoader.java index 4e3e02afa..9b433f00d 100644 --- a/src/main/java/techreborn/tiles/TileChunkLoader.java +++ b/src/main/java/techreborn/tiles/TileChunkLoader.java @@ -38,6 +38,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, ItemHandlerProvider, IContainerProvider { @@ -55,7 +56,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, Ite public int tickTime; public TileChunkLoader() { - super(); + super(TRTileEntities.CHUNK_LOADER ); } @Override diff --git a/src/main/java/techreborn/tiles/TileCreativeQuantumChest.java b/src/main/java/techreborn/tiles/TileCreativeQuantumChest.java index 662c7fcb4..4db352d20 100644 --- a/src/main/java/techreborn/tiles/TileCreativeQuantumChest.java +++ b/src/main/java/techreborn/tiles/TileCreativeQuantumChest.java @@ -25,12 +25,17 @@ package techreborn.tiles; import net.minecraft.item.ItemStack; +import techreborn.init.TRTileEntities; public class TileCreativeQuantumChest extends TileQuantumChest { + public TileCreativeQuantumChest() { + super(TRTileEntities.CREATIVE_QUANTUM_CHEST); + } + @Override - public void update() { - super.update(); + public void tick() { + super.tick(); ItemStack stack = inventory.getStackInSlot(1); if (!stack.isEmpty() && storedItem.isEmpty()) { stack.setCount(stack.getMaxStackSize()); diff --git a/src/main/java/techreborn/tiles/TileCreativeQuantumTank.java b/src/main/java/techreborn/tiles/TileCreativeQuantumTank.java index 25872d401..cfffc81c8 100644 --- a/src/main/java/techreborn/tiles/TileCreativeQuantumTank.java +++ b/src/main/java/techreborn/tiles/TileCreativeQuantumTank.java @@ -24,11 +24,18 @@ package techreborn.tiles; +import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; + public class TileCreativeQuantumTank extends TileQuantumTank { + public TileCreativeQuantumTank() { + super(TRTileEntities.CREATIVE_QUANTUM_TANK); + } + @Override - public void update() { - super.update(); + public void tick() { + super.tick(); if (!tank.isEmpty() && !tank.isFull()) { tank.setFluidAmount(Integer.MAX_VALUE); } diff --git a/src/main/java/techreborn/tiles/TileDigitalChest.java b/src/main/java/techreborn/tiles/TileDigitalChest.java index 479d4c6e3..5a36193de 100644 --- a/src/main/java/techreborn/tiles/TileDigitalChest.java +++ b/src/main/java/techreborn/tiles/TileDigitalChest.java @@ -31,6 +31,7 @@ import techreborn.TechReborn; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileDigitalChest extends TileTechStorageBase implements IContainerProvider { @@ -39,7 +40,7 @@ public class TileDigitalChest extends TileTechStorageBase implements IContainerP public static int maxStorage = 32768; public TileDigitalChest() { - super("TileDigitalChest", maxStorage); + super(TRTileEntities.DIGITAL_CHEST,"TileDigitalChest", maxStorage); } @Override diff --git a/src/main/java/techreborn/tiles/TileEntityFlare.java b/src/main/java/techreborn/tiles/TileEntityFlare.java deleted file mode 100644 index 6eab84beb..000000000 --- a/src/main/java/techreborn/tiles/TileEntityFlare.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.tiles; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.ITickable; -import techreborn.blocks.BlockFlare; -import techreborn.client.particle.ParticleSmoke; - -import java.util.Random; - -/** - * Created by modmuss50 on 06/11/2016. - */ -public class TileEntityFlare extends TileEntity implements ITickable { - - Random random = new Random(); - - @Override - public void update() { - EnumDyeColor color = world.getBlockState(pos).get(BlockFlare.COLOR); - if (world.isRemote && world.isAirBlock(getPos().up())) { - ParticleSmoke particleSmokeLarge = new ParticleSmoke(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 0, 0.0D, 0); - particleSmokeLarge.setMaxAge(250); - if (color != EnumDyeColor.WHITE) { - float[] rgb = EntitySheep.getDyeRgb(color); - particleSmokeLarge.setColor(rgb[0] + (random.nextFloat() / 20), rgb[1] + (random.nextFloat() / 20), rgb[2] + (random.nextFloat() / 20)); - } - particleSmokeLarge.multipleParticleScaleBy(0.5F); - - Minecraft.getInstance().effectRenderer.addEffect(particleSmokeLarge); - - world.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 0.3, pos.getZ() + 0.5, 0.0D, 0.0D, 0.0D); - } - } - -} diff --git a/src/main/java/techreborn/tiles/TileGenericMachine.java b/src/main/java/techreborn/tiles/TileGenericMachine.java index a37116a4b..97e8bcbcb 100644 --- a/src/main/java/techreborn/tiles/TileGenericMachine.java +++ b/src/main/java/techreborn/tiles/TileGenericMachine.java @@ -27,6 +27,7 @@ package techreborn.tiles; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import reborncore.api.IToolDrop; import reborncore.api.recipe.IRecipeCrafterProvider; @@ -57,7 +58,8 @@ public abstract class TileGenericMachine extends TilePowerAcceptor * @param toolDrop Block Block to drop with wrench * @param energySlot int Energy slot to use to charge machine from battery */ - public TileGenericMachine(String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) { + public TileGenericMachine(TileEntityType tileEntityType, String name, int maxInput, int maxEnergy, Block toolDrop, int energySlot) { + super(tileEntityType); this.name = "Tile" + name; this.maxInput = maxInput; this.maxEnergy = maxEnergy; diff --git a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java index 82d83a52b..cd4d3a343 100644 --- a/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java +++ b/src/main/java/techreborn/tiles/TileIndustrialCentrifuge.java @@ -37,6 +37,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.items.DynamicCell; import java.util.List; @@ -50,7 +51,7 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon public static int maxEnergy = 10_000; public TileIndustrialCentrifuge() { - super("IndustrialCentrifuge", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block, 6); + super(TRTileEntities.INDUSTRIAL_CENTRIFUGE, "IndustrialCentrifuge", maxInput, maxEnergy, 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 Inventory<>(7, "TileIndustrialCentrifuge", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/TileMachineCasing.java b/src/main/java/techreborn/tiles/TileMachineCasing.java index 48f40bf73..ff81f06db 100644 --- a/src/main/java/techreborn/tiles/TileMachineCasing.java +++ b/src/main/java/techreborn/tiles/TileMachineCasing.java @@ -24,12 +24,18 @@ package techreborn.tiles; +import net.minecraft.tileentity.TileEntityType; import reborncore.common.multiblock.MultiblockControllerBase; import reborncore.common.multiblock.rectangular.RectangularMultiblockTileEntityBase; +import techreborn.init.TRTileEntities; import techreborn.multiblocks.MultiBlockCasing; public class TileMachineCasing extends RectangularMultiblockTileEntityBase { + public TileMachineCasing() { + super(TRTileEntities.MACHINE_CASINGS); + } + @Override public void onMachineActivated() { diff --git a/src/main/java/techreborn/tiles/TileMatterFabricator.java b/src/main/java/techreborn/tiles/TileMatterFabricator.java index 46eb3dcc5..571f7f5ad 100644 --- a/src/main/java/techreborn/tiles/TileMatterFabricator.java +++ b/src/main/java/techreborn/tiles/TileMatterFabricator.java @@ -39,6 +39,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileMatterFabricator extends TilePowerAcceptor @@ -57,7 +58,7 @@ public class TileMatterFabricator extends TilePowerAcceptor private int amplifier = 0; public TileMatterFabricator() { - super(); + super(TRTileEntities.MATTER_FABRICATOR ); } private boolean spaceForOutput() { diff --git a/src/main/java/techreborn/tiles/TilePump.java b/src/main/java/techreborn/tiles/TilePump.java deleted file mode 100644 index e587240b4..000000000 --- a/src/main/java/techreborn/tiles/TilePump.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.tiles; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockLiquid; -import net.minecraft.block.state.IBlockState; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidBlock; -import reborncore.common.powerSystem.PowerSystem; -import reborncore.common.powerSystem.TilePowerAcceptor; -import reborncore.common.registration.RebornRegister; -import reborncore.common.registration.config.ConfigRegistry; -import reborncore.common.util.Tank; -import techreborn.TechReborn; - -import javax.annotation.Nullable; -import java.util.List; - -/** - * Created by modmuss50 on 08/05/2016. - */ -@RebornRegister(TechReborn.MOD_ID) -public class TilePump extends TilePowerAcceptor { - - @ConfigRegistry(config = "machines", category = "pump", key = "PumpEUCost", comment = "Pump cost for one block of fluid (Value in EU)") - public static int pumpExtractEU = 20; - - public Tank tank = new Tank("TilePump", 10000, this); - - public TilePump() { - super(); - } - - @Override - public void tick() { - super.tick(); - if (!world.isRemote && world.getGameTime() % 10 == 0 && !tank.isFull() && tank.getCapacity() - tank.getFluidAmount() >= 1000 && canUseEnergy(pumpExtractEU)) { - FluidStack fluidStack = drainBlock(world, pos.down(), false); - if (fluidStack != null) { - tank.fill(drainBlock(world, pos.down(), true), true); - useEnergy(pumpExtractEU); - } - tank.compareAndUpdate(); - } - } - - @Override - public void addInfo(List info, boolean isRealTile, boolean hasData) { - super.addInfo(info, isRealTile, hasData); - info.add(TextFormatting.LIGHT_PURPLE + "Eu per extract " + TextFormatting.GREEN - + PowerSystem.getLocaliszedPower(pumpExtractEU)); - info.add(TextFormatting.LIGHT_PURPLE + "Speed: " + TextFormatting.GREEN - + "1000mb/5 sec"); - } - - public static FluidStack drainBlock(World world, BlockPos pos, boolean doDrain) { - IBlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - Fluid fluid = FluidRegistry.lookupFluidForBlock(block); - - if (fluid != null && FluidRegistry.isFluidRegistered(fluid)) { - if (block instanceof IFluidBlock) { - IFluidBlock fluidBlock = (IFluidBlock) block; - if (!fluidBlock.canDrain(world, pos)) { - return null; - } - return fluidBlock.drain(world, pos, doDrain); - } else { - //Checks if source - int level = state.getValue(BlockLiquid.LEVEL); - if (level != 0) { - return null; - } - if (doDrain) { - world.removeBlock(pos); - } - return new FluidStack(fluid, 1000); - } - } else { - return null; - } - } - - @Override - public double getBaseMaxPower() { - return 10000; - } - - @Override - public boolean canAcceptEnergy(EnumFacing direction) { - return true; - } - - @Override - public boolean canProvideEnergy(EnumFacing direction) { - return false; - } - - @Override - public double getBaseMaxOutput() { - return 0; - } - - @Override - public double getBaseMaxInput() { - return 32; - } - - @Override - public void read(NBTTagCompound tagCompound) { - super.read(tagCompound); - readWithoutCoords(tagCompound); - } - - @Override - public void readWithoutCoords(NBTTagCompound tagCompound) { - tank.read(tagCompound); - } - - @Override - public NBTTagCompound write(NBTTagCompound tagCompound) { - super.write(tagCompound); - writeWithoutCoords(tagCompound); - return tagCompound; - } - - @Override - public NBTTagCompound writeWithoutCoords(NBTTagCompound tagCompound) { - tank.write(tagCompound); - return tagCompound; - } - - @Nullable - @Override - public Tank getTank() { - return tank; - } -} diff --git a/src/main/java/techreborn/tiles/TileQuantumChest.java b/src/main/java/techreborn/tiles/TileQuantumChest.java index 06f726e61..03de8d142 100644 --- a/src/main/java/techreborn/tiles/TileQuantumChest.java +++ b/src/main/java/techreborn/tiles/TileQuantumChest.java @@ -25,12 +25,18 @@ package techreborn.tiles; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntityType; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; + +import javax.annotation.Nonnull; @RebornRegister(TechReborn.MOD_ID) public class TileQuantumChest extends TileTechStorageBase implements IContainerProvider { @@ -39,7 +45,11 @@ public class TileQuantumChest extends TileTechStorageBase implements IContainerP public static int maxStorage = Integer.MAX_VALUE; public TileQuantumChest() { - super("TileQuantumChest", maxStorage); + this(TRTileEntities.QUANTUM_CHEST); + } + + public TileQuantumChest(TileEntityType tileEntityType) { + super(tileEntityType, "TileQuantumChest", maxStorage); } @Override @@ -47,4 +57,5 @@ public class TileQuantumChest extends TileTechStorageBase implements IContainerP return new ContainerBuilder("quantumchest").player(player.inventory).inventory().hotbar().addInventory() .tile(this).slot(0, 80, 24).outputSlot(1, 80, 64).addInventory().create(this); } + } diff --git a/src/main/java/techreborn/tiles/TileQuantumTank.java b/src/main/java/techreborn/tiles/TileQuantumTank.java index 9b9003dec..3b55a14e3 100644 --- a/src/main/java/techreborn/tiles/TileQuantumTank.java +++ b/src/main/java/techreborn/tiles/TileQuantumTank.java @@ -29,6 +29,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntityType; import reborncore.api.IListInfoProvider; import reborncore.api.IToolDrop; import reborncore.api.tile.ItemHandlerProvider; @@ -43,6 +44,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import javax.annotation.Nullable; import java.util.List; @@ -57,6 +59,14 @@ public class TileQuantumTank extends TileMachineBase public Tank tank = new Tank("TileQuantumTank", maxStorage, this); public Inventory inventory = new Inventory<>(3, "TileQuantumTank", 64, this).withConfiguredAccess(); + public TileQuantumTank(){ + this(TRTileEntities.QUANTUM_TANK); + } + + public TileQuantumTank(TileEntityType tileEntityTypeIn) { + super(tileEntityTypeIn); + } + public void readWithoutCoords(final NBTTagCompound tagCompound) { tank.read(tagCompound); } diff --git a/src/main/java/techreborn/tiles/TileTechStorageBase.java b/src/main/java/techreborn/tiles/TileTechStorageBase.java index e7da9a820..541167f1e 100644 --- a/src/main/java/techreborn/tiles/TileTechStorageBase.java +++ b/src/main/java/techreborn/tiles/TileTechStorageBase.java @@ -29,8 +29,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.common.util.NonNullSupplier; import net.minecraftforge.items.CapabilityItemHandler; import reborncore.api.IListInfoProvider; import reborncore.api.IToolDrop; @@ -39,6 +42,7 @@ import reborncore.common.tile.TileMachineBase; import reborncore.common.util.Inventory; import reborncore.common.util.ItemUtils; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; @@ -50,7 +54,8 @@ public class TileTechStorageBase extends TileMachineBase public final Inventory inventory; public ItemStack storedItem; - public TileTechStorageBase(String name, int maxCapacity) { + public TileTechStorageBase(TileEntityType tileEntityTypeIn, String name, int maxCapacity) { + super(tileEntityTypeIn); this.maxCapacity = maxCapacity; storedItem = ItemStack.EMPTY; inventory = new Inventory<>(3, name, maxCapacity, this).withConfiguredAccess(); @@ -61,7 +66,7 @@ public class TileTechStorageBase extends TileMachineBase storedItem = ItemStack.EMPTY; if (tagCompound.hasKey("storedStack")) { - storedItem = new ItemStack((NBTTagCompound) tagCompound.getTag("storedStack")); + storedItem = ItemStack.read(tagCompound.getCompound("storedStack")); } if (!storedItem.isEmpty()) { @@ -213,17 +218,20 @@ public class TileTechStorageBase extends TileMachineBase return tagCompound; } + @Nonnull @Override - public T getCapability(Capability capability, EnumFacing facing) { - if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { - return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(inventory); - } - return super.getCapability(capability, facing); - } + public LazyOptional getCapability(@Nonnull Capability cap) { + if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { - @Override - public boolean hasCapability(Capability capability, @Nullable EnumFacing facing) { - return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); + return LazyOptional.of(new NonNullSupplier() { + @Nonnull + @Override + public T get() { + return (T) inventory; + } + }); + } + return super.getCapability(cap); } // ItemHandlerProvider @@ -245,11 +253,11 @@ public class TileTechStorageBase extends TileMachineBase int size = 0; String name = "of nothing"; if (!storedItem.isEmpty()) { - name = storedItem.getDisplayName(); + name = storedItem.getDisplayName().getString(); size += storedItem.getCount(); } if (!inventory.getStackInSlot(1).isEmpty()) { - name = inventory.getStackInSlot(1).getDisplayName(); + name = inventory.getStackInSlot(1).getDisplayName().getString(); size += inventory.getStackInSlot(1).getCount(); } info.add(size + " " + name); diff --git a/src/main/java/techreborn/tiles/cable/TileCable.java b/src/main/java/techreborn/tiles/cable/TileCable.java index dce6ee2c0..0a9dfd003 100644 --- a/src/main/java/techreborn/tiles/cable/TileCable.java +++ b/src/main/java/techreborn/tiles/cable/TileCable.java @@ -31,6 +31,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.text.TextFormatting; @@ -44,6 +45,7 @@ import reborncore.common.powerSystem.PowerSystem; import reborncore.common.util.StringUtils; import techreborn.blocks.cable.BlockCable; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import java.util.ArrayList; import java.util.List; @@ -60,7 +62,11 @@ public class TileCable extends TileEntity private TRContent.Cables cableType = null; private ArrayList sendingFace = new ArrayList(); int ticksSinceLastChange = 0; - + + public TileCable() { + super(TRTileEntities.CABLE); + } + private TRContent.Cables getCableType() { Block block = world.getBlockState(pos).getBlock(); if(block instanceof BlockCable){ @@ -132,7 +138,7 @@ public class TileCable extends TileEntity // ITickable @Override - public void update() { + public void tick() { if (world.isRemote) { return; } diff --git a/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java b/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java index 8033a7a58..27c8844d4 100644 --- a/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java +++ b/src/main/java/techreborn/tiles/fusionReactor/TileFusionControlComputer.java @@ -45,6 +45,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import java.util.List; @@ -76,7 +77,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor boolean hasStartedCrafting = false; public TileFusionControlComputer() { - super(); + super(TRTileEntities.FUSION_CONTROL_COMPUTER); checkOverfill = false; this.inventory = new Inventory<>(3, "TileFusionControlComputer", 64, this).withConfiguredAccess(); } diff --git a/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java b/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java index 2921d810e..3c5f7644b 100644 --- a/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java +++ b/src/main/java/techreborn/tiles/generator/TileBaseFluidGenerator.java @@ -25,6 +25,7 @@ package techreborn.tiles.generator; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidStack; import reborncore.api.IToolDrop; @@ -58,8 +59,8 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement */ double pendingWithdraw = 0.0; - public TileBaseFluidGenerator(EFluidGenerator type, String tileName, int tankCapacity, int euTick) { - super(); + public TileBaseFluidGenerator(TileEntityType tileEntityType, EFluidGenerator type, String tileName, int tankCapacity, int euTick) { + super(tileEntityType); recipes = GeneratorRecipeHelper.getFluidRecipesForGenerator(type); tank = new Tank(tileName, tankCapacity, this); inventory = new Inventory<>(3, tileName, 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/generator/TileLightningRod.java b/src/main/java/techreborn/tiles/generator/TileLightningRod.java index 04e485dad..8b6090df4 100644 --- a/src/main/java/techreborn/tiles/generator/TileLightningRod.java +++ b/src/main/java/techreborn/tiles/generator/TileLightningRod.java @@ -38,6 +38,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileLightningRod extends TilePowerAcceptor implements IToolDrop { @@ -54,7 +55,7 @@ public class TileLightningRod extends TilePowerAcceptor implements IToolDrop { private int onStatusHoldTicks = -1; public TileLightningRod() { - super(); + super(TRTileEntities.LIGHTNING_ROD); } @Override diff --git a/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java b/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java index bec5b9323..5a686d11e 100644 --- a/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java +++ b/src/main/java/techreborn/tiles/generator/TilePlasmaGenerator.java @@ -34,6 +34,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TilePlasmaGenerator extends TileBaseFluidGenerator implements IContainerProvider { @@ -48,7 +49,7 @@ public class TilePlasmaGenerator extends TileBaseFluidGenerator implements ICont public static int energyPerTick = 400; public TilePlasmaGenerator() { - super(EFluidGenerator.PLASMA, "TilePlasmaGenerator", tankCapacity, energyPerTick); + super(TRTileEntities.PLASMA_GENERATOR, EFluidGenerator.PLASMA, "TilePlasmaGenerator", tankCapacity, energyPerTick); } @Override diff --git a/src/main/java/techreborn/tiles/generator/TileSolarPanel.java b/src/main/java/techreborn/tiles/generator/TileSolarPanel.java index c6a12a0e6..7e6f70301 100644 --- a/src/main/java/techreborn/tiles/generator/TileSolarPanel.java +++ b/src/main/java/techreborn/tiles/generator/TileSolarPanel.java @@ -28,6 +28,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; import reborncore.api.IToolDrop; @@ -38,6 +39,7 @@ import reborncore.common.util.StringUtils; import techreborn.blocks.generator.BlockSolarPanel; import techreborn.init.TRContent; import techreborn.init.TRContent.SolarPanels; +import techreborn.init.TRTileEntities; import java.util.List; @@ -47,6 +49,10 @@ public class TileSolarPanel extends TilePowerAcceptor implements IToolDrop { boolean lastState = false; SolarPanels panel; + public TileSolarPanel() { + super(TRTileEntities.SOLAR_PANEL); + } + public boolean isSunOut() { return canSeeSky && !world.isRaining() && !world.isThundering() && world.isDaytime(); } diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java b/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java index 538e805e7..f2ebceed8 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileDieselGenerator.java @@ -31,6 +31,7 @@ import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.generator.TileBaseFluidGenerator; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; @@ -49,7 +50,7 @@ public class TileDieselGenerator extends TileBaseFluidGenerator implements ICont public static int energyPerTick = 20; public TileDieselGenerator() { - super(EFluidGenerator.DIESEL, "TileDieselGenerator", tankCapacity, energyPerTick); + super(TRTileEntities.DIESEL_GENERATOR, EFluidGenerator.DIESEL, "TileDieselGenerator", tankCapacity, energyPerTick); } @Override diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileDragonEggSyphon.java b/src/main/java/techreborn/tiles/generator/advanced/TileDragonEggSyphon.java index 9783e8834..11990469b 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileDragonEggSyphon.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileDragonEggSyphon.java @@ -38,6 +38,7 @@ import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.Inventory; import techreborn.TechReborn; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileDragonEggSyphon extends TilePowerAcceptor @@ -54,7 +55,7 @@ public class TileDragonEggSyphon extends TilePowerAcceptor private long lastOutput = 0; public TileDragonEggSyphon() { - super(); + super(TRTileEntities.DRAGON_EGG_SYPHON); } private boolean tryAddingEnergy(int amount) { diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java b/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java index 4a5a98f34..33815bdf5 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileGasTurbine.java @@ -31,6 +31,7 @@ import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.generator.TileBaseFluidGenerator; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; @@ -49,7 +50,7 @@ public class TileGasTurbine extends TileBaseFluidGenerator implements IContainer public static int energyPerTick = 16; public TileGasTurbine() { - super(EFluidGenerator.GAS, "TileGasTurbine", tankCapacity, energyPerTick); + super(TRTileEntities.GAS_TURBINE, EFluidGenerator.GAS, "TileGasTurbine", tankCapacity, energyPerTick); } @Override diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java b/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java index 4d10c9bd5..ed829772f 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileSemiFluidGenerator.java @@ -31,6 +31,7 @@ import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.generator.TileBaseFluidGenerator; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; @@ -49,7 +50,7 @@ public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IC public static int energyPerTick = 8; public TileSemiFluidGenerator() { - super(EFluidGenerator.SEMIFLUID, "TileSemiFluidGenerator", tankCapacity, energyPerTick); + super(TRTileEntities.SEMI_FLUID_GENERATOR, EFluidGenerator.SEMIFLUID, "TileSemiFluidGenerator", tankCapacity, energyPerTick); } @Override diff --git a/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java b/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java index 92d700418..04b83716d 100644 --- a/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java +++ b/src/main/java/techreborn/tiles/generator/advanced/TileThermalGenerator.java @@ -31,6 +31,7 @@ import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.api.generator.EFluidGenerator; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.generator.TileBaseFluidGenerator; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; @@ -49,7 +50,7 @@ public class TileThermalGenerator extends TileBaseFluidGenerator implements ICon public static int energyPerTick = 10; public TileThermalGenerator() { - super(EFluidGenerator.THERMAL, "TileThermalGenerator", tankCapacity, energyPerTick); + super(TRTileEntities.THERMAL_GEN, EFluidGenerator.THERMAL, "TileThermalGenerator", tankCapacity, energyPerTick); } @Override diff --git a/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java b/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java index e3252a2b5..8744ad332 100644 --- a/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java +++ b/src/main/java/techreborn/tiles/generator/basic/TileSolidFuelGenerator.java @@ -43,6 +43,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDrop, ItemHandlerProvider, IContainerProvider { @@ -65,7 +66,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr ItemStack burnItem; public TileSolidFuelGenerator() { - super(); + super(TRTileEntities.SOLID_FUEL_GENEREATOR); } public static int getItemBurnTime(ItemStack stack) { diff --git a/src/main/java/techreborn/tiles/generator/basic/TileWaterMill.java b/src/main/java/techreborn/tiles/generator/basic/TileWaterMill.java index 5420c9360..a5f45402f 100644 --- a/src/main/java/techreborn/tiles/generator/basic/TileWaterMill.java +++ b/src/main/java/techreborn/tiles/generator/basic/TileWaterMill.java @@ -35,6 +35,7 @@ import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.blocks.generator.BlockWindMill; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 25/02/2016. @@ -53,7 +54,7 @@ public class TileWaterMill extends TilePowerAcceptor implements IToolDrop { int waterblocks = 0; public TileWaterMill() { - super(); + super(TRTileEntities.WATER_MILL); } @Override diff --git a/src/main/java/techreborn/tiles/generator/basic/TileWindMill.java b/src/main/java/techreborn/tiles/generator/basic/TileWindMill.java index f48ac7b9e..dbe25cad5 100644 --- a/src/main/java/techreborn/tiles/generator/basic/TileWindMill.java +++ b/src/main/java/techreborn/tiles/generator/basic/TileWindMill.java @@ -33,6 +33,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 25/02/2016. @@ -51,7 +52,7 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop { public static double thunderMultiplier = 1.25; public TileWindMill() { - super(); + super(TRTileEntities.WIND_MILL); } @Override diff --git a/src/main/java/techreborn/tiles/lighting/TileLamp.java b/src/main/java/techreborn/tiles/lighting/TileLamp.java index 0e43608e1..2babb0cd9 100644 --- a/src/main/java/techreborn/tiles/lighting/TileLamp.java +++ b/src/main/java/techreborn/tiles/lighting/TileLamp.java @@ -28,16 +28,22 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import reborncore.api.IToolDrop; import reborncore.common.powerSystem.TilePowerAcceptor; import techreborn.blocks.lighting.BlockLamp; +import techreborn.init.TRTileEntities; public class TileLamp extends TilePowerAcceptor implements IToolDrop { private static int capacity = 33; + public TileLamp() { + super(TRTileEntities.LAMP); + } + // TilePowerAcceptor @Override public void tick() { diff --git a/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java b/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java index 8aadd362c..2a7eec632 100644 --- a/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java +++ b/src/main/java/techreborn/tiles/machine/iron/TileIronAlloyFurnace.java @@ -47,6 +47,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileIronAlloyFurnace extends TileMachineBase @@ -63,7 +64,7 @@ public class TileIronAlloyFurnace extends TileMachineBase int fuel = 3; public TileIronAlloyFurnace() { - + super(TRTileEntities.IRON_ALLOY_FURNACE); } /** diff --git a/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java b/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java index f04d265ae..364573554 100644 --- a/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java +++ b/src/main/java/techreborn/tiles/machine/iron/TileIronFurnace.java @@ -29,6 +29,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.tileentity.TileEntityType; import reborncore.api.tile.ItemHandlerProvider; import reborncore.common.blocks.BlockMachineBase; import reborncore.common.tile.TileMachineBase; @@ -38,6 +39,7 @@ import reborncore.common.util.ItemUtils; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; public class TileIronFurnace extends TileMachineBase implements ItemHandlerProvider, IContainerProvider { @@ -53,6 +55,10 @@ public class TileIronFurnace extends TileMachineBase int fuelslot = 2; boolean active = false; + public TileIronFurnace() { + super(TRTileEntities.IRON_FURNACE); + } + public int gaugeProgressScaled(final int scale) { return this.progress * scale / this.fuelScale; } diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java b/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java index 3a8ab481a..f6728077c 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileDistillationTower.java @@ -37,6 +37,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -50,7 +51,7 @@ public class TileDistillationTower extends TileGenericMachine implements IContai public MultiblockChecker multiblockChecker; public TileDistillationTower() { - super("DistillationTower", maxInput, maxEnergy, TRContent.Machine.DISTILLATION_TOWER.block, 6); + super(TRTileEntities.DISTILLATION_TOWER,"DistillationTower", maxInput, maxEnergy, 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 Inventory<>(7, "TileDistillationTower", 64, this).withConfiguredAccess(); @@ -74,14 +75,14 @@ public class TileDistillationTower extends TileGenericMachine implements IContai // TileGenericMachine @Override - public void update() { + public void tick() { if (multiblockChecker == null) { final BlockPos downCenter = pos.offset(getFacing().getOpposite(), 2); multiblockChecker = new MultiblockChecker(world, downCenter); } if (!world.isRemote && getMutliBlock()){ - super.update(); + super.tick(); } } diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java b/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java index 8aacc8e7f..04fe03a6c 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileFluidReplicator.java @@ -40,6 +40,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @@ -63,7 +64,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine int ticksSinceLastChange; public TileFluidReplicator() { - super("FluidReplicator", maxInput, maxEnergy, TRContent.Machine.FLUID_REPLICATOR.block, 3); + super(TRTileEntities.FLUID_REPLICATOR, "FluidReplicator", maxInput, maxEnergy, TRContent.Machine.FLUID_REPLICATOR.block, 3); final int[] inputs = new int[] { 0 }; this.inventory = new Inventory<>(4, "TileFluidReplicator", 64, this, getInventoryAccess()); this.crafter = new FluidReplicatorRecipeCrafter(this, this.inventory, inputs, null); diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java b/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java index b9ff815c5..ce319b615 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileImplosionCompressor.java @@ -36,6 +36,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -49,7 +50,7 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont public MultiblockChecker multiblockChecker; public TileImplosionCompressor() { - super("ImplosionCompressor", maxInput, maxEnergy, TRContent.Machine.IMPLOSION_COMPRESSOR.block, 4); + super(TRTileEntities.IMPLOSION_COMPRESSOR, "ImplosionCompressor", maxInput, maxEnergy, TRContent.Machine.IMPLOSION_COMPRESSOR.block, 4); final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3 }; this.inventory = new Inventory<>(5, "TileImplosionCompressor", 64, this); diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java index c9f6bbe46..f10af9ae7 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialBlastFurnace.java @@ -45,6 +45,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.multiblocks.MultiBlockCasing; import techreborn.tiles.TileGenericMachine; import techreborn.tiles.TileMachineCasing; @@ -61,7 +62,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC private int cachedHeat; public TileIndustrialBlastFurnace() { - super("IndustrialBlastFurnace", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_BLAST_FURNACE.block, 4); + super(TRTileEntities.INDUSTRIAL_BLAST_FURNACE, "IndustrialBlastFurnace", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_BLAST_FURNACE.block, 4); final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3 }; this.inventory = new Inventory<>(5, "TileIndustrialBlastFurnace", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java index 685e26aea..a26265960 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialGrinder.java @@ -49,6 +49,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @@ -67,7 +68,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai int ticksSinceLastChange; public TileIndustrialGrinder() { - super("IndustrialGrinder", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_GRINDER.block, 7); + super(TRTileEntities.INDUSTRIAL_GRINDER, "IndustrialGrinder", maxInput, maxEnergy, 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 Inventory<>(8, "TileIndustrialGrinder", 64, this, getInventoryAccess()); diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java index 3794535df..178b4dcae 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileIndustrialSawmill.java @@ -49,6 +49,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; import javax.annotation.Nullable; @@ -66,7 +67,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai int ticksSinceLastChange; public TileIndustrialSawmill() { - super("IndustrialSawmill", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_SAWMILL.block, 6); + super(TRTileEntities.INDUSTRIAL_SAWMILL, "IndustrialSawmill", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_SAWMILL.block, 6); final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2, 3, 4 }; this.inventory = new Inventory<>(7, "TileSawmill", 64, this, getInventoryAccess()); diff --git a/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java b/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java index e68a27906..664765307 100644 --- a/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java +++ b/src/main/java/techreborn/tiles/machine/multiblock/TileVacuumFreezer.java @@ -35,6 +35,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -48,7 +49,7 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP public MultiblockChecker multiblockChecker; public TileVacuumFreezer() { - super("VacuumFreezer", maxInput, maxEnergy, TRContent.Machine.VACUUM_FREEZER.block, 2); + super(TRTileEntities.VACUUM_FREEZER, "VacuumFreezer", maxInput, maxEnergy, TRContent.Machine.VACUUM_FREEZER.block, 2); final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileVacuumFreezer", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java b/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java index 358084f8c..ca0706658 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAlloySmelter.java @@ -38,6 +38,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -49,7 +50,7 @@ public class TileAlloySmelter extends TileGenericMachine implements IContainerPr public static int maxEnergy = 1_000; public TileAlloySmelter() { - super("AlloySmelter", maxInput, maxEnergy, TRContent.Machine.ALLOY_SMELTER.block, 3); + super(TRTileEntities.ALLOY_SMELTER, "AlloySmelter", maxInput, maxEnergy, TRContent.Machine.ALLOY_SMELTER.block, 3); final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2 }; this.inventory = new Inventory<>(4, "TileAlloySmelter", 64, this).withConfiguredAccess(); @@ -64,11 +65,11 @@ public class TileAlloySmelter extends TileGenericMachine implements IContainerPr .filterSlot(0, 34, 47, stack -> RecipeHandler.recipeList.stream() .anyMatch(recipe -> recipe instanceof AlloySmelterRecipe - && ItemUtils.isInputEqual(recipe.getInputs().get(0), stack, true, true, true))) + && ItemUtils.isInputEqual(recipe.getInputs().get(0), stack, true, true))) .filterSlot(1, 126, 47, stack -> RecipeHandler.recipeList.stream() .anyMatch(recipe -> recipe instanceof AlloySmelterRecipe - && ItemUtils.isInputEqual(recipe.getInputs().get(1), stack, true, true, true))) + && ItemUtils.isInputEqual(recipe.getInputs().get(1), stack, true, true))) .outputSlot(2, 80, 47).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory() .create(this); } diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java b/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java index dcbf34592..ee78093b8 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAssemblingMachine.java @@ -35,6 +35,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -46,7 +47,7 @@ public class TileAssemblingMachine extends TileGenericMachine implements IContai public static int maxEnergy = 10_000; public TileAssemblingMachine() { - super("AssemblingMachine", maxInput, maxEnergy, TRContent.Machine.ASSEMBLY_MACHINE.block, 3); + super(TRTileEntities.ASSEMBLY_MACHINE, "AssemblingMachine", maxInput, maxEnergy, TRContent.Machine.ASSEMBLY_MACHINE.block, 3); final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2 }; this.inventory = new Inventory<>(4, "TileAssemblingMachine", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java b/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java index d04b10abb..d549737f0 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileAutoCraftingTable.java @@ -28,7 +28,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.NBTTagCompound; @@ -50,6 +49,7 @@ import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.ModSounds; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import javax.annotation.Nullable; import java.util.ArrayList; @@ -79,7 +79,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor public boolean locked = true; public TileAutoCraftingTable() { - super(); + super(TRTileEntities.AUTO_CRAFTING_TABLE); } @Nullable @@ -133,7 +133,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor requiredSize = 0; } if (stacksInSlots[i] > requiredSize) { - if (ingredient.apply(stack)) { + if (ingredient.test(stack)) { if (stack.getItem().getContainerItem() != null) { if (!hasRoomForExtraItem(stack.getItem().getContainerItem(stack))) { continue; @@ -189,13 +189,13 @@ public class TileAutoCraftingTable extends TilePowerAcceptor Ingredient ingredient = recipe.getIngredients().get(i); // Looks for the best slot to take it from ItemStack bestSlot = inventory.getStackInSlot(i); - if (ingredient.apply(bestSlot)) { + if (ingredient.test(bestSlot)) { handleContainerItem(bestSlot); bestSlot.shrink(1); } else { for (int j = 0; j < 9; j++) { ItemStack stack = inventory.getStackInSlot(j); - if (ingredient.apply(stack)) { + if (ingredient.test(stack)) { handleContainerItem(stack); stack.shrink(1); // TODO is this right? or do I need // to use it as an actull @@ -235,7 +235,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor public boolean hasIngredient(Ingredient ingredient) { for (int i = 0; i < 9; i++) { ItemStack stack = inventory.getStackInSlot(i); - if (ingredient.apply(stack)) { + if (ingredient.test(stack)) { return true; } } @@ -261,11 +261,10 @@ public class TileAutoCraftingTable extends TilePowerAcceptor for (int i = 0; i < recipe.getIngredients().size(); i++) { ItemStack stackInSlot = inventory.getStackInSlot(i); Ingredient ingredient = recipe.getIngredients().get(i); - if (ingredient != Ingredient.EMPTY && ingredient.apply(stack)) { + if (ingredient != Ingredient.EMPTY && ingredient.test(stack)) { if (stackInSlot.isEmpty()) { possibleSlots.add(i); - } else if (stackInSlot.getItem() == stack.getItem() - && stackInSlot.getItemDamage() == stack.getItemDamage()) { + } else if (stackInSlot.getItem() == stack.getItem()) { if (stackInSlot.getMaxStackSize() >= stackInSlot.getCount() + stack.getCount()) { possibleSlots.add(i); } @@ -312,8 +311,8 @@ public class TileAutoCraftingTable extends TilePowerAcceptor // TilePowerAcceptor @Override - public void update() { - super.update(); + public void tick() { + super.tick(); if (world.isRemote) { return; } diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java b/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java index 0b5356ac6..659d4a11f 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileChemicalReactor.java @@ -35,6 +35,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -46,7 +47,7 @@ public class TileChemicalReactor extends TileGenericMachine implements IContaine public static int maxEnergy = 10_000; public TileChemicalReactor() { - super("ChemicalReactor", maxInput, maxEnergy, TRContent.Machine.CHEMICAL_REACTOR.block, 3); + super(TRTileEntities.CHEMICAL_REACTOR, "ChemicalReactor", maxInput, maxEnergy, TRContent.Machine.CHEMICAL_REACTOR.block, 3); final int[] inputs = new int[] { 0, 1 }; final int[] outputs = new int[] { 2 }; this.inventory = new Inventory<>(4, "TileChemicalReactor", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java b/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java index 45a9ddba6..beb165e47 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileCompressor.java @@ -35,6 +35,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -46,7 +47,7 @@ public class TileCompressor extends TileGenericMachine implements IContainerProv public static int maxEnergy = 1000; public TileCompressor() { - super("Compressor", maxInput, maxEnergy, TRContent.Machine.COMPRESSOR.block, 2); + super(TRTileEntities.COMPRESSOR, "Compressor", maxInput, maxEnergy, TRContent.Machine.COMPRESSOR.block, 2); final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileCompressor", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java b/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java index 19e7e1c20..e55519f58 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileElectricFurnace.java @@ -41,6 +41,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileElectricFurnace extends TilePowerAcceptor @@ -60,7 +61,7 @@ public class TileElectricFurnace extends TilePowerAcceptor boolean wasBurning = false; public TileElectricFurnace() { - super(); + super(TRTileEntities.ELECTRIC_FURNACE ); } public int gaugeProgressScaled(int scale) { @@ -125,7 +126,7 @@ public class TileElectricFurnace extends TilePowerAcceptor final IBlockState BlockStateContainer = world.getBlockState(pos); if (BlockStateContainer.getBlock() instanceof BlockMachineBase) { final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock(); - if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != progress > 0) + if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != progress > 0) blockMachineBase.setActive(progress > 0, world, pos); } wasBurning = (progress > 0); @@ -143,12 +144,12 @@ public class TileElectricFurnace extends TilePowerAcceptor // TilePowerAcceptor @Override - public void update() { + public void tick() { if (world.isRemote) { return; } - super.update(); + super.tick(); charge(2); final boolean burning = isBurning(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java b/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java index dcb1370f9..e3420b54d 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileExtractor.java @@ -35,6 +35,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -46,7 +47,7 @@ public class TileExtractor extends TileGenericMachine implements IContainerProvi public static int maxEnergy = 1_000; public TileExtractor() { - super("Extractor", maxInput, maxEnergy, TRContent.Machine.EXTRACTOR.block, 2); + super(TRTileEntities.EXTRACTOR, "Extractor", maxInput, maxEnergy, TRContent.Machine.EXTRACTOR.block, 2); final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileExtractor", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java b/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java index 969934d16..19c69d868 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileGrinder.java @@ -35,6 +35,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -46,7 +47,7 @@ public class TileGrinder extends TileGenericMachine implements IContainerProvide public static int maxEnergy = 1_000; public TileGrinder() { - super("Grinder", maxInput, maxEnergy, TRContent.Machine.GRINDER.block, 2); + super(TRTileEntities.GRINDER, "Grinder", maxInput, maxEnergy, TRContent.Machine.GRINDER.block, 2); final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileGrinder", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java b/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java index ef36681c7..36177db9a 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileIndustrialElectrolyzer.java @@ -36,6 +36,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.items.DynamicCell; import techreborn.tiles.TileGenericMachine; @@ -48,7 +49,7 @@ public class TileIndustrialElectrolyzer extends TileGenericMachine implements IC public static int maxEnergy = 10_000; public TileIndustrialElectrolyzer() { - super("IndustrialElectrolyzer", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_ELECTROLYZER.block, 6); + super(TRTileEntities.INDUSTRIAL_ELECTROLYZER, "IndustrialElectrolyzer", maxInput, maxEnergy, 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 Inventory<>(7, "TileIndustrialElectrolyzer", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TilePlayerDectector.java b/src/main/java/techreborn/tiles/machine/tier1/TilePlayerDectector.java index 5589005cb..3263d0b48 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TilePlayerDectector.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TilePlayerDectector.java @@ -36,6 +36,7 @@ import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.util.WorldUtils; import techreborn.TechReborn; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import java.util.Iterator; @@ -53,7 +54,7 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop boolean redstone = false; public TilePlayerDectector() { - super(); + super(TRTileEntities.PLAYER_DETECTOR); } public boolean isProvidingPower() { @@ -62,9 +63,9 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop // TilePowerAcceptor @Override - public void update() { - super.update(); - if (!world.isRemote && world.getWorldTime() % 20 == 0) { + public void tick() { + super.tick(); + if (!world.isRemote && world.getGameTime() % 20 == 0) { boolean lastRedstone = redstone; redstone = false; if (canUseEnergy(euPerTick)) { diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java b/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java index 5ad88af51..a031f3ad2 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileRecycler.java @@ -40,6 +40,7 @@ import techreborn.init.TRContent; import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileRecycler extends TilePowerAcceptor @@ -58,7 +59,7 @@ public class TileRecycler extends TilePowerAcceptor private int progress; public TileRecycler() { - super(); + super(TRTileEntities.RECYCLER); } public int gaugeProgressScaled(int scale) { @@ -114,7 +115,7 @@ public class TileRecycler extends TilePowerAcceptor if (BlockStateContainer.getBlock() instanceof BlockMachineBase) { final BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock(); boolean shouldBurn = isBurning || (canRecycle() && canUseEnergy(getEuPerTick(cost))); - if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != shouldBurn) { + if (BlockStateContainer.get(BlockMachineBase.ACTIVE) != shouldBurn) { blockMachineBase.setActive(isBurning, world, pos); } } @@ -122,8 +123,8 @@ public class TileRecycler extends TilePowerAcceptor // TilePowerAcceptor @Override - public void update() { - super.update(); + public void tick() { + super.tick(); if (world.isRemote) { return; } diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java b/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java index 26c9cdb53..691c7fe98 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileRollingMachine.java @@ -46,6 +46,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -80,7 +81,7 @@ public class TileRollingMachine extends TilePowerAcceptor public int balanceSlot = 0; public TileRollingMachine() { - super(); + super(TRTileEntities.ROLLING_MACHINE); outputSlot = 9; } @@ -110,8 +111,8 @@ public class TileRollingMachine extends TilePowerAcceptor } @Override - public void update() { - super.update(); + public void tick() { + super.tick(); if (world.isRemote) { return; } @@ -120,7 +121,7 @@ public class TileRollingMachine extends TilePowerAcceptor InventoryCrafting craftMatrix = getCraftingMatrix(); currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, world); if (currentRecipe != null) { - if (world.getTotalWorldTime() % 2 == 0) { + if (world.getGameTime() % 2 == 0) { Optional balanceResult = balanceRecipe(craftMatrix); if (balanceResult.isPresent()) { craftMatrix = balanceResult.get(); @@ -203,10 +204,10 @@ public class TileRollingMachine extends TilePowerAcceptor for (int s = 0; s < currentRecipe.getIngredients().size(); s++) { ItemStack stackInSlot = inventory.getStackInSlot(s); Ingredient ingredient = currentRecipe.getIngredients().get(s); - if (ingredient != Ingredient.EMPTY && ingredient.apply(sourceStack)) { + if (ingredient != Ingredient.EMPTY && ingredient.test(sourceStack)) { if (stackInSlot.isEmpty()) { possibleSlots.add(s); - } else if (stackInSlot.getItem() == sourceStack.getItem() && stackInSlot.getItemDamage() == sourceStack.getItemDamage()) { + } else if (stackInSlot.getItem() == sourceStack.getItem()) { possibleSlots.add(s); } } @@ -229,7 +230,7 @@ public class TileRollingMachine extends TilePowerAcceptor || bestSlot.getLeft() == balanceSlot || bestSlot.getRight() == sourceStack.getCount() || inventory.getStackInSlot(bestSlot.getLeft()).isEmpty() - || !ItemUtils.isItemEqual(sourceStack, inventory.getStackInSlot(bestSlot.getLeft()), true, true, true)) { + || !ItemUtils.isItemEqual(sourceStack, inventory.getStackInSlot(bestSlot.getLeft()), true, true)) { return Optional.empty(); } sourceStack.shrink(1); diff --git a/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java b/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java index 134a59c9d..6bdafd862 100644 --- a/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java +++ b/src/main/java/techreborn/tiles/machine/tier1/TileScrapboxinator.java @@ -34,6 +34,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.TileGenericMachine; @RebornRegister(TechReborn.MOD_ID) @@ -45,7 +46,7 @@ public class TileScrapboxinator extends TileGenericMachine implements IContainer public static int maxEnergy = 1_000; public TileScrapboxinator() { - super("Scrapboxinator", maxInput, maxEnergy, TRContent.Machine.SCRAPBOXINATOR.block, 2); + super(TRTileEntities.SCRAPBOXINATOR, "Scrapboxinator", maxInput, maxEnergy, TRContent.Machine.SCRAPBOXINATOR.block, 2); final int[] inputs = new int[] { 0 }; final int[] outputs = new int[] { 1 }; this.inventory = new Inventory<>(3, "TileScrapboxinator", 64, this).withConfiguredAccess(); diff --git a/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java b/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java index 2efc31699..c4f7e8166 100644 --- a/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java +++ b/src/main/java/techreborn/tiles/storage/TileAdjustableSU.java @@ -36,6 +36,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; @RebornRegister(TechReborn.MOD_ID) public class TileAdjustableSU extends TileEnergyStorage implements IContainerProvider { @@ -51,7 +52,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro private int OUTPUT = 64; // The current output public TileAdjustableSU() { - super("ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnumPowerTier.INSANE, maxInput, maxOutput, maxEnergy); + super(TRTileEntities.ADJUSTABLE_SU, "ADJUSTABLE_SU", 4, TRContent.Machine.ADJUSTABLE_SU.block, EnumPowerTier.INSANE, maxInput, maxOutput, maxEnergy); } public void handleGuiInputFromClient(int id) { diff --git a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java index 16b93b155..96cbcfc43 100644 --- a/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java +++ b/src/main/java/techreborn/tiles/storage/TileEnergyStorage.java @@ -27,6 +27,7 @@ package techreborn.tiles.storage; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import reborncore.api.IToolDrop; import reborncore.api.power.EnumPowerTier; @@ -50,8 +51,8 @@ public class TileEnergyStorage extends TilePowerAcceptor public int maxOutput; public int maxStorage; - public TileEnergyStorage(String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) { - super(); + public TileEnergyStorage(TileEntityType tileEntityType, String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) { + super(tileEntityType); inventory = new Inventory<>(invSize, "Tile" + name, 64, this).withConfiguredAccess(); this.wrenchDrop = wrenchDrop; this.tier = tier; diff --git a/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java b/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java index de0a7822e..78a537430 100644 --- a/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java +++ b/src/main/java/techreborn/tiles/storage/TileHighVoltageSU.java @@ -30,6 +30,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 14/03/2016. @@ -41,7 +42,7 @@ public class TileHighVoltageSU extends TileEnergyStorage implements IContainerPr * MFSU should store 40M FE with 2048 FE/t I/O */ public TileHighVoltageSU() { - super("HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnumPowerTier.HIGH, 512, 512, 10_000_000); + super(TRTileEntities.HIGH_VOLTAGE_SU, "HIGH_VOLTAGE_SU", 2, TRContent.Machine.HIGH_VOLTAGE_SU.block, EnumPowerTier.HIGH, 512, 512, 10_000_000); } @Override diff --git a/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java b/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java index 2b386052c..b97986c9b 100644 --- a/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java +++ b/src/main/java/techreborn/tiles/storage/TileLowVoltageSU.java @@ -30,6 +30,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 14/03/2016. @@ -37,7 +38,7 @@ import techreborn.init.TRContent; public class TileLowVoltageSU extends TileEnergyStorage implements IContainerProvider { public TileLowVoltageSU() { - super("BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnumPowerTier.LOW, 32, 32, 40000); + super(TRTileEntities.LOW_VOLTAGE_SU, "BatBox", 2, TRContent.Machine.LOW_VOLTAGE_SU.block, EnumPowerTier.LOW, 32, 32, 40000); } @Override diff --git a/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java b/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java index 1843998a8..f987224c8 100644 --- a/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java +++ b/src/main/java/techreborn/tiles/storage/TileMediumVoltageSU.java @@ -30,6 +30,7 @@ import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.builder.BuiltContainer; import reborncore.client.containerBuilder.builder.ContainerBuilder; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 14/03/2016. @@ -41,7 +42,7 @@ public class TileMediumVoltageSU extends TileEnergyStorage implements IContainer * MFE should store 1.2M FE with 512 FE/t I/O */ public TileMediumVoltageSU() { - super("MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnumPowerTier.MEDIUM, 128, 128, 300000); + super(TRTileEntities.MEDIUM_VOLTAGE_SU, "MEDIUM_VOLTAGE_SU", 2, TRContent.Machine.MEDIUM_VOLTAGE_SU.block, EnumPowerTier.MEDIUM, 128, 128, 300000); } @Override diff --git a/src/main/java/techreborn/tiles/storage/idsu/IDSUManager.java b/src/main/java/techreborn/tiles/storage/idsu/IDSUManager.java index 41ebb5b9e..87e5eaf4e 100644 --- a/src/main/java/techreborn/tiles/storage/idsu/IDSUManager.java +++ b/src/main/java/techreborn/tiles/storage/idsu/IDSUManager.java @@ -26,11 +26,12 @@ package techreborn.tiles.storage.idsu; import net.minecraft.world.World; import net.minecraft.world.storage.MapStorage; +import net.minecraft.world.storage.WorldSavedDataStorage; import techreborn.TechReborn; public class IDSUManager { public static IDataIDSU getData(World world) { - MapStorage storage = world.getMapStorage(); + WorldSavedDataStorage storage = world.getMapStorage(); IDSUSaveManger instance = (IDSUSaveManger) storage.getOrLoadData(IDSUSaveManger.class, TechReborn.MOD_ID + "_IDSU"); if (instance == null) { diff --git a/src/main/java/techreborn/tiles/storage/idsu/TileInterdimensionalSU.java b/src/main/java/techreborn/tiles/storage/idsu/TileInterdimensionalSU.java index 93ee9a6ad..bc59f0419 100644 --- a/src/main/java/techreborn/tiles/storage/idsu/TileInterdimensionalSU.java +++ b/src/main/java/techreborn/tiles/storage/idsu/TileInterdimensionalSU.java @@ -35,6 +35,7 @@ import reborncore.common.registration.RebornRegister; import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.storage.TileEnergyStorage; @RebornRegister(TechReborn.MOD_ID) @@ -50,7 +51,7 @@ public class TileInterdimensionalSU extends TileEnergyStorage implements IContai public String ownerUdid; public TileInterdimensionalSU() { - super("IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnumPowerTier.EXTREME, maxInput, maxOutput, maxEnergy); + super(TRTileEntities.INTERDIMENSIONAL_SU, "IDSU", 2, TRContent.Machine.INTERDIMENSIONAL_SU.block, EnumPowerTier.EXTREME, maxInput, maxOutput, maxEnergy); } @Override diff --git a/src/main/java/techreborn/tiles/storage/lesu/TileLSUStorage.java b/src/main/java/techreborn/tiles/storage/lesu/TileLSUStorage.java index 126fac3e9..a1e774022 100644 --- a/src/main/java/techreborn/tiles/storage/lesu/TileLSUStorage.java +++ b/src/main/java/techreborn/tiles/storage/lesu/TileLSUStorage.java @@ -26,18 +26,24 @@ package techreborn.tiles.storage.lesu; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import reborncore.api.IToolDrop; import reborncore.common.tile.TileMachineBase; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; public class TileLSUStorage extends TileMachineBase implements IToolDrop { public LesuNetwork network; + public TileLSUStorage() { + super(TRTileEntities.LSU_STORAGE); + } + public final void findAndJoinNetwork(World world, int x, int y, int z) { network = new LesuNetwork(); network.addElement(this); diff --git a/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java b/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java index cb90ab0e3..23bbeeb94 100644 --- a/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java +++ b/src/main/java/techreborn/tiles/storage/lesu/TileLapotronicSU.java @@ -38,6 +38,7 @@ import reborncore.common.registration.config.ConfigRegistry; import techreborn.TechReborn; import techreborn.blocks.storage.BlockLapotronicSU; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; import techreborn.tiles.storage.TileEnergyStorage; import reborncore.client.containerBuilder.IContainerProvider; @@ -59,13 +60,13 @@ public class TileLapotronicSU extends TileEnergyStorage implements IContainerPro private ArrayList countedNetworks = new ArrayList<>(); public TileLapotronicSU() { - super("LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnumPowerTier.INSANE, 8192, baseOutput, 1_000_000); + super(TRTileEntities.LAPOTRONIC_SU, "LESU", 2, TRContent.Machine.LAPOTRONIC_SU.block, EnumPowerTier.INSANE, 8192, baseOutput, 1_000_000); checkOverfill = false; } @Override - public void update() { - super.update(); + public void tick() { + super.tick(); if (world.isRemote) { return; } diff --git a/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java b/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java index 605e92fef..0fcd0bc4c 100644 --- a/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileHVTransformer.java @@ -26,6 +26,7 @@ package techreborn.tiles.transformers; import reborncore.api.power.EnumPowerTier; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 16/03/2016. @@ -33,7 +34,7 @@ import techreborn.init.TRContent; public class TileHVTransformer extends TileTransformer { public TileHVTransformer() { - super("HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnumPowerTier.EXTREME); + super(TRTileEntities.HV_TRANSFORMER, "HVTransformer", TRContent.Machine.HV_TRANSFORMER.block, EnumPowerTier.EXTREME); } } diff --git a/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java b/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java index 02e4e5bed..7497679cc 100644 --- a/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileLVTransformer.java @@ -26,6 +26,7 @@ package techreborn.tiles.transformers; import reborncore.api.power.EnumPowerTier; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 16/03/2016. @@ -33,7 +34,7 @@ import techreborn.init.TRContent; public class TileLVTransformer extends TileTransformer { public TileLVTransformer() { - super("LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnumPowerTier.MEDIUM); + super(TRTileEntities.LV_TRANSFORMER, "LVTransformer", TRContent.Machine.LV_TRANSFORMER.block, EnumPowerTier.MEDIUM); } } diff --git a/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java b/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java index d797f5901..2f763eab0 100644 --- a/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileMVTransformer.java @@ -26,6 +26,7 @@ package techreborn.tiles.transformers; import reborncore.api.power.EnumPowerTier; import techreborn.init.TRContent; +import techreborn.init.TRTileEntities; /** * Created by modmuss50 on 16/03/2016. @@ -33,6 +34,6 @@ import techreborn.init.TRContent; public class TileMVTransformer extends TileTransformer { public TileMVTransformer() { - super("MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnumPowerTier.HIGH); + super(TRTileEntities.MV_TRANSFORMER, "MVTransformer", TRContent.Machine.MV_TRANSFORMER.block, EnumPowerTier.HIGH); } } diff --git a/src/main/java/techreborn/tiles/transformers/TileTransformer.java b/src/main/java/techreborn/tiles/transformers/TileTransformer.java index b4e8c3455..7a1cc741f 100644 --- a/src/main/java/techreborn/tiles/transformers/TileTransformer.java +++ b/src/main/java/techreborn/tiles/transformers/TileTransformer.java @@ -27,6 +27,7 @@ package techreborn.tiles.transformers; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.EnumFacing; import net.minecraft.util.text.TextFormatting; import reborncore.api.IListInfoProvider; @@ -60,8 +61,8 @@ public class TileTransformer extends TilePowerAcceptor public int maxOutput; public int maxStorage; - public TileTransformer(String name, Block wrenchDrop, EnumPowerTier tier) { - super(); + public TileTransformer(TileEntityType tileEntityType, String name, Block wrenchDrop, EnumPowerTier tier) { + super(tileEntityType); this.wrenchDrop = wrenchDrop; this.inputTier = tier; if (tier != EnumPowerTier.MICRO) {