From 5d31947f7da8384118b40efa0633d4b8dbbb54a2 Mon Sep 17 00:00:00 2001 From: DrMangoTea Date: Sat, 26 Jul 2025 22:35:12 +0200 Subject: [PATCH] code optimization & distillation fix --- src/main/java/com/drmangotea/tfmg/TFMG.java | 13 +- .../tfmg/base/TFMGContraptions.java | 2 +- .../tfmg/base/TFMGCreativeTabs.java | 1 - .../tfmg/base/TFMGSharedProperties.java | 5 - .../tfmg/base/TFMGSpriteShifts.java | 6 +- .../com/drmangotea/tfmg/base/TFMGUtils.java | 3 +- .../tfmg/base/debug/DebugCinderBlockItem.java | 46 ++++ .../tfmg/base/events/TFMGCommonEvents.java | 2 +- .../tfmg/base/fluid/AcidFluidType.java | 5 +- .../drmangotea/tfmg/config/MachineConfig.java | 8 +- .../tanks/steel/SteelTankBlock.java | 1 + .../base/ConnectNeightborsPacket.java | 4 +- .../electricity/base/ConnectionPacket.java | 4 - .../electricity/base/ElectricBlockEntity.java | 17 +- .../electricity/base/ElectricBlockValues.java | 17 +- .../electricity/base/ElectricalGroup.java | 5 +- .../electricity/base/ElectricalNetwork.java | 59 ++--- .../content/electricity/base/IElectric.java | 76 +++---- .../electricity/base/NetworkUpdatePacket.java | 10 +- .../electricity/base/UpdateInFrontPacket.java | 8 +- .../ElectricBlockItem.java | 32 --- .../ElectriciansWrenchPacket.java | 35 +-- .../ElectriciansWrenchScreen.java | 18 -- .../{cable_hub => }/CableHubBlock.java | 10 +- .../cable_hub/CableHubBlockEntity.java | 14 -- .../connection/cables/CableConnection.java | 4 - .../debug/DebugCinderBlockItem.java | 58 ----- .../generators/GeneratorBlockEntity.java | 12 +- .../large_generator/RotorVisual.java | 3 - .../lights/LightBulbBlockEntity.java | 20 -- .../MultimeterOverlayRenderer.java | 19 -- .../measurement/VoltMeterBlock.java | 12 +- .../measurement/VoltMeterBlockEntity.java | 2 - .../measurement/VoltMeterRenderer.java | 3 - .../electricity/storage/AccumulatorBlock.java | 5 +- .../utilities/fuse_block/FuseBlock.java | 45 ---- .../utilities/fuse_block/FuseBlockEntity.java | 209 ------------------ .../fuse_block/FuseBlockRenderer.java | 32 --- .../utilities/fuse_block/FuseItem.java | 25 --- .../blast_stove/BlastStoveBlockEntity.java | 101 +-------- .../blast_stove/BlastStoveItem.java | 4 +- .../VerticalPlacementHelper.java | 76 ------- .../DistillationControllerBlock.java | 18 +- .../DistillationControllerBlockEntity.java | 59 +++-- .../controller/DistillationTowerPacket.java | 47 ++++ .../output/DistillationOutputBlockEntity.java | 22 +- .../{pumpjack => }/base/FluidReservoir.java | 2 +- .../base/PumpjackBaseBlock.java | 2 +- .../base/PumpjackBaseBlockEntity.java | 8 +- .../{pumpjack => }/base/TestSavedData.java | 3 +- .../base/TestSavedDataManager.java | 2 +- .../crank/PumpjackCrankBlock.java | 3 +- .../crank/PumpjackCrankBlockEntity.java | 2 +- .../crank/PumpjackCrankRenderer.java | 4 +- .../{pumpjack => }/hammer/PumpjackBlock.java | 43 +--- .../hammer/PumpjackBlockEntity.java | 11 +- .../hammer/PumpjackContraption.java | 7 +- .../hammer/PumpjackGenerator.java | 4 +- .../hammer/PumpjackRenderer.java | 6 +- .../parts/PumpjackHammerConnectorBlock.java | 2 +- .../hammer/parts/PumpjackHammerHeadBlock.java | 2 +- .../hammer/parts/PumpjackHammerPartBlock.java | 3 +- .../LargePumpjackHammerConnectorBlock.java | 4 +- .../large/LargePumpjackHammerHeadBlock.java | 4 +- .../large/LargePumpjackHammerPartBlock.java | 4 +- .../pumpjack/pumpjack/base/DepositItem.java | 37 ---- .../pumpjack/base/DepositSavedData.java | 1 - .../recipes/IndustrialBlastingRecipe.java | 16 -- .../tfmg/recipes/VatMachineRecipe.java | 51 ----- .../tfmg/recipes/jei/CastingCategory.java | 7 +- .../tfmg/recipes/jei/ChemicalVatCategory.java | 3 - .../recipes/jei/DistillationCategory.java | 18 -- .../tfmg/recipes/jei/HotBlastCategory.java | 26 --- .../jei/IndustrialBlastingCategory.java | 1 - .../tfmg/recipes/jei/PolarizingCategory.java | 1 - .../drmangotea/tfmg/recipes/jei/TFMGJei.java | 9 - .../tfmg/recipes/jei/WindingCategory.java | 3 - .../tfmg/registry/TFMGBlockEntities.java | 34 +-- .../drmangotea/tfmg/registry/TFMGBlocks.java | 55 +++-- .../tfmg/registry/TFMGCableTypes.java | 2 +- .../tfmg/registry/TFMGEntityTypes.java | 10 - .../drmangotea/tfmg/registry/TFMGItems.java | 11 +- .../drmangotea/tfmg/registry/TFMGKeys.java | 4 - .../tfmg/registry/TFMGMobEffects.java | 3 + .../registry/TFMGMountedStorageTypes.java | 4 +- .../drmangotea/tfmg/registry/TFMGPackets.java | 2 + .../tfmg/registry/TFMGPartialModels.java | 18 -- .../tfmg/registry/TFMGRecipeTypes.java | 14 -- .../drmangotea/tfmg/registry/TFMGTags.java | 13 +- 89 files changed, 324 insertions(+), 1312 deletions(-) delete mode 100644 src/main/java/com/drmangotea/tfmg/base/TFMGSharedProperties.java create mode 100644 src/main/java/com/drmangotea/tfmg/base/debug/DebugCinderBlockItem.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectricBlockItem.java rename src/main/java/com/drmangotea/tfmg/content/electricity/connection/{cable_hub => }/CableHubBlock.java (79%) delete mode 100644 src/main/java/com/drmangotea/tfmg/content/electricity/connection/cable_hub/CableHubBlockEntity.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/electricity/debug/DebugCinderBlockItem.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlock.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockEntity.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockRenderer.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseItem.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/VerticalPlacementHelper.java create mode 100644 src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationTowerPacket.java rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/base/FluidReservoir.java (94%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/base/PumpjackBaseBlock.java (98%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/base/PumpjackBaseBlockEntity.java (97%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/base/TestSavedData.java (97%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/base/TestSavedDataManager.java (99%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/crank/PumpjackCrankBlock.java (95%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/crank/PumpjackCrankBlockEntity.java (99%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/crank/PumpjackCrankRenderer.java (93%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/PumpjackBlock.java (57%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/PumpjackBlockEntity.java (97%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/PumpjackContraption.java (82%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/PumpjackGenerator.java (95%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/PumpjackRenderer.java (97%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/parts/PumpjackHammerConnectorBlock.java (98%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/parts/PumpjackHammerHeadBlock.java (98%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/parts/PumpjackHammerPartBlock.java (98%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/parts/large/LargePumpjackHammerConnectorBlock.java (89%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/parts/large/LargePumpjackHammerHeadBlock.java (89%) rename src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/{pumpjack => }/hammer/parts/large/LargePumpjackHammerPartBlock.java (89%) delete mode 100644 src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositItem.java delete mode 100644 src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositSavedData.java diff --git a/src/main/java/com/drmangotea/tfmg/TFMG.java b/src/main/java/com/drmangotea/tfmg/TFMG.java index 6194c012..cbd7393f 100644 --- a/src/main/java/com/drmangotea/tfmg/TFMG.java +++ b/src/main/java/com/drmangotea/tfmg/TFMG.java @@ -4,7 +4,7 @@ import com.drmangotea.tfmg.base.*; import com.drmangotea.tfmg.content.electricity.base.ElectricNetworkManager; import com.drmangotea.tfmg.content.engines.fuels.BaseFuelTypes; import com.drmangotea.tfmg.content.items.weapons.explosives.thermite_grenades.fire.TFMGColoredFires; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.TestSavedDataManager; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.TestSavedDataManager; import com.drmangotea.tfmg.datagen.TFMGDatagen; import com.drmangotea.tfmg.base.fluid.TFMGFluidInteractions; import com.drmangotea.tfmg.config.TFMGConfigs; @@ -12,28 +12,20 @@ import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipes; import com.drmangotea.tfmg.registry.*; import com.drmangotea.tfmg.worldgen.TFMGFeatures; import com.mojang.logging.LogUtils; -import com.simibubi.create.AllSoundEvents; -import com.simibubi.create.foundation.data.CreateRegistrate; import com.simibubi.create.foundation.item.ItemDescription; import com.simibubi.create.foundation.item.KineticStats; import com.simibubi.create.foundation.item.TooltipModifier; -import com.simibubi.create.infrastructure.data.CreateDatagen; import net.createmod.catnip.lang.FontHelper; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.CreativeModeTab; -import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.EventPriority; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; import net.neoforged.fml.ModLoadingContext; import net.neoforged.fml.common.Mod; -import net.neoforged.fml.event.IModBusEvent; import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; -import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.registries.RegisterEvent; import org.slf4j.Logger; @@ -102,8 +94,7 @@ public class TFMG { modEventBus.addListener(TFMGCreativeTabs::addCreative); } - - @SuppressWarnings("removal") + @SuppressWarnings("deprecation") private void clientSetup(final FMLClientSetupEvent event) { ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.GREEN_FIRE.get(), RenderType.cutout()); ItemBlockRenderTypes.setRenderLayer(TFMGColoredFires.BLUE_FIRE.get(), RenderType.cutout()); diff --git a/src/main/java/com/drmangotea/tfmg/base/TFMGContraptions.java b/src/main/java/com/drmangotea/tfmg/base/TFMGContraptions.java index 9433c42a..a6733839 100644 --- a/src/main/java/com/drmangotea/tfmg/base/TFMGContraptions.java +++ b/src/main/java/com/drmangotea/tfmg/base/TFMGContraptions.java @@ -3,7 +3,7 @@ package com.drmangotea.tfmg.base; import com.drmangotea.tfmg.TFMG; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackContraption; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackContraption; import com.simibubi.create.api.contraption.ContraptionType; import com.simibubi.create.api.registry.CreateBuiltInRegistries; import com.simibubi.create.content.contraptions.Contraption; diff --git a/src/main/java/com/drmangotea/tfmg/base/TFMGCreativeTabs.java b/src/main/java/com/drmangotea/tfmg/base/TFMGCreativeTabs.java index ae874897..7899a8e5 100644 --- a/src/main/java/com/drmangotea/tfmg/base/TFMGCreativeTabs.java +++ b/src/main/java/com/drmangotea/tfmg/base/TFMGCreativeTabs.java @@ -112,7 +112,6 @@ public class TFMGCreativeTabs { list.add(TFMGItems.LIT_LITHIUM_BLADE); list.add(TFMGItems.GOLDEN_TURBO); - list.add(TFMGItems.DEPOSIT_ITEM); list.add(TFMGItems.ALUMINUM_SPOOL); list.add(TFMGItems.COPPER_SPOOL); list.add(TFMGItems.CONSTANTAN_SPOOL); diff --git a/src/main/java/com/drmangotea/tfmg/base/TFMGSharedProperties.java b/src/main/java/com/drmangotea/tfmg/base/TFMGSharedProperties.java deleted file mode 100644 index 1f454301..00000000 --- a/src/main/java/com/drmangotea/tfmg/base/TFMGSharedProperties.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.drmangotea.tfmg.base; - - - -public class TFMGSharedProperties {} diff --git a/src/main/java/com/drmangotea/tfmg/base/TFMGSpriteShifts.java b/src/main/java/com/drmangotea/tfmg/base/TFMGSpriteShifts.java index 17c2dada..72d27c86 100644 --- a/src/main/java/com/drmangotea/tfmg/base/TFMGSpriteShifts.java +++ b/src/main/java/com/drmangotea/tfmg/base/TFMGSpriteShifts.java @@ -12,8 +12,8 @@ import net.createmod.catnip.render.SpriteShifter; public class TFMGSpriteShifts { public static final CTSpriteShiftEntry CAST_IRON_BLOCK = omni("cast_iron_block"), LEAD_BLOCK = omni("lead_block"), STEEL_BLOCK = omni("steel_block"); - public static final CTSpriteShiftEntry HEAVY_MACHINERY_CASING = omni("heavy_machinery_casing"), ELECTRIC_CASING = omni("electric_casing"), STEEL_CASING = omni("steel_casing"), INDUSTRIAL_ALUMINUM_CASING = omni("industrial_aluminum_casing"); - public static final CTSpriteShiftEntry CAPACITOR = getCT(AllCTTypes.RECTANGLE, "capacitor_side"), ACCUMULATOR = getCT(AllCTTypes.RECTANGLE, "accumulator_side"); + public static final CTSpriteShiftEntry HEAVY_MACHINERY_CASING = omni("heavy_machinery_casing"), INDUSTRIAL_ALUMINUM_CASING = omni("industrial_aluminum_casing"); + public static final CTSpriteShiftEntry ACCUMULATOR = getCT(AllCTTypes.RECTANGLE, "accumulator_side"); public static final CTSpriteShiftEntry STEEL_SCAFFOLD = horizontal("scaffold/steel_scaffold"), ALUMINUM_SCAFFOLD = horizontal("scaffold/aluminum_scaffold"); public static final CTSpriteShiftEntry ALUMINUM_SCAFFOLD_TOP = omni("aluminum_casing"); public static final CTSpriteShiftEntry STEEL_SCAFFOLD_INSIDE = horizontal("scaffold/steel_scaffold_inside"), ALUMINUM_SCAFFOLD_INSIDE = horizontal("scaffold/aluminum_scaffold_inside"); @@ -46,7 +46,7 @@ public class TFMGSpriteShifts { REGULAR_ENGINE_TOP = vertical("engines/engine_top"), REGULAR_ENGINE_BOTTOM = vertical("engines/engine_bottom"), REGULAR_ENGINE_SIDE = horizontal("engines/engine_side"); - public static final SpriteShiftEntry WINDING_MACHINE_COPPER_WIRE = get("block/winding_machine_copper_wire", "block/winding_machine_copper_wire_scroll"); + /////////////////////// diff --git a/src/main/java/com/drmangotea/tfmg/base/TFMGUtils.java b/src/main/java/com/drmangotea/tfmg/base/TFMGUtils.java index 55bfff63..a70bf774 100644 --- a/src/main/java/com/drmangotea/tfmg/base/TFMGUtils.java +++ b/src/main/java/com/drmangotea/tfmg/base/TFMGUtils.java @@ -169,8 +169,7 @@ public class TFMGUtils { ///////// IFluidHandler handler = Capabilities.FluidHandler.BLOCK.getCapability(be.getLevel(),be.getBlockPos(),be.getBlockState(),be,null); - //Optional resolve = handler.resolve(); - //if (!resolve.isPresent()) return false; + if(handler == null) return true; diff --git a/src/main/java/com/drmangotea/tfmg/base/debug/DebugCinderBlockItem.java b/src/main/java/com/drmangotea/tfmg/base/debug/DebugCinderBlockItem.java new file mode 100644 index 00000000..d1a6c093 --- /dev/null +++ b/src/main/java/com/drmangotea/tfmg/base/debug/DebugCinderBlockItem.java @@ -0,0 +1,46 @@ +package com.drmangotea.tfmg.base.debug; + +import com.drmangotea.tfmg.TFMG; +import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock; +import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; + + +public class DebugCinderBlockItem extends Item { + public DebugCinderBlockItem(Properties p_41383_) { + super(p_41383_); + } + + @Override + public boolean isFoil(ItemStack pStack) { + return true; + } + + @Override + public InteractionResult useOn(UseOnContext context) { + + BlockPos pos = context.getClickedPos(); + Level level = context.getLevel(); + + + + if (level.getBlockEntity(pos) instanceof SteelTankBlockEntity be) { + if(!context.getPlayer().isCrouching()) { + //SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), true, false); + // be.updateTemperature(); + TFMG.LOGGER.debug(String.valueOf(be.isDistillationTower)); + //be.sendData(); + //be.getControllerBE().sendData(); + }else { + SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), false, false); + TFMG.LOGGER.debug(String.valueOf(be.isDistillationTower)); + } + } + return InteractionResult.PASS; + } +} diff --git a/src/main/java/com/drmangotea/tfmg/base/events/TFMGCommonEvents.java b/src/main/java/com/drmangotea/tfmg/base/events/TFMGCommonEvents.java index 44c78720..148e03d1 100644 --- a/src/main/java/com/drmangotea/tfmg/base/events/TFMGCommonEvents.java +++ b/src/main/java/com/drmangotea/tfmg/base/events/TFMGCommonEvents.java @@ -25,7 +25,7 @@ import com.drmangotea.tfmg.content.machinery.misc.flarestack.FlarestackBlockEnti import com.drmangotea.tfmg.content.machinery.misc.smokestack.SmokestackBlockEntity; import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlockEntity; import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlockEntity; import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity; import com.drmangotea.tfmg.registry.TFMGDataComponents; import com.drmangotea.tfmg.registry.TFMGItems; diff --git a/src/main/java/com/drmangotea/tfmg/base/fluid/AcidFluidType.java b/src/main/java/com/drmangotea/tfmg/base/fluid/AcidFluidType.java index 7cd4ada4..79bf80ba 100644 --- a/src/main/java/com/drmangotea/tfmg/base/fluid/AcidFluidType.java +++ b/src/main/java/com/drmangotea/tfmg/base/fluid/AcidFluidType.java @@ -58,10 +58,7 @@ public class AcidFluidType extends AllFluids.TintedFluidType { @Override - public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity) - { - - + public boolean move(FluidState state, LivingEntity entity, Vec3 movementVector, double gravity) { if(Create.RANDOM.nextInt(2)==0) entity.hurt(TFMGDamageSources.acid(entity.level()),2); diff --git a/src/main/java/com/drmangotea/tfmg/config/MachineConfig.java b/src/main/java/com/drmangotea/tfmg/config/MachineConfig.java index 914a49ea..92a388b7 100644 --- a/src/main/java/com/drmangotea/tfmg/config/MachineConfig.java +++ b/src/main/java/com/drmangotea/tfmg/config/MachineConfig.java @@ -5,14 +5,11 @@ import net.createmod.catnip.config.ConfigBase; public class MachineConfig extends ConfigBase { - - public final ConfigInt electricMotorMinimumPower = i(250, 1, "electricMotorMinimumPower", Comments.electricMotorMinimumPower); - public final ConfigInt electricMotorMinimumVoltage = i(150, 1, "electricMotorMinimumVoltage", Comments.electricMotorMinimumVoltage); public final ConfigFloat electricMotorInternalResistance = f(100, 0, "electricMotorInternalResistance", Comments.electricMotorInternalResistance); public final ConfigInt cokeOvenMaxSize = i(5, 1, "cokeOvenMaxSize", Comments.cokeOvenMaxSize); public final ConfigFloat FEtoWattTickConversionRate = f(1, 0, "FEtoWattTickConversionRate", Comments.FEtoWattTickConversionRate); - public final ConfigInt graphiteElectrodeCurrent = i(10, 1, "graphiteElectrodeCurrent", Comments.graphiteElectrodeCurrent); + public final ConfigInt electrolysisMinimumCurrent = i(5, 1, "electrolysisMinimumCurrent", Comments.electrolysisMinimumCurrent); public final ConfigInt engineMaxLength = i(5, 1, "engineMaxLength", Comments.engineMaxLength); public final ConfigInt surfaceScannerScanDepth = i(-64, -512, "surfaceScannerScanDepth", Comments.surfaceScannerScanDepth); @@ -59,8 +56,6 @@ public class MachineConfig extends ConfigBase { static String blastFurnaceHeight = "Changes the maximum height of the blast furnace."; static String blastFurnaceHeightSpeedModifier = "Sets the maximum time that can be saved by increasing blast furnace height."; static String blastFurnaceFuelConsumption = "Determines how many ticks does it take to consume one fuel."; - static String electricMotorMinimumPower = "Determines the minimum power an electric motor can run on."; - static String electricMotorMinimumVoltage = "Determines the minimum voltage an electric motor can run on."; static String electricMotorInternalResistance = "Sets the internal resistance of the electric motor."; static String cokeOvenMaxSize = "Determines the maximum size of coke ovens."; static String accumulatorStorage = "Determines the storage space of accumulators."; @@ -69,7 +64,6 @@ public class MachineConfig extends ConfigBase { static String accumulatorChargingRate = "Sets the maximum charging rate of accumulators."; static String fireboxExhaustRequirement = "If set to true,fireboxes will require exhaust management."; static String fireboxFuelConsumption = "Determines the amount of fuel a firebox needs to run for 3 seconds."; - static String graphiteElectrodeCurrent = "The minimum electric current that will make graphite electrodes superheated."; static String electrolysisMinimumCurrent = "The minimum electric current that will make electrolyzers operational."; static String engineMaxLength = "The maximum length of engines."; static String surfaceScannerScanDepth = "Y level surface scanner scan at."; diff --git a/src/main/java/com/drmangotea/tfmg/content/decoration/tanks/steel/SteelTankBlock.java b/src/main/java/com/drmangotea/tfmg/content/decoration/tanks/steel/SteelTankBlock.java index 00c77ce3..0ebad5f3 100644 --- a/src/main/java/com/drmangotea/tfmg/content/decoration/tanks/steel/SteelTankBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/decoration/tanks/steel/SteelTankBlock.java @@ -353,6 +353,7 @@ public class SteelTankBlock extends Block implements IWrenchable, IBE { public ConnectionPacket(BlockPos pos) { super(pos); - - } @@ -30,10 +28,8 @@ public class ConnectionPacket extends BlockEntityDataPacket { if(blockEntity instanceof IElectric be) { be.onConnected(); } - } - @Override public PacketTypeProvider getTypeProvider() { return TFMGPackets.CONNECTION_PACKET; diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockEntity.java index a425d3fc..cb8fda24 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockEntity.java @@ -1,23 +1,15 @@ package com.drmangotea.tfmg.content.electricity.base; -import com.drmangotea.tfmg.TFMG; -import com.drmangotea.tfmg.registry.TFMGPackets; import com.simibubi.create.api.equipment.goggles.IHaveHoveringInformation; import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour; -import net.createmod.catnip.platform.CatnipServices; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; - -import java.util.ArrayList; import java.util.List; public class ElectricBlockEntity extends SmartBlockEntity implements IElectric, IHaveHoveringInformation { @@ -60,7 +52,6 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IElectric, } - @Override public long getPos() { return getBlockPos().asLong(); @@ -82,15 +73,15 @@ public class ElectricBlockEntity extends SmartBlockEntity implements IElectric, @Override protected void write(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) { - super.write(compound,registries , clientPacket); - writeElectricity(compound,clientPacket); + super.write(compound, registries, clientPacket); + writeElectricity(compound, clientPacket); } @Override protected void read(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) { - super.read(compound,registries , clientPacket); - readElectricity(compound,clientPacket); + super.read(compound, registries, clientPacket); + readElectricity(compound, clientPacket); } } diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockValues.java b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockValues.java index 0cafd0ab..a6ddc451 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockValues.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricBlockValues.java @@ -12,12 +12,11 @@ public class ElectricBlockValues { public boolean getsOutsidePower = false; public int networkResistance = 0; public int voltage = 0; - public int frequency = 0; public int voltageSupply = 0; - public int networkPowerGeneration =0; - public float highestCurrent=0; + public int networkPowerGeneration = 0; + public float highestCurrent = 0; - public boolean notEnoughtPower=false; + public boolean notEnoughtPower = false; public boolean setVoltageNextTick = false; @@ -25,17 +24,19 @@ public class ElectricBlockValues { public ElectricalGroup group = new ElectricalGroup(0); - public ElectricBlockValues(long pos){ + public ElectricBlockValues(long pos) { this.electricalNetworkId = pos; } - public long getId(){ + public long getId() { return electricalNetworkId; } - public boolean destroyed(){ + + public boolean destroyed() { return destroyed; } - public int getVoltage(){ + + public int getVoltage() { return voltage; } } diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalGroup.java b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalGroup.java index 8da9b9ee..92c7329a 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalGroup.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalGroup.java @@ -1,16 +1,13 @@ package com.drmangotea.tfmg.content.electricity.base; -import java.util.List; + public class ElectricalGroup { - public int id; public float resistance=0; - public ElectricalGroup(int id){ this.id = id; } - } diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalNetwork.java b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalNetwork.java index 45486537..eee417ac 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalNetwork.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/base/ElectricalNetwork.java @@ -1,14 +1,14 @@ package com.drmangotea.tfmg.content.electricity.base; -import com.drmangotea.tfmg.TFMG; import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity; import com.drmangotea.tfmg.content.electricity.utilities.electric_motor.ElectricMotorBlockEntity; import com.drmangotea.tfmg.content.electricity.utilities.transformer.TransformerBlockEntity; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.world.level.block.Blocks; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class ElectricalNetwork { @@ -18,7 +18,6 @@ public class ElectricalNetwork { public List members = new ArrayList<>(); - public long id; public long getId() { @@ -36,8 +35,6 @@ public class ElectricalNetwork { public void updateNetwork() { - - int maxVoltage = 0; int power = 0; int resistance = 0; @@ -58,11 +55,8 @@ public class ElectricalNetwork { groups.put(groupId, groups.containsKey(groupId) ? groups.get(groupId) + member.resistance() : member.resistance()); } - int powerPercentage = resistance > 0 ? (int) (Math.min(((float) power / (float) resistance * 100f), 100)) : 100; - List list = new ArrayList<>(members); - if(!members.isEmpty()) { - float powerUsage = members.get(0).getNetworkPowerUsage(); + if (!members.isEmpty()) { for (IElectric member : list) { @@ -76,7 +70,6 @@ public class ElectricalNetwork { member.setNetworkResistance(resistance); member.onNetworkChanged(oldVoltage, oldPower); - if (groups.containsKey(member.getData().group.id)) member.getData().group.resistance = groups.get(member.getData().group.id); } @@ -86,33 +79,29 @@ public class ElectricalNetwork { member.getData().highestCurrent = getCableCurrent(member); member.updateNearbyNetworks(member); - if(member instanceof ElectricDiodeBlockEntity be) { + if (member instanceof ElectricDiodeBlockEntity be) { be.updateInFront(); } - if(member instanceof TransformerBlockEntity be) { + if (member instanceof TransformerBlockEntity be) { be.updateInFront(); } - // if (member instanceof KineticElectricBlockEntity be) { - // be.updateGeneratedRotation(); - // } } handleInsufficientPower(); } - public void handleInsufficientPower(){ + public void handleInsufficientPower() { if (!members.isEmpty()) if (members.get(0).getNetworkPowerUsage() > members.get(0).getNetworkPowerGeneration()) { - // members.get(0).updateUnpowered(new ArrayList<>()); for (IElectric member : members) { member.getData().notEnoughtPower = true; if (member instanceof ElectricMotorBlockEntity be) { be.updateGeneratedRotation(); } if (member instanceof ElectricDiodeBlockEntity be) - be.updateInFront=true; + be.updateInFront = true; if (member instanceof TransformerBlockEntity be) be.updateInFront(); } @@ -140,36 +129,36 @@ public class ElectricalNetwork { return current; } - public void checkForLoops(BlockPos pos ){ + public void checkForLoops(BlockPos pos) { - members.forEach(member->{ - if(member instanceof VoltageAlteringBlockEntity be){ - if(be.getControlledBlock() !=null){ + members.forEach(member -> { + if (member instanceof VoltageAlteringBlockEntity be) { + if (be.getControlledBlock() != null) { List list = new ArrayList<>(); list.add(this); be.getControlledBlock().getOrCreateElectricNetwork().checkForLoops(list, pos); } - }}); + } + }); } - public void checkForLoops(List network, BlockPos pos){ + public void checkForLoops(List network, BlockPos pos) { - if(network.contains(this)) { - if(!members.isEmpty()) - members.get(0).getLevelAccessor().destroyBlock(pos,false); + if (network.contains(this)) { + if (!members.isEmpty()) + members.get(0).getLevelAccessor().destroyBlock(pos, false); return; } network.add(this); - members.forEach(member->{ - if(member instanceof VoltageAlteringBlockEntity be){ - if(be.getControlledBlock() !=null){ + members.forEach(member -> { + if (member instanceof VoltageAlteringBlockEntity be) { + if (be.getControlledBlock() != null) { be.getControlledBlock().getOrCreateElectricNetwork().checkForLoops(network, pos); } - }}); - - + } + }); } public List getMembers() { diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/base/IElectric.java b/src/main/java/com/drmangotea/tfmg/content/electricity/base/IElectric.java index c2c7b9fd..3df77e1d 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/base/IElectric.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/base/IElectric.java @@ -4,14 +4,12 @@ import com.drmangotea.tfmg.TFMG; import com.drmangotea.tfmg.base.TFMGUtils; import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnection; import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlockEntity; -import com.drmangotea.tfmg.registry.TFMGPackets; import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.platform.CatnipServices; import net.createmod.catnip.theme.Color; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.server.level.ServerLevel; @@ -28,7 +26,7 @@ public interface IElectric { LevelAccessor getLevelAccessor(); - default boolean destroyed(){ + default boolean destroyed() { return getData().destroyed(); } @@ -49,7 +47,7 @@ public interface IElectric { default void onPlaced() { if (getLevelAccessor() instanceof ServerLevel serverLevel) - CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(BlockPos.of(getPos())),new ConnectNeightborsPacket(BlockPos.of(getPos()))); + CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(BlockPos.of(getPos())), new ConnectNeightborsPacket(BlockPos.of(getPos()))); ElectricalNetwork network = TFMG.NETWORK_MANAGER.getOrCreateNetworkFor(this); setNetwork(getPos()); getData().electricalNetworkId = getPos(); @@ -67,7 +65,8 @@ public interface IElectric { sendStuff(); } - default void onRemoved(){ + + default void onRemoved() { this.getData().destroyed = true; for (Direction d : Direction.values()) { if (hasElectricitySlot(d)) @@ -87,19 +86,19 @@ public interface IElectric { .remove(getData().getId()); } - default void readElectricity(CompoundTag compound, boolean clientPacket){ + default void readElectricity(CompoundTag compound, boolean clientPacket) { getData().group = new ElectricalGroup(compound.getInt("GroupId")); getData().group.resistance = compound.getFloat("GroupResistance"); if (!clientPacket) getData().connectNextTick = true; } - default void writeElectricity(CompoundTag compound, boolean clientPacket){ + default void writeElectricity(CompoundTag compound, boolean clientPacket) { compound.putInt("GroupId", getData().group.id); compound.putFloat("GroupResistance", getData().group.resistance); } - default void tickElectricity(){ + default void tickElectricity() { if (getData().checkForLoopsNextTick) { getOrCreateElectricNetwork().checkForLoops(getBlockPos()); getData().checkForLoopsNextTick = false; @@ -122,12 +121,13 @@ public interface IElectric { getData().setVoltageNextTick = false; } } - default void lazyTickElectricity(){ + + default void lazyTickElectricity() { if (getData().failTimer >= 4) { this.blockFail(); getData().failTimer = 0; sendStuff(); - } else if ((getData().voltage > getMaxVoltage() && getMaxVoltage() > 0) || (getCurrent() > getMaxCurrent()&&getMaxCurrent()>0)) { + } else if ((getData().voltage > getMaxVoltage() && getMaxVoltage() > 0) || (getCurrent() > getMaxCurrent() && getMaxCurrent() > 0)) { getData().failTimer++; } } @@ -165,7 +165,7 @@ public interface IElectric { } - default BlockPos getBlockPos(){ + default BlockPos getBlockPos() { return BlockPos.of(getPos()); } @@ -173,21 +173,19 @@ public interface IElectric { alreadyChecked.add(BlockPos.of(getPos())); updateNextTick(); - if(this instanceof CableConnectorBlockEntity connectorBE){ - for(CableConnection connection : connectorBE.connections){ + if (this instanceof CableConnectorBlockEntity connectorBE) { + for (CableConnection connection : connectorBE.connections) { - if(getLevelAccessor().getBlockEntity(connection.blockPos1) instanceof CableConnectorBlockEntity be2 &&!alreadyChecked.contains(BlockPos.of(be2.getPos())) - ){ - // this.getLevelAccessor().setBlock(connection.blockPos1.above(2),Blocks.NETHER_BRICKS.defaultBlockState(),3); + if (getLevelAccessor().getBlockEntity(connection.blockPos1) instanceof CableConnectorBlockEntity be2 && !alreadyChecked.contains(BlockPos.of(be2.getPos())) + ) { be2.updateUnpowered(alreadyChecked); } } } for (Direction direction : Direction.values()) { - if(getLevelAccessor().getBlockEntity(BlockPos.of(getPos()).relative(direction)) instanceof IElectric be&&!alreadyChecked.contains(BlockPos.of(be.getPos()))){ + if (getLevelAccessor().getBlockEntity(BlockPos.of(getPos()).relative(direction)) instanceof IElectric be && !alreadyChecked.contains(BlockPos.of(be.getPos()))) { be.updateUnpowered(alreadyChecked); - // be.getLevelAccessor().setBlock(BlockPos.of(getPos()).above(2),Blocks.NETHERRACK.defaultBlockState(),3); } } } @@ -202,15 +200,8 @@ public interface IElectric { .color(Color.RED) .forGoggles(tooltip, 1); - // return true; } - - //CreateLang.text("Network Power ") - // .color(Color.RED) - // .forGoggles(tooltip, 1); - - if (voltageGeneration() > 0) { CreateLang.translate("multimeter.power_generated") .add(Component.literal(TFMGUtils.formatUnits(powerGeneration(), "W"))) @@ -267,7 +258,7 @@ public interface IElectric { default void updateNearbyNetworks(IElectric member) { if (true) return; - //if (member.getData().getsOutsidePower) { + for (Direction direction : Direction.values()) { if (member.getLevelAccessor().getBlockEntity(BlockPos.of(member.getPos()).relative(direction)) instanceof IElectric be && be.getData().getId() != member.getData().getId()) { @@ -275,7 +266,7 @@ public interface IElectric { be.updateNextTick(); } } - // } + } ElectricBlockValues getData(); @@ -310,7 +301,6 @@ public interface IElectric { } - default int getNetworkPowerGeneration() { int power = 0; for (IElectric member : getOrCreateElectricNetwork().members) @@ -339,7 +329,7 @@ public interface IElectric { } - default float resistance(){ + default float resistance() { return 0; } @@ -368,7 +358,6 @@ public interface IElectric { } - default int powerGeneration() { int powerGeneration = 0; @@ -376,15 +365,15 @@ public interface IElectric { for (Direction direction : Direction.values()) { if (hasElectricitySlot(direction)) { - if (getLevelAccessor().getBlockEntity(getBlockPos().relative(direction)) instanceof VoltageAlteringBlockEntity be&&be.canWork()) { + if (getLevelAccessor().getBlockEntity(getBlockPos().relative(direction)) instanceof VoltageAlteringBlockEntity be && be.canWork()) { if (be.getData().getId() != getData().getId()) if (be.getData().getVoltage() != 0) if (be.hasElectricitySlot(direction)) { powerGeneration = Math.max(powerGeneration, be.getPowerUsage()) + 1; - if(powerGeneration>be.getNetworkPowerGeneration()) { + if (powerGeneration > be.getNetworkPowerGeneration()) { powerGeneration = 0; - be.data.updatePowerNextTick=true; + be.data.updatePowerNextTick = true; } } } @@ -411,27 +400,14 @@ public interface IElectric { return getData().getVoltage() == 0 || resistance() == 0 ? 0 : ((float) getData().getVoltage() / (float) resistance()); } - default float getCableCurrent() { - float current = 0; - List groups = new ArrayList<>(); - for (IElectric member : getOrCreateElectricNetwork().members) { - if (member.canBeInGroups()) - if (!groups.contains(member.getData().group.id)) { - current += member.getCurrent(); - groups.add(member.getData().group.id); - } - } - return current; - } - - default void updateNextTick(){ + default void updateNextTick() { getData().updateNextTick = true; } default void updateNetwork() { getOrCreateElectricNetwork().updateNetwork(); if (getLevelAccessor() instanceof ServerLevel serverLevel) - CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(getBlockPos()),new NetworkUpdatePacket(BlockPos.of(getPos()))); + CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(getBlockPos()), new NetworkUpdatePacket(BlockPos.of(getPos()))); sendStuff(); } @@ -441,7 +417,6 @@ public interface IElectric { default void setVoltage(int newVoltage) { - if (canBeInGroups()) { getData().voltage = (int) (((float) resistance() / getData().group.resistance) * (float) getData().voltageSupply); return; @@ -450,12 +425,11 @@ public interface IElectric { } - default void setNetworkResistance(int newUsage){ + default void setNetworkResistance(int newUsage) { getData().networkResistance = newUsage; } - default void setNetwork(long network) { getData().electricalNetworkId = network; if (network != getPos()) diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/base/NetworkUpdatePacket.java b/src/main/java/com/drmangotea/tfmg/content/electricity/base/NetworkUpdatePacket.java index 73eba767..60604b46 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/base/NetworkUpdatePacket.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/base/NetworkUpdatePacket.java @@ -1,13 +1,11 @@ package com.drmangotea.tfmg.content.electricity.base; -import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity; import com.drmangotea.tfmg.registry.TFMGPackets; import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; import com.simibubi.create.foundation.networking.BlockEntityDataPacket; import io.netty.buffer.ByteBuf; import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; public class NetworkUpdatePacket extends BlockEntityDataPacket { @@ -20,22 +18,16 @@ public class NetworkUpdatePacket extends BlockEntityDataPacket public NetworkUpdatePacket(BlockPos pos) { super(pos); - - } - @Override protected void handlePacket(SmartBlockEntity blockEntity) { - if(blockEntity instanceof IElectric be) { + if (blockEntity instanceof IElectric be) { be.updateNetwork(); } - - } - @Override public PacketTypeProvider getTypeProvider() { return TFMGPackets.NETWORK_UPDATE; diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/base/UpdateInFrontPacket.java b/src/main/java/com/drmangotea/tfmg/content/electricity/base/UpdateInFrontPacket.java index cdddda93..3953637d 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/base/UpdateInFrontPacket.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/base/UpdateInFrontPacket.java @@ -7,7 +7,6 @@ import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; import com.simibubi.create.foundation.networking.BlockEntityDataPacket; import io.netty.buffer.ByteBuf; import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; public class UpdateInFrontPacket extends BlockEntityDataPacket { @@ -19,22 +18,17 @@ public class UpdateInFrontPacket extends BlockEntityDataPacket public UpdateInFrontPacket(BlockPos pos) { super(pos); - - } - @Override protected void handlePacket(SmartBlockEntity blockEntity) { - if(blockEntity instanceof ElectricDiodeBlockEntity be) { + if (blockEntity instanceof ElectricDiodeBlockEntity be) { be.updateInFrontNextTick(); } - } - @Override public PacketTypeProvider getTypeProvider() { return TFMGPackets.UPDATE_IN_FRONT_PACKET; diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectricBlockItem.java b/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectricBlockItem.java deleted file mode 100644 index 45a402d5..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectricBlockItem.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.drmangotea.tfmg.content.electricity.configuration_wrench; - -import com.drmangotea.tfmg.content.electricity.base.IElectric; -import com.drmangotea.tfmg.registry.TFMGDataComponents; -import net.minecraft.core.BlockPos; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.context.BlockPlaceContext; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; - -public class ElectricBlockItem extends BlockItem { - public ElectricBlockItem(Block p_40565_, Properties p_40566_) { - super(p_40565_, p_40566_); - } - - - - @Override - public InteractionResult place(BlockPlaceContext context) { - Level level = context.getLevel(); - BlockPos pos = context.getClickedPos(); - - if(level.getBlockEntity(pos) instanceof IElectric be&&be.canBeInGroups()){ - be.getData().group.id = context.getItemInHand().get(TFMGDataComponents.CONFIGURATION_WRENCH_NUMBER); - be.updateNextTick(); - be.sendStuff(); - } - - return super.place(context); - } -} diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchPacket.java b/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchPacket.java index f48a735e..80ce8761 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchPacket.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchPacket.java @@ -1,21 +1,10 @@ package com.drmangotea.tfmg.content.electricity.configuration_wrench; -import com.drmangotea.tfmg.TFMG; import com.drmangotea.tfmg.registry.TFMGDataComponents; import com.drmangotea.tfmg.registry.TFMGPackets; -import com.simibubi.create.content.equipment.zapper.PlacementPatterns; -import com.simibubi.create.content.equipment.zapper.terrainzapper.ConfigureWorldshaperPacket; -import com.simibubi.create.content.equipment.zapper.terrainzapper.PlacementOptions; -import com.simibubi.create.content.equipment.zapper.terrainzapper.TerrainBrushes; -import com.simibubi.create.content.equipment.zapper.terrainzapper.TerrainTools; -import com.simibubi.create.content.logistics.stockTicker.StockKeeperCategoryEditPacket; -import io.netty.buffer.ByteBuf; -import net.createmod.catnip.codecs.stream.CatnipLargerStreamCodecs; import net.createmod.catnip.codecs.stream.CatnipStreamCodecs; import net.createmod.catnip.net.base.ServerboundPacketPayload; -import net.minecraft.core.BlockPos; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; @@ -29,11 +18,6 @@ public class ElectriciansWrenchPacket implements ServerboundPacketPayload { CatnipStreamCodecs.HAND, packet -> packet.hand, ElectriciansWrenchPacket::new ); - - - - - public final int group; public final InteractionHand hand; @@ -43,24 +27,23 @@ public class ElectriciansWrenchPacket implements ServerboundPacketPayload { } - @Override public void handle(ServerPlayer player) { - if (player == null) { - return; - } - ItemStack stack = player.getItemInHand(hand); - if (stack.getItem() instanceof ElectriciansWrenchItem) { - applyGroup(stack); - } + if (player == null) { + return; + } + ItemStack stack = player.getItemInHand(hand); + if (stack.getItem() instanceof ElectriciansWrenchItem) { + applyGroup(stack); + } } - public void applyGroup(ItemStack stack){ + public void applyGroup(ItemStack stack) { - stack.set(TFMGDataComponents.CONFIGURATION_WRENCH_NUMBER,group); + stack.set(TFMGDataComponents.CONFIGURATION_WRENCH_NUMBER, group); } @Override diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchScreen.java b/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchScreen.java index 3b230ce4..10042980 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchScreen.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/configuration_wrench/ElectriciansWrenchScreen.java @@ -70,14 +70,6 @@ public class ElectriciansWrenchScreen extends AbstractSimiScreen { public void addNumber() { group++; - // CompoundTag tag = wrench.getOrCreateTag(); -// - // int number = tag.getInt("Number"); - // tag.putInt("Number", number+1); -// - // ElectritiansWrenchPacket packet = new ElectritiansWrenchPacket(tag.getInt("Number"), hand); - // packet.applyGroup(wrench); - // TFMGPackets.getChannel().sendToServer(packet); } @Override @@ -95,16 +87,6 @@ public class ElectriciansWrenchScreen extends AbstractSimiScreen { public void substractNumber() { if (group > 0) group--; - - //CompoundTag tag = wrench.getOrCreateTag(); -// - //int number = tag.getInt("Number"); - //if(number>0) - // tag.putInt("Number", number-1); -// - //ElectritiansWrenchPacket packet = new ElectritiansWrenchPacket(tag.getInt("Number"), hand); - //packet.applyGroup(wrench); - //TFMGPackets.getChannel().sendToServer(packet); } public TFMGGuiTextures background() { diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cable_hub/CableHubBlock.java b/src/main/java/com/drmangotea/tfmg/content/electricity/connection/CableHubBlock.java similarity index 79% rename from src/main/java/com/drmangotea/tfmg/content/electricity/connection/cable_hub/CableHubBlock.java rename to src/main/java/com/drmangotea/tfmg/content/electricity/connection/CableHubBlock.java index 8ce4748e..fa137593 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cable_hub/CableHubBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/connection/CableHubBlock.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.electricity.connection.cable_hub; +package com.drmangotea.tfmg.content.electricity.connection; import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity; import com.drmangotea.tfmg.content.electricity.base.IElectric; @@ -11,7 +11,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -public class CableHubBlock extends Block implements IBE, IWrenchable { +public class CableHubBlock extends Block implements IBE, IWrenchable { public CableHubBlock(Properties p_49795_) { super(p_49795_); } @@ -26,11 +26,11 @@ public class CableHubBlock extends Block implements IBE, IW IBE.onRemove(state, level, pos, newState); } @Override - public Class getBlockEntityClass() { - return CableHubBlockEntity.class; + public Class getBlockEntityClass() { + return ElectricBlockEntity.class; } @Override - public BlockEntityType getBlockEntityType() { + public BlockEntityType getBlockEntityType() { return TFMGBlockEntities.CABLE_HUB.get(); } } diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cable_hub/CableHubBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cable_hub/CableHubBlockEntity.java deleted file mode 100644 index 2ff3b29a..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cable_hub/CableHubBlockEntity.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.drmangotea.tfmg.content.electricity.connection.cable_hub; - -import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockState; - -public class CableHubBlockEntity extends ElectricBlockEntity { - public CableHubBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { - super(type, pos, state); - } - - -} diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cables/CableConnection.java b/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cables/CableConnection.java index aa3994f7..b8d28198 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cables/CableConnection.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/connection/cables/CableConnection.java @@ -38,8 +38,6 @@ public class CableConnection { compoundTag.putDouble("Y2", pos2.y()); compoundTag.putDouble("Z2", pos2.z()); - //compoundTag.putLong("BlockPos1", blockPos1.asLong()); - //compoundTag.putLong("BlockPos2", blockPos2.asLong()); compoundTag.putLong("Pos", blockPos1.asLong()); @@ -59,8 +57,6 @@ public class CableConnection { CablePos pos1 = new CablePos(compoundTag.getDouble("X1"),compoundTag.getDouble("Y1"),compoundTag.getDouble("Z1")); CablePos pos2 = new CablePos(compoundTag.getDouble("X2"),compoundTag.getDouble("Y2"),compoundTag.getDouble("Z2")); - //BlockPos blockPos1 = BlockPos.of(compoundTag.getLong("BlockPos1")); - //BlockPos blockPos2 = BlockPos.of(compoundTag.getLong("BlockPos2")); BlockPos blockPos1 = BlockPos.of(compoundTag.getLong("Pos")); diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/debug/DebugCinderBlockItem.java b/src/main/java/com/drmangotea/tfmg/content/electricity/debug/DebugCinderBlockItem.java deleted file mode 100644 index b0437690..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/debug/DebugCinderBlockItem.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.drmangotea.tfmg.content.electricity.debug; - -import com.drmangotea.tfmg.TFMG; -import com.drmangotea.tfmg.base.TFMGUtils; -import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock; -import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity; -import com.drmangotea.tfmg.content.electricity.base.IElectric; -import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnection; -import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlockEntity; -import com.drmangotea.tfmg.content.engines.base.AbstractEngineBlockEntity; -import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerBlockEntity; -import com.drmangotea.tfmg.content.engines.types.AbstractSmallEngineBlockEntity; -import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineBlockEntity; -import com.drmangotea.tfmg.content.engines.types.regular_engine.RegularEngineBlockEntity; -import com.drmangotea.tfmg.content.machinery.metallurgy.blast_stove.BlastStoveBlockEntity; -import com.drmangotea.tfmg.content.machinery.metallurgy.casting_basin.CastingBasinBlockEntity; -import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenBlockEntity; -import com.drmangotea.tfmg.content.machinery.misc.concrete_hose.ConcreteHoseBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.FluidReservoir; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerBlockEntity; -import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity; -import com.drmangotea.tfmg.registry.TFMGFluids; -import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity; -import com.simibubi.create.content.kinetics.mixer.MechanicalMixerBlockEntity; -import net.minecraft.core.BlockPos; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.Level; - - -public class DebugCinderBlockItem extends Item { - public DebugCinderBlockItem(Properties p_41383_) { - super(p_41383_); - } - - @Override - public boolean isFoil(ItemStack pStack) { - return true; - } - - @Override - public InteractionResult useOn(UseOnContext context) { - - BlockPos pos = context.getClickedPos(); - Level level = context.getLevel(); - if (level.getBlockEntity(pos) instanceof SteelTankBlockEntity be) { - if(!context.getPlayer().isCrouching()) { - SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), true, false); - be.updateTemperature(); - TFMG.LOGGER.debug(String.valueOf(be.activeHeat)); - }else SteelTankBlock.updateTowerState(be.getLevel(), be.getBlockPos(), false, false); - } - return InteractionResult.PASS; - } -} diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/generators/GeneratorBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/electricity/generators/GeneratorBlockEntity.java index 918f4219..944b242d 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/generators/GeneratorBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/generators/GeneratorBlockEntity.java @@ -38,17 +38,7 @@ public class GeneratorBlockEntity extends KineticElectricBlockEntity { public void updateNetwork() { super.updateNetwork(); } -// - // @Override - // public float calculateStressApplied() { - // if(getData().voltageSupply == 0) - // return super.calculateStressApplied(); -// - // if(getNetworkResistance() ==0) - // return super.calculateStressApplied(); -// - // return (int)(Math.min(super.calculateStressApplied()+(getGeneratorLoad() * 0.01f), 1000)); - // } + @Override public void onSpeedChanged(float previousSpeed) { diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/generators/large_generator/RotorVisual.java b/src/main/java/com/drmangotea/tfmg/content/electricity/generators/large_generator/RotorVisual.java index edabc98b..0b5104f2 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/generators/large_generator/RotorVisual.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/generators/large_generator/RotorVisual.java @@ -52,9 +52,6 @@ public class RotorVisual extends KineticBlockEntityVisual impl .rotate(new Quaternionf().rotateTo(0, 1, 0, align.getStepX(), align.getStepY(), align.getStepZ())); - //wheel.rotateX((float) Math.PI/2); - //wheel.rotateY((float) Math.PI/2); - //wheel.rotateZ((float) Math.PI/2); baseTransform.set(wheel.pose); diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/lights/LightBulbBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/electricity/lights/LightBulbBlockEntity.java index f303c93b..20130193 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/lights/LightBulbBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/lights/LightBulbBlockEntity.java @@ -30,8 +30,6 @@ public class LightBulbBlockEntity extends ElectricBlockEntity { public DyeColor color= DyeColor.WHITE; - - public LightBulbBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); } @@ -64,15 +62,6 @@ public class LightBulbBlockEntity extends ElectricBlockEntity { notifyUpdate(); } - // @Override - // public int getMaxVoltage() { - // return 500; - // } -// - // @Override - // public int getMaxAmps() { - // return 5; - // } @Override public void blockFail() { @@ -80,15 +69,6 @@ public class LightBulbBlockEntity extends ElectricBlockEntity { TFMGUtils.playSound(level,getBlockPos(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS); } - //@Override - //public int getMaxVoltage() { - // return 500; - //} -// - //@Override - //public int getMaxCurrent() { - // return 4; - //} @Override public void setVoltage(int newVoltage) { diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/MultimeterOverlayRenderer.java b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/MultimeterOverlayRenderer.java index 2ad19ba6..d6bcf1e6 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/MultimeterOverlayRenderer.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/MultimeterOverlayRenderer.java @@ -98,17 +98,6 @@ public class MultimeterOverlayRenderer { ((IElectric)be).makeMultimeterTooltip(tooltip,isShifting); - // break early if goggle or hover returned false when present - // if ((!isElectricBlock)||!holdsMultimeter) { - // hoverTicks = 0; - // return; - // } -// -// - //if (tooltip.isEmpty()) { - // hoverTicks = 0; - // return; - //} PoseStack poseStack = graphics.pose(); poseStack.pushPose(); @@ -161,14 +150,6 @@ public class MultimeterOverlayRenderer { return; } - /* - * special handling for modernUI - * - * their tooltip handler causes the overlay to jiggle each frame, - * if the mouse is moving, guiScale is anything but 1 and exactPositioning is enabled - * - * this is a workaround to fix this behavior - */ MouseHandler mouseHandler = Minecraft.getInstance().mouseHandler; Window window = Minecraft.getInstance().getWindow(); double guiScale = window.getGuiScale(); diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlock.java b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlock.java index 6a5d49f9..9e3a6203 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlock.java @@ -64,17 +64,7 @@ public class VoltMeterBlock extends TFMGHorizontalDirectionalBlock implements IB return InteractionResult.SUCCESS; }); - //return onBlockEntityUse(level, pos, be -> { -// - // be.range = be.getRange() + 100; -// - // if(be.getRange() > 2000) - // be.range = 100; -// - // return InteractionResult.SUCCESS; -// -// - //}); + } diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlockEntity.java index 1c5e1e69..afeb6b74 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterBlockEntity.java @@ -84,7 +84,6 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl float targetAngle = Math.abs(value * 180); - // TFMG.LOGGER.debug(String.valueOf(value)); angle.chase(Math.min(Math.abs(targetAngle),180), 0.05f, LerpedFloat.Chaser.EXP); angle.tickChaser(); @@ -121,7 +120,6 @@ public class VoltMeterBlockEntity extends SmartBlockEntity implements IHaveGoggl HIGH_VOLTAGE("Voltage (High)", "V", 10000), CURRENT("Current", "A", 16), RESISTANCE("Resistance", "Ω", 500), - // HIGH_RESISTANCE("Resistance (High)", "Ω", 500), POWER("Power", "W", 5000), NETWORK_POWER_USAGE("Network Power Usage", "W", 50000), NETWORK_POWER_GENERATION("Network Power Generation", "W", 50000), diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterRenderer.java b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterRenderer.java index 71193fd3..66e8c691 100644 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterRenderer.java +++ b/src/main/java/com/drmangotea/tfmg/content/electricity/measurement/VoltMeterRenderer.java @@ -24,8 +24,6 @@ public class VoltMeterRenderer extends SafeBlockEntityRenderer { - - - public AccumulatorBlock(Properties p_49795_) { super(p_49795_); } @@ -82,7 +79,7 @@ public class AccumulatorBlock extends TFMGDirectionalBlock implements IBE, IVoltageChanger { - - public FuseBlock(Properties p_54120_) { - super(p_54120_); - } - @Override - public void onPlace(BlockState pState, Level level, BlockPos pos, BlockState pOldState, boolean pIsMoving) { - withBlockEntityDo(level,pos, IElectric::onPlaced); - } - @Override - public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) { - IBE.onRemove(state, level, pos, newState); - } - - - - @Override - public Class getBlockEntityClass() { - return FuseBlockEntity.class; - } - - @Override - public BlockEntityType getBlockEntityType() { - return TFMGBlockEntities.FUSE_BLOCK.get(); - } -} diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockEntity.java deleted file mode 100644 index cf164d14..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockEntity.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.drmangotea.tfmg.content.electricity.utilities.fuse_block; - -import com.drmangotea.tfmg.TFMG; -import com.drmangotea.tfmg.base.TFMGUtils; -import com.drmangotea.tfmg.content.electricity.base.IElectric; -import com.drmangotea.tfmg.content.electricity.base.UpdateInFrontPacket; -import com.drmangotea.tfmg.content.electricity.utilities.diode.ElectricDiodeBlockEntity; -import com.drmangotea.tfmg.registry.TFMGPackets; - -import com.simibubi.create.foundation.utility.CreateLang; -import net.createmod.catnip.platform.CatnipServices; -import net.minecraft.ChatFormatting; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.HolderLookup; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.sounds.SoundSource; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.block.DirectionalBlock; -import net.minecraft.world.level.block.HorizontalDirectionalBlock; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockState; - - -import java.util.List; - -import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING; - - -public class FuseBlockEntity extends ElectricDiodeBlockEntity { - - public ItemStack fuse = ItemStack.EMPTY; - - boolean testFuse = false; - - - public FuseBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { - super(type, pos, state); - } - - - - public void updateInFront() { - - if (level instanceof ServerLevel serverLevel) - CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(worldPosition),new UpdateInFrontPacket(BlockPos.of(getPos()))); - Direction facing = getBlockState().hasProperty(DirectionalBlock.FACING) ? getBlockState().getValue(DirectionalBlock.FACING) : getBlockState().getValue(FACING).getCounterClockWise(); - if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be && be.getData().getId() != data.getId()) { - if (be.hasElectricitySlot(facing.getOpposite())) { - be.updateNextTick(); - } - } - - sendStuff(); - setChanged(); - } - @Override - public float resistance() { - if(!hasFuse()) - return 0; - - Direction facing = getBlockState().getValue(FACING).getCounterClockWise(); - if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be && be.getData().getId() != data.getId()) { - if (be.hasElectricitySlot(facing.getOpposite())) - return Math.max(be.getNetworkResistance(), 0); - } - return 0; - } - - - //@Override - //public void onNetworkChanged(int oldVoltage, int oldPower) { - // super.onNetworkChanged(oldVoltage, oldPower); -// - // if (hasFuse() && getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) { - // blowFuse(); - // updateNetwork(); - // updateInFront(); -// - // } - // Direction facing = getBlockState().getValue(FACING).getCounterClockWise(); - // if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be) { -// - // if (hasFuse() && be.getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) { - // blowFuse(); - // updateNetwork(); - // updateInFront(); -// - // } - // } - //} - - - - //@Override - //public void setVoltage(int newVoltage) { - // super.setVoltage(newVoltage); - // Direction facing = getBlockState().getValue(FACING).getCounterClockWise(); - // if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be) { -// - // if (hasFuse() && be.getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) { - // blowFuse(); - // updateNetwork(); - // updateInFront(); -// - // } - // } - // if (hasFuse() && getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) { - // blowFuse(); - // updateNetwork(); - // updateInFront(); -// - // } - // testFuse = true; -// - //} -// - //public void testFuse(){ - // Direction facing = getBlockState().getValue(FACING).getCounterClockWise(); - // if (level.getBlockEntity(getBlockPos().relative(facing)) instanceof IElectric be) { -// - // if (hasFuse() && be.getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) { - // blowFuse(); - // updateNetwork(); - // updateInFront(); -// - // } - // } - // if (hasFuse() && getData().highestCurrent >= (float) fuse.getOrCreateTag().getInt("AmpRating")) { - // blowFuse(); - // updateNetwork(); - // updateInFront(); -// - // } - // testFuse = true; - //} - - @Override - public void tick() { - super.tick(); - - - //if(testFuse){ - // testFuse(); - // testFuse = false; - //} - - - Direction facing = getBlockState().getValue(FACING).getCounterClockWise(); - - - } - - @Override - public void updateNextTick() { - super.updateNextTick(); - } - - @Override - public int getOutputVoltage() { - return fuse.isEmpty() ? 0 : super.getOutputVoltage(); - } - - @Override - public int getOutputPower() { - return fuse.isEmpty() ? 0 : super.getOutputPower(); - } - - public boolean hasFuse(){ - return !fuse.isEmpty(); - } - - public void blowFuse(){ - level.playSound(null, getBlockPos(), SoundEvents.GLASS_BREAK, SoundSource.BLOCKS, 2.0F, - level.random.nextFloat() * 0.4F + 0.8F); - fuse = ItemStack.EMPTY; - TFMGUtils.spawnElectricParticles(level,getBlockPos()); - sendStuff(); - - } - - @Override - public boolean hasElectricitySlot(Direction direction) { - return direction == getBlockState().getValue(FACING).getClockWise(); - } - - @Override - public boolean addToTooltip(List tooltip, boolean isPlayerSneaking) { - - super.addToTooltip(tooltip, isPlayerSneaking); - return true; - } -// - // @Override - // protected void write(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) { - // super.write(compound,registries , clientPacket); - // compound.put("Fuse", fuse.serializeNBT()); - // } -// - // @Override - // protected void read(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) { - // super.read(compound,registries , clientPacket); - // fuse = ItemStack.of(compound.getCompound("Fuse")); - // } -} diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockRenderer.java b/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockRenderer.java deleted file mode 100644 index 1c7ddb62..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseBlockRenderer.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.drmangotea.tfmg.content.electricity.utilities.fuse_block; - -import com.drmangotea.tfmg.registry.TFMGPartialModels; -import com.mojang.blaze3d.vertex.PoseStack; -import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer; -import net.createmod.catnip.render.CachedBuffers; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; -import net.minecraft.core.Direction; -import net.minecraft.world.level.block.state.BlockState; - -import static com.simibubi.create.content.kinetics.base.HorizontalKineticBlock.HORIZONTAL_FACING; -import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING; - -public class FuseBlockRenderer extends SafeBlockEntityRenderer { - - public FuseBlockRenderer(BlockEntityRendererProvider.Context context){} - - @Override - protected void renderSafe(FuseBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) { - - BlockState blockState = be.getBlockState(); - - if(!be.fuse.isEmpty()) - CachedBuffers.partialFacing(TFMGPartialModels.FUSE, blockState, blockState.getValue(FACING).getOpposite()) - .light(light) - .renderInto(ms, bufferSource.getBuffer(RenderType.cutoutMipped())); - - - } -} diff --git a/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseItem.java b/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseItem.java deleted file mode 100644 index a026aca2..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/electricity/utilities/fuse_block/FuseItem.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.drmangotea.tfmg.content.electricity.utilities.fuse_block; - - -import com.simibubi.create.foundation.utility.CreateLang; -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.TooltipFlag; -import net.minecraft.world.level.Level; -import net.neoforged.api.distmarker.Dist; -import net.neoforged.api.distmarker.OnlyIn; - - -import java.util.List; - -public class FuseItem extends Item{ - - - public FuseItem(Properties p_41383_) { - super(p_41383_); - } - - -} diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveBlockEntity.java index d426318d..f33f20b3 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveBlockEntity.java @@ -52,8 +52,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave protected BlockPos controller; protected BlockPos lastKnownPos; public boolean updateConnectivity; - public int width; - public int height; private static final Object HotBlastRecipesKey = new Object(); private static final int SYNC_RATE = 8; protected int syncCooldown; @@ -266,8 +264,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave } public void refreshCapability() { - IFluidHandler oldCap = primaryCapability; - IFluidHandler oldSecondaryCap = secondaryCapability; primaryCapability = handlerForCapability(); secondaryCapability = handlerForSecondaryCapability(); invalidateCapabilities(); @@ -313,7 +309,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave controller = null; lastKnownPos = null; - if (compound.contains("LastKnownPos")) lastKnownPos = NbtUtils.readBlockPos(compound, "LastKnownPos").get(); if (compound.contains("Controller")) @@ -401,12 +396,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave .add(mb) .style(ChatFormatting.DARK_GRAY)) .forGoggles(tooltip, 1); - - - - - - return true; } @@ -439,31 +428,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave } - //@Nonnull - //@Override - //public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { - // if (!primaryCapability.isPresent()) - // refreshCapability(); - // if (!secondaryCapability.isPresent()) - // refreshCapability(); - // if(side==null) - // return LazyOptional.empty(); -// -// -// - // if (cap == ForgeCapabilities.FLUID_HANDLER) { - // if(side.getAxis() == Direction.Axis.Y) { - // return primaryCapability.cast(); - // }else - // if(getController().getY()==getBlockPos().getY()){ - // return secondaryCapability.cast(); - // } - // }else - // return super.getCapability(cap, side); -// - // return LazyOptional.empty(); - //} - public static void registerCapabilities(RegisterCapabilitiesEvent event) { event.registerBlockEntity( Capabilities.FluidHandler.BLOCK, @@ -491,13 +455,6 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave return primaryOutputInventory; } - public int getTotalTankSize() { - return width * width * height; - } - - public static int getMaxSize() { - return MAX_SIZE; - } public static int getCapacityMultiplier() { return AllConfigs.server().fluids.fluidTankCapacity.get() * 1000; @@ -518,31 +475,12 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave onFluidStackChanged(primaryOutputInventory.getFluid()); updateBoilerState(); setChanged(); - updateConnectivity = true; - //if(isController()) - // for (int yOffset = 0; yOffset < height; yOffset++) - // for (int xOffset = 0; xOffset < width; xOffset++) - // for (int zOffset = 0; zOffset < width; zOffset++) - // if (level.getBlockEntity( - // worldPosition.offset(xOffset, yOffset, zOffset)) instanceof BlastStoveBlockEntity fbe) - // fbe.refreshCapability(); + sendData(); setChanged(); } - @Override - public void setExtraData(@Nullable Object data) { - if (data instanceof Boolean) - window = (boolean) data; - } - - @Override - @Nullable - public Object getExtraData() { - return window; - } - @Override public Object modifyExtraData(Object data) { if (data instanceof Boolean windows) { @@ -563,42 +501,5 @@ public class BlastStoveBlockEntity extends FluidTankBlockEntity implements IHave return getMaxHeight(); return getMaxWidth(); } - - @Override - public int getMaxWidth() { - return MAX_SIZE; - } - - @Override - public int getHeight() { - return height; - } - - @Override - public void setHeight(int height) { - this.height = height; - } - - @Override - public int getWidth() { - return width; - } - - @Override - public void setWidth(int width) { - this.width = width; - } - - @Override - public boolean hasTank() { - return true; - } - - @Override - public void setTankSize(int tank, int blocks) { - applyFluidTankSize(blocks); - } - - } diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveItem.java b/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveItem.java index 5e0b506e..c9af0452 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveItem.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/metallurgy/blast_stove/BlastStoveItem.java @@ -92,7 +92,7 @@ public class BlastStoveItem extends BlockItem { if (controllerTE == null) return; - int width = controllerTE.width; + int width = controllerTE.getWidth(); if (width == 1) return; @@ -100,7 +100,7 @@ public class BlastStoveItem extends BlockItem { BlockPos startPos = face == Direction.DOWN ? controllerTE.getBlockPos() .below() : controllerTE.getBlockPos() - .above(controllerTE.height); + .above(controllerTE.getHeight()); if (startPos.getY() != pos.getY()) return; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/VerticalPlacementHelper.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/VerticalPlacementHelper.java deleted file mode 100644 index 49550e57..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/VerticalPlacementHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower; - -import com.drmangotea.tfmg.registry.TFMGBlocks; -import net.createmod.catnip.placement.IPlacementHelper; -import net.createmod.catnip.placement.PlacementOffset; -import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.BlockHitResult; - -import java.util.function.Predicate; - -@MethodsReturnNonnullByDefault -public abstract class VerticalPlacementHelper implements IPlacementHelper { - - protected final Predicate statePredicate; - - - - public VerticalPlacementHelper(Predicate statePredicate) { - this.statePredicate = statePredicate; - - - } - - public boolean matchesAxis(BlockState state, Direction.Axis axis) { - - return axis == Direction.Axis.Y; - } - - public int attachedPoles(Level world, BlockPos pos, Direction direction) { - BlockPos checkPos = pos.relative(direction); - BlockState state = world.getBlockState(checkPos); - int count = 0; - while (matchesAxis(state, direction.getAxis())) { - count++; - checkPos = checkPos.relative(direction); - state = world.getBlockState(checkPos); - } - return count; - } - - @Override - public Predicate getStatePredicate() { - return this.statePredicate; - } - - @Override - public PlacementOffset getOffset(Player player, Level world, BlockState state, BlockPos pos, BlockHitResult ray) { - - - - - BlockPos posToPlace = pos; - for(int i = 0;i<15;i++){ - posToPlace = posToPlace.below(); - - if(world.getBlockState(posToPlace).is(TFMGBlocks.INDUSTRIAL_PIPE.get())) - continue; - - if(!world.getBlockState(posToPlace).isAir()) { - return PlacementOffset.fail(); - - }else break; - - } - if(posToPlace!=pos) - return PlacementOffset.success(posToPlace, bState -> bState); - - - return PlacementOffset.fail(); - } -} \ No newline at end of file diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlock.java index a4e0c274..cadfdef5 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlock.java @@ -2,11 +2,15 @@ package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower. import com.drmangotea.tfmg.base.blocks.TFMGHorizontalDirectionalBlock; import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock; +import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenPacket; import com.drmangotea.tfmg.registry.TFMGBlockEntities; import com.simibubi.create.content.equipment.wrench.IWrenchable; import com.simibubi.create.foundation.block.IBE; +import net.createmod.catnip.platform.CatnipServices; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -18,16 +22,20 @@ public class DistillationControllerBlock extends TFMGHorizontalDirectionalBlock } @Override - public void onPlace(BlockState pState, Level pLevel, BlockPos pPos, BlockState pOldState, boolean pIsMoving) { - SteelTankBlock.updateTowerState(pLevel, pPos.relative(getFacing(pState).getOpposite()),true,false); + public void onPlace(BlockState pState, Level level, BlockPos pPos, BlockState pOldState, boolean pIsMoving) { + super.onPlace(pState,level,pPos,pOldState,pIsMoving); + SteelTankBlock.updateTowerState(level, pPos.relative(getFacing(pState).getOpposite()),true,false); + if (level instanceof ServerLevel serverLevel) + CatnipServices.NETWORK.sendToClientsTrackingChunk(serverLevel, new ChunkPos(pPos),new DistillationTowerPacket(pPos,pPos.relative(getFacing(pState).getOpposite()),true)); } @Override public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean pIsMoving) { - if (state.hasBlockEntity() && (!state.is(newState.getBlock()) || !newState.hasBlockEntity())) - world.removeBlockEntity(pos); - SteelTankBlock.updateTowerState(world, pos.relative(getFacing(state).getOpposite()),false,false); + + super.onRemove(state,world,pos,newState,pIsMoving); + IBE.onRemove(state,world,pos,newState); + } diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlockEntity.java index 7146f95c..6d5cf467 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationControllerBlockEntity.java @@ -2,6 +2,7 @@ package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower. import com.drmangotea.tfmg.TFMG; import com.drmangotea.tfmg.base.TFMGUtils; +import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock; import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity; import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlockEntity; import com.drmangotea.tfmg.mixin.accessor.FluidTankBlockEntityAccessor; @@ -18,13 +19,16 @@ import com.simibubi.create.foundation.recipe.RecipeFinder; import com.simibubi.create.foundation.utility.CreateLang; import net.createmod.catnip.animation.LerpedFloat; +import net.createmod.catnip.platform.CatnipServices; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -38,6 +42,8 @@ import net.neoforged.neoforge.fluids.capability.templates.FluidTank; import java.util.ArrayList; import java.util.List; +import static com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlock.getFacing; + public class DistillationControllerBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation { private static final Object DistillationRecipesKey = new Object(); @@ -45,6 +51,7 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen public DistillationRecipe recipe; LerpedFloat angle = LerpedFloat.angular(); + protected IFluidHandler fluidCapability; public final FluidTank tank = new SmartFluidTank(8000, this::onFluidStackChanged); @@ -62,41 +69,47 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen ); } + @Override + public void remove() { + super.remove(); + SteelTankBlock.updateTowerState(level, getBlockPos().relative(getFacing(getBlockState()).getOpposite()),false,false); + + } + @Override public void addBehaviours(List behaviours) { } - - @Override - public void tick() { - super.tick(); - + public void manageDialRendering(){ if (level.isClientSide) { angle.chase(180 * ((float) tank.getFluidAmount() / tank.getCapacity()), 0.2f, LerpedFloat.Chaser.EXP); angle.tickChaser(); } + } - // - ArrayList outputs = getOutputs(); - BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(DistillationControllerBlock.getFacing(getBlockState()).getOpposite())); - if (!(beBehind instanceof SteelTankBlockEntity be)) - return; - - - - if (outputs.isEmpty() || be.activeHeat == 0) - return; - /// - + public void findRecipe(ArrayList outputs){ if (recipe == null || !recipe.matches(tank, outputs.toArray().length)) { DistillationRecipe recipe = getMatchingRecipes(); - if (recipe != null) { this.recipe = recipe; sendData(); } } + } + + public void manageRecipe(){ + ArrayList outputs = getOutputs(); + BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(getFacing(getBlockState()).getOpposite())); + if (!(beBehind instanceof SteelTankBlockEntity be)) + return; + + + if (outputs.isEmpty() || be.activeHeat == 0) + return; + + findRecipe(outputs); + if (recipe == null) return; @@ -135,6 +148,14 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen numero++; } } + @Override + public void tick() { + super.tick(); + + manageDialRendering(); + manageRecipe(); + + } protected void onFluidStackChanged(FluidStack newFluidStack) { if (!hasLevel()) @@ -149,7 +170,7 @@ public class DistillationControllerBlockEntity extends SmartBlockEntity implemen @Override public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { - BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(DistillationControllerBlock.getFacing(getBlockState()).getOpposite())); + BlockEntity beBehind = level.getBlockEntity(getBlockPos().relative(getFacing(getBlockState()).getOpposite())); if (beBehind instanceof SteelTankBlockEntity be) { CreateLang.translate("goggles.distillation_tower.status") diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationTowerPacket.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationTowerPacket.java new file mode 100644 index 00000000..0b1ced60 --- /dev/null +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/controller/DistillationTowerPacket.java @@ -0,0 +1,47 @@ +package com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller; + + +import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock; +import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenBlockEntity; +import com.drmangotea.tfmg.registry.TFMGPackets; +import com.simibubi.create.compat.computercraft.AttachedComputerPacket; +import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; +import com.simibubi.create.foundation.networking.BlockEntityDataPacket; +import io.netty.buffer.ByteBuf; +import net.minecraft.core.BlockPos; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; + +public class DistillationTowerPacket extends BlockEntityDataPacket { + + public boolean assemble; + + public BlockPos posToUpdate; + + + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + BlockPos.STREAM_CODEC, packet -> packet.pos, + BlockPos.STREAM_CODEC, packet -> packet.posToUpdate, + ByteBufCodecs.BOOL, packet -> packet.assemble, + DistillationTowerPacket::new + ); + public DistillationTowerPacket(BlockPos pos,BlockPos posToUpdate,boolean assemble) { + super(pos); + this.assemble = assemble; + this.posToUpdate = posToUpdate; + } + + @Override + protected void handlePacket(SmartBlockEntity blockEntity) { + + if(blockEntity instanceof DistillationControllerBlockEntity be) { + SteelTankBlock.updateTowerState(be.getLevel(), posToUpdate, assemble, false); + } + + } + + @Override + public PacketTypeProvider getTypeProvider() { + return TFMGPackets.DISTILLATION_PACKET; + } +} diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/output/DistillationOutputBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/output/DistillationOutputBlockEntity.java index d2d8ee3d..de08f556 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/output/DistillationOutputBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/distillation_tower/output/DistillationOutputBlockEntity.java @@ -28,7 +28,9 @@ import net.neoforged.neoforge.fluids.capability.IFluidHandler; import net.neoforged.neoforge.fluids.capability.templates.FluidTank; import java.util.List; - +/** + this block doesn't do anything, it only holds fluids create in the distillation tower + */ public class DistillationOutputBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation { @@ -44,7 +46,7 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I @Override public void addBehaviours(List behaviours) { - mode = new ScrollOptionBehaviour(DistillationOutputMode.class, + mode = new ScrollOptionBehaviour<>(DistillationOutputMode.class, CreateLang.translateDirect("distillation_output.when_tank_is_full"), this, new DistillationOutputValueBox()); behaviours.add(mode); } @@ -64,13 +66,6 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I (be, context) -> be.fluidCapability ); } - //@Nonnull - //@Override - //public LazyOptional getCapability(@Nonnull Capability cap, Direction side) { - // if (cap == ForgeCapabilities.FLUID_HANDLER) - // return fluidCapability.cast(); - // return super.getCapability(cap, side); - //} @Override protected void read(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) { super.read(compound,registries , clientPacket); @@ -79,22 +74,15 @@ public class DistillationOutputBlockEntity extends SmartBlockEntity implements I } - @Override public void write(CompoundTag compound, HolderLookup.Provider registries, boolean clientPacket) { super.write(compound,registries,clientPacket); - compound.put("TankContent", tank.writeToNBT(registries,new CompoundTag())); } @Override public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { - - - return containedFluidTooltip(tooltip, isPlayerSneaking, - fluidCapability); - - + return containedFluidTooltip(tooltip, isPlayerSneaking, fluidCapability); } public static class DistillationOutputValueBox extends ValueBoxTransform.Sided { diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/FluidReservoir.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/FluidReservoir.java similarity index 94% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/FluidReservoir.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/FluidReservoir.java index 70539879..ea2ff489 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/FluidReservoir.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/FluidReservoir.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/PumpjackBaseBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/PumpjackBaseBlock.java similarity index 98% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/PumpjackBaseBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/PumpjackBaseBlock.java index 1afd8d4e..34cbebab 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/PumpjackBaseBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/PumpjackBaseBlock.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base; import com.drmangotea.tfmg.base.TFMGShapes; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/PumpjackBaseBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/PumpjackBaseBlockEntity.java similarity index 97% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/PumpjackBaseBlockEntity.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/PumpjackBaseBlockEntity.java index 5b51c211..0cdf78a8 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/PumpjackBaseBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/PumpjackBaseBlockEntity.java @@ -1,10 +1,10 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base; import com.drmangotea.tfmg.TFMG; import com.drmangotea.tfmg.base.TFMGUtils; import com.drmangotea.tfmg.config.TFMGConfigs; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlockEntity; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlockEntity; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlockEntity; import com.drmangotea.tfmg.registry.TFMGBlockEntities; import com.drmangotea.tfmg.registry.TFMGBlocks; import com.drmangotea.tfmg.registry.TFMGFluids; @@ -17,7 +17,6 @@ import com.simibubi.create.foundation.fluid.SmartFluidTank; import com.simibubi.create.foundation.utility.CreateLang; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -30,7 +29,6 @@ import net.neoforged.neoforge.fluids.FluidStack; import net.neoforged.neoforge.fluids.capability.IFluidHandler; import net.neoforged.neoforge.fluids.capability.templates.FluidTank; -import javax.annotation.Nonnull; import java.util.List; public class PumpjackBaseBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation { diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/TestSavedData.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/TestSavedData.java similarity index 97% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/TestSavedData.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/TestSavedData.java index 5945a74d..d602837a 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/TestSavedData.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/TestSavedData.java @@ -1,7 +1,6 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base; import com.drmangotea.tfmg.TFMG; -import com.simibubi.create.content.trains.RailwaySavedData; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.MinecraftServer; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/TestSavedDataManager.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/TestSavedDataManager.java similarity index 99% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/TestSavedDataManager.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/TestSavedDataManager.java index af0918e9..8eab6190 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/TestSavedDataManager.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/base/TestSavedDataManager.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base; import com.drmangotea.tfmg.TFMG; import com.drmangotea.tfmg.config.TFMGConfigs; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankBlock.java similarity index 95% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankBlock.java index 614b10dd..5c229b63 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankBlock.java @@ -1,7 +1,6 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank; -import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineBlock; import com.drmangotea.tfmg.registry.TFMGBlockEntities; import com.mojang.serialization.MapCodec; import com.simibubi.create.AllShapes; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankBlockEntity.java similarity index 99% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankBlockEntity.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankBlockEntity.java index e4f2be2e..3cfd74c6 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankBlockEntity.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank; import com.drmangotea.tfmg.content.machinery.misc.machine_input.MachineInputBlockEntity; import com.simibubi.create.content.kinetics.base.KineticBlockEntity; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankRenderer.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankRenderer.java similarity index 93% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankRenderer.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankRenderer.java index abd5ff44..def239db 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/crank/PumpjackCrankRenderer.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/crank/PumpjackCrankRenderer.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank; @@ -8,11 +8,9 @@ import com.drmangotea.tfmg.registry.TFMGPartialModels; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.simibubi.create.content.kinetics.base.KineticBlockEntity; import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer; import dev.engine_room.flywheel.lib.transform.TransformStack; import net.createmod.catnip.render.CachedBuffers; -import net.createmod.catnip.render.SuperByteBuffer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackBlock.java similarity index 57% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackBlock.java index e7c11ad5..002eadc5 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackBlock.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer; import com.drmangotea.tfmg.registry.TFMGBlockEntities; @@ -10,7 +10,6 @@ import net.createmod.catnip.data.Iterate; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -38,51 +37,11 @@ public class PumpjackBlock extends BearingBlock implements IBE getBlockEntityClass() { return PumpjackBlockEntity.class; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackBlockEntity.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackBlockEntity.java similarity index 97% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackBlockEntity.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackBlockEntity.java index 329825a1..345dd8c6 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackBlockEntity.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackBlockEntity.java @@ -1,11 +1,8 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerConnectorBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerConnectorBlock; -import com.drmangotea.tfmg.registry.TFMGBlocks; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlockEntity; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlockEntity; import com.drmangotea.tfmg.registry.TFMGTags; import com.simibubi.create.AllSoundEvents; import com.simibubi.create.content.contraptions.AbstractContraptionEntity; @@ -34,7 +31,7 @@ import net.minecraft.world.phys.AABB; import java.util.List; -import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlock.WIDE; +import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlock.WIDE; import static net.minecraft.world.level.block.DirectionalBlock.FACING; public class PumpjackBlockEntity extends GeneratingKineticBlockEntity diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackContraption.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackContraption.java similarity index 82% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackContraption.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackContraption.java index 685dc2b6..8c6127ca 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackContraption.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackContraption.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer; @@ -9,11 +9,6 @@ import com.simibubi.create.content.contraptions.bearing.BearingContraption; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; - - -import org.apache.commons.lang3.tuple.Pair; public class PumpjackContraption extends BearingContraption { diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackGenerator.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackGenerator.java similarity index 95% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackGenerator.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackGenerator.java index 3ef6bec2..5f4252a4 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackGenerator.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackGenerator.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer; import com.simibubi.create.content.contraptions.bearing.BearingBlock; import com.simibubi.create.foundation.data.SpecialBlockStateGen; @@ -10,7 +10,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.neoforged.neoforge.client.model.generators.ModelFile; -import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlock.WIDE; +import static com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlock.WIDE; import static com.simibubi.create.foundation.data.AssetLookup.partialBaseModel; public class PumpjackGenerator extends SpecialBlockStateGen { diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackRenderer.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackRenderer.java similarity index 97% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackRenderer.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackRenderer.java index f9ee5b64..aba3a97b 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/PumpjackRenderer.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/PumpjackRenderer.java @@ -1,12 +1,8 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity; -import com.drmangotea.tfmg.registry.TFMGPartialModels; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.simibubi.create.content.kinetics.base.KineticBlockEntity; import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer; -import net.createmod.catnip.render.CachedBuffers; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerConnectorBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerConnectorBlock.java similarity index 98% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerConnectorBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerConnectorBlock.java index 868ec3a2..a39c7f77 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerConnectorBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerConnectorBlock.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts; import com.drmangotea.tfmg.base.TFMGShapes; import com.mojang.serialization.MapCodec; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerHeadBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerHeadBlock.java similarity index 98% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerHeadBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerHeadBlock.java index 80813412..622331c8 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerHeadBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerHeadBlock.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts; import com.drmangotea.tfmg.base.TFMGShapes; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerPartBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerPartBlock.java similarity index 98% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerPartBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerPartBlock.java index b065eb44..749e4848 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/PumpjackHammerPartBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/PumpjackHammerPartBlock.java @@ -1,4 +1,4 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts; import com.drmangotea.tfmg.base.TFMGShapes; @@ -11,7 +11,6 @@ import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerConnectorBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerConnectorBlock.java similarity index 89% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerConnectorBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerConnectorBlock.java index b62cea64..77f3f2b3 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerConnectorBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerConnectorBlock.java @@ -1,9 +1,9 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large; import com.drmangotea.tfmg.base.TFMGShapes; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerConnectorBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerConnectorBlock; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerHeadBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerHeadBlock.java similarity index 89% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerHeadBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerHeadBlock.java index 75bf99ab..54444021 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerHeadBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerHeadBlock.java @@ -1,8 +1,8 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large; import com.drmangotea.tfmg.base.TFMGShapes; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerHeadBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerHeadBlock; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerPartBlock.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerPartBlock.java similarity index 89% rename from src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerPartBlock.java rename to src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerPartBlock.java index fde78060..63e77a06 100644 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/hammer/parts/large/LargePumpjackHammerPartBlock.java +++ b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/hammer/parts/large/LargePumpjackHammerPartBlock.java @@ -1,8 +1,8 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large; +package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large; import com.drmangotea.tfmg.base.TFMGShapes; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerPartBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerPartBlock; import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.state.BlockState; diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositItem.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositItem.java deleted file mode 100644 index ec38ac45..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositItem.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base; - -import com.drmangotea.tfmg.config.TFMGConfigs; -import com.drmangotea.tfmg.registry.TFMGBlocks; -import net.minecraft.core.BlockPos; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.Level; - -public class DepositItem extends Item { - public DepositItem(Properties p_41383_) { - super(p_41383_); - } - - @Override - public boolean isFoil(ItemStack p_41453_) { - return true; - } - - @Override - public InteractionResult useOn(UseOnContext context) { - Level level = context.getLevel(); - BlockPos pos = context.getClickedPos(); - if(level.getServer()==null) - return InteractionResult.PASS; - if(level.getBlockState(pos).is(TFMGBlocks.OIL_DEPOSIT.get())) { - //DepositSavedData data = DepositSavedData.load(level.getServer()); - // if(data.getReservoirFor(pos.asLong())!=null) { - // data.getReservoirFor(pos.asLong()).oilReserves = level.getRandom().nextInt(1000, TFMGConfigs.common().deposits.depositMaxReserves.get()); - // return InteractionResult.SUCCESS; - // } - } - return InteractionResult.PASS; - } -} diff --git a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositSavedData.java b/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositSavedData.java deleted file mode 100644 index 1fd0beea..00000000 --- a/src/main/java/com/drmangotea/tfmg/content/machinery/oil_processing/pumpjack/pumpjack/base/DepositSavedData.java +++ /dev/null @@ -1 +0,0 @@ -package com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base; \ No newline at end of file diff --git a/src/main/java/com/drmangotea/tfmg/recipes/IndustrialBlastingRecipe.java b/src/main/java/com/drmangotea/tfmg/recipes/IndustrialBlastingRecipe.java index 26bfe983..e4914fb6 100644 --- a/src/main/java/com/drmangotea/tfmg/recipes/IndustrialBlastingRecipe.java +++ b/src/main/java/com/drmangotea/tfmg/recipes/IndustrialBlastingRecipe.java @@ -30,10 +30,6 @@ import java.util.function.Function; public class IndustrialBlastingRecipe extends ProcessingRecipe { - - - - public int hotAirUsage; public IndustrialBlastingRecipe(IndustrialBlastingRecipeParams params) { @@ -72,15 +68,6 @@ public class IndustrialBlastingRecipe extends ProcessingRecipe extends ProcessingRecipe.Factory { @@ -138,7 +125,4 @@ public class IndustrialBlastingRecipe extends ProcessingRecipe { - - - public List machines; public List allowedVatTypes; public int minSize; @@ -46,8 +43,6 @@ public class VatMachineRecipe extends ProcessingRecipe { .addItemStack(recipe.getResultItem(registryAccess)); addFluidSlot(builder,15,20,recipe.getFluidIngredients().get(0)); - //builder - // .addSlot(RecipeIngredientRole.INPUT, 15, 20) - // .setBackground(getRenderedSlot(), -1, -1) - // .addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidIngredients().get(0).getMatchingFluidStacks())) - // .addRichTooltipCallback(addFluidTooltip(recipe.getFluidIngredients().get(0).getRequiredAmount())); -// + } diff --git a/src/main/java/com/drmangotea/tfmg/recipes/jei/ChemicalVatCategory.java b/src/main/java/com/drmangotea/tfmg/recipes/jei/ChemicalVatCategory.java index ad5571d4..bb65b5ab 100644 --- a/src/main/java/com/drmangotea/tfmg/recipes/jei/ChemicalVatCategory.java +++ b/src/main/java/com/drmangotea/tfmg/recipes/jei/ChemicalVatCategory.java @@ -33,9 +33,6 @@ public class ChemicalVatCategory extends CreateRecipeCategory } public void setRecipe(IRecipeLayoutBuilder builder, VatMachineRecipe recipe, IFocusGroup focuses) { - //builder.addSlot(RecipeIngredientRole.INPUT, 15, 9).setBackground(getRenderedSlot(), -1, -1).addIngredients(recipe.getIngredients().get(0)); - //builder.addSlot(RecipeIngredientRole.OUTPUT, 140, 28).setBackground(getRenderedSlot(), -1, -1).addItemStack(recipe.getResultItem(Minecraft.getInstance().level.registryAccess())); - int fluidCount = recipe.getFluidIngredients().size(); int pos = 55; int width = ((fluidCount) * 20) / 2; diff --git a/src/main/java/com/drmangotea/tfmg/recipes/jei/DistillationCategory.java b/src/main/java/com/drmangotea/tfmg/recipes/jei/DistillationCategory.java index ad5e82aa..2fe5895e 100644 --- a/src/main/java/com/drmangotea/tfmg/recipes/jei/DistillationCategory.java +++ b/src/main/java/com/drmangotea/tfmg/recipes/jei/DistillationCategory.java @@ -17,15 +17,10 @@ import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault public class DistillationCategory extends CreateRecipeCategory { - - public DistillationCategory(Info info) { super(info); } - - - @Override public void setRecipe(IRecipeLayoutBuilder builder, DistillationRecipe recipe, IFocusGroup focuses) { FluidIngredient fluidIngredient=recipe.getInputFluid(); @@ -34,13 +29,6 @@ public class DistillationCategory extends CreateRecipeCategory { super(info); } - @Override public void setRecipe(IRecipeLayoutBuilder builder, HotBlastRecipe recipe, IFocusGroup focuses) { @@ -32,31 +31,6 @@ public class HotBlastCategory extends CreateRecipeCategory { addFluidSlot(builder,105,51,recipe.getFluidResults().get(0)); addFluidSlot(builder,105,75,recipe.getFluidResults().get(1)); - //builder - // .addSlot(RecipeIngredientRole.INPUT, 18, 52) - // .setBackground(getRenderedSlot(), -1, -1) - // .addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidIngredients().get(0).getMatchingFluidStacks())) - // .addRichTooltipCallback(addFluidTooltip(recipe.getFluidIngredients().get(0).getRequiredAmount())); -// - //builder - // .addSlot(RecipeIngredientRole.INPUT, 18, 74) - // .setBackground(getRenderedSlot(), -1, -1) - // .addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidIngredients().get(1).getMatchingFluidStacks())) - // .addRichTooltipCallback(addFluidTooltip(recipe.getFluidIngredients().get(1).getRequiredAmount())); -// - ///// / - //builder - // .addSlot(RecipeIngredientRole.OUTPUT, 105, 51) - // .setBackground(getRenderedSlot(), -1, -1) - // .addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(0))) - // .addRichTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(0).getAmount())); -// - //builder - // .addSlot(RecipeIngredientRole.OUTPUT, 105, 75) - // .setBackground(getRenderedSlot(), -1, -1) - // .addIngredient(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getFluidResults().get(1))) - // .addRichTooltipCallback(addFluidTooltip(recipe.getFluidResults().get(1).getAmount())); - } diff --git a/src/main/java/com/drmangotea/tfmg/recipes/jei/IndustrialBlastingCategory.java b/src/main/java/com/drmangotea/tfmg/recipes/jei/IndustrialBlastingCategory.java index cadb9a5a..00adb319 100644 --- a/src/main/java/com/drmangotea/tfmg/recipes/jei/IndustrialBlastingCategory.java +++ b/src/main/java/com/drmangotea/tfmg/recipes/jei/IndustrialBlastingCategory.java @@ -27,7 +27,6 @@ public class IndustrialBlastingCategory extends CreateRecipeCategory { AllGuiTextures.JEI_DOWN_ARROW.render(graphics, 43, 4); this.polarizer.draw(graphics, 48, 27); - } public static class AssemblyPolarizing extends SequencedAssemblySubCategory { diff --git a/src/main/java/com/drmangotea/tfmg/recipes/jei/TFMGJei.java b/src/main/java/com/drmangotea/tfmg/recipes/jei/TFMGJei.java index 3e743a3d..fc147617 100644 --- a/src/main/java/com/drmangotea/tfmg/recipes/jei/TFMGJei.java +++ b/src/main/java/com/drmangotea/tfmg/recipes/jei/TFMGJei.java @@ -196,14 +196,6 @@ public class TFMGJei implements IModPlugin { Collection potionFluids = new ArrayList<>(potions.size() * 3); Set>> visitedEffects = new HashSet<>(); for (Holder.Reference potion : potions) { - // @goshante: Ingame potion fluids always have Bottle tag that specifies - // to what bottle type this potion belongs - // Potion fluid without this tag wouldn't be recognized by other mods - -// for (PotionFluid.BottleType bottleType : PotionFluid.BottleType.values()) { -// FluidStack potionFluid = PotionFluid.of(1000, new PotionContents(potion), bottleType); -// potionFluids.add(potionFluid); -// } PotionContents potionContents = new PotionContents(potion); @@ -302,6 +294,5 @@ public class TFMGJei implements IModPlugin { TFMGJei.runtime = runtime; } - } diff --git a/src/main/java/com/drmangotea/tfmg/recipes/jei/WindingCategory.java b/src/main/java/com/drmangotea/tfmg/recipes/jei/WindingCategory.java index afd12515..615b35b5 100644 --- a/src/main/java/com/drmangotea/tfmg/recipes/jei/WindingCategory.java +++ b/src/main/java/com/drmangotea/tfmg/recipes/jei/WindingCategory.java @@ -32,8 +32,6 @@ public class WindingCategory extends CreateRecipeCategory { super(info); } - - public void setRecipe(IRecipeLayoutBuilder builder, WindingRecipe recipe, IFocusGroup focuses) { builder.addSlot(RecipeIngredientRole.INPUT, 15, 9).setBackground(getRenderedSlot(), -1, -1).addIngredients(recipe.getIngredients().get(0)); @@ -87,7 +85,6 @@ public class WindingCategory extends CreateRecipeCategory { this.windingMachine.draw(graphics, this.getWidth() / 2, 0,coilColor,false); ms.popPose(); - } } } \ No newline at end of file diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGBlockEntities.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGBlockEntities.java index fffdf2fa..2cb3a563 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGBlockEntities.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGBlockEntities.java @@ -7,15 +7,13 @@ import com.drmangotea.tfmg.content.decoration.doors.TFMGSlidingDoorRenderer; import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelBlockEntity; import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelRenderer; import com.drmangotea.tfmg.content.decoration.flywheels.TFMGFlywheelVisual; -import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipeBlock; import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipeBlockEntity; -import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipeEntry; import com.drmangotea.tfmg.content.decoration.pipes.TFMGPipes; import com.drmangotea.tfmg.content.decoration.tanks.TFMGFluidTankBlockEntity; import com.drmangotea.tfmg.content.decoration.tanks.TFMGFluidTankRenderer; import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelFluidTankRenderer; import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlockEntity; -import com.drmangotea.tfmg.content.electricity.connection.cable_hub.CableHubBlockEntity; +import com.drmangotea.tfmg.content.electricity.base.ElectricBlockEntity; import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlockEntity; import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorRenderer; import com.drmangotea.tfmg.content.electricity.connection.copycat_cable.CopycatCableBlockEntity; @@ -50,6 +48,8 @@ import com.drmangotea.tfmg.content.electricity.utilities.potentiometer.Potentiom import com.drmangotea.tfmg.content.electricity.utilities.resistor.ResistorBlockEntity; import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplayBlockEntity; import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplayRenderer; +import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplaySource; +import com.drmangotea.tfmg.content.electricity.utilities.segmented_display.SegmentedDisplayTarget; import com.drmangotea.tfmg.content.electricity.utilities.traffic_light.TrafficLightBlockEntity; import com.drmangotea.tfmg.content.electricity.utilities.traffic_light.TrafficLightRenderer; import com.drmangotea.tfmg.content.electricity.utilities.transformer.TransformerBlockEntity; @@ -59,7 +59,6 @@ import com.drmangotea.tfmg.content.engines.base.EngineRenderer; import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerBlockEntity; import com.drmangotea.tfmg.content.engines.engine_controller.EngineControllerRenderer; import com.drmangotea.tfmg.content.engines.engine_gearbox.EngineGearboxBlockEntity; -import com.drmangotea.tfmg.content.engines.engine_gearbox.EngineGearboxRenderer; import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineBlockEntity; import com.drmangotea.tfmg.content.engines.types.large_engine.LargeEngineRenderer; import com.drmangotea.tfmg.content.engines.types.radial_engine.RadialEngineBlockEntity; @@ -90,11 +89,11 @@ import com.drmangotea.tfmg.content.machinery.misc.winding_machine.WindingMachine import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlockEntity; import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerRenderer; import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankRenderer; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlockEntity; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackRenderer; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlockEntity; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlockEntity; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankRenderer; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlockEntity; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackRenderer; import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerBlockEntity; import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerRenderer; import com.drmangotea.tfmg.content.machinery.vat.base.VatBlockEntity; @@ -114,7 +113,6 @@ import com.simibubi.create.content.fluids.pipes.valve.FluidValveRenderer; import com.simibubi.create.content.fluids.pipes.valve.FluidValveVisual; import com.simibubi.create.content.fluids.pump.PumpBlockEntity; import com.simibubi.create.content.fluids.pump.PumpRenderer; -import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity; import com.simibubi.create.content.kinetics.base.*; import com.simibubi.create.content.kinetics.gearbox.GearboxBlockEntity; import com.simibubi.create.content.kinetics.gearbox.GearboxRenderer; @@ -123,13 +121,6 @@ import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockEn import com.simibubi.create.content.kinetics.simpleRelays.SimpleKineticBlockEntity; import com.simibubi.create.foundation.blockEntity.renderer.SmartBlockEntityRenderer; import com.tterrag.registrate.util.entry.BlockEntityEntry; -import com.tterrag.registrate.util.entry.BlockEntry; -import com.tterrag.registrate.util.nullness.NonNullSupplier; -import net.minecraft.world.level.block.Block; - -import java.util.List; -import java.util.stream.Collector; -import java.util.stream.Collectors; import static com.drmangotea.tfmg.TFMG.REGISTRATE; @@ -382,11 +373,6 @@ public class TFMGBlockEntities { .validBlocks(TFMGBlocks.TRANSFORMER) .renderer(() -> TransformerRenderer::new) .register(); - public static final BlockEntityEntry FUSE_BLOCK = REGISTRATE - .blockEntity("fuse_block", FuseBlockEntity::new) - // .validBlocks(TFMGBlocks.FUSE_BLOCK) - .renderer(() -> FuseBlockRenderer::new) - .register(); public static final BlockEntityEntry SEGMENTED_DISPLAY = REGISTRATE .blockEntity("segmented_display", SegmentedDisplayBlockEntity::new) .validBlocks(TFMGBlocks.SEGMENTED_DISPLAY) @@ -498,8 +484,8 @@ public class TFMGBlockEntities { - public static final BlockEntityEntry CABLE_HUB = REGISTRATE - .blockEntity("cable_hub", CableHubBlockEntity::new) + public static final BlockEntityEntry CABLE_HUB = REGISTRATE + .blockEntity("cable_hub", ElectricBlockEntity::new) .validBlocks(TFMGBlocks.BRASS_CABLE_HUB, TFMGBlocks.COPPER_CABLE_HUB, TFMGBlocks.STEEL_CABLE_HUB, diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGBlocks.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGBlocks.java index 27826107..24886fba 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGBlocks.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGBlocks.java @@ -22,7 +22,7 @@ import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelFluidTankModel; import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankBlock; import com.drmangotea.tfmg.content.decoration.tanks.TFMGTankGenerator; import com.drmangotea.tfmg.content.decoration.tanks.steel.SteelTankItem; -import com.drmangotea.tfmg.content.electricity.connection.cable_hub.CableHubBlock; +import com.drmangotea.tfmg.content.electricity.connection.CableHubBlock; import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorBlock; import com.drmangotea.tfmg.content.electricity.connection.cables.CableConnectorGenerator; import com.drmangotea.tfmg.content.electricity.connection.copycat_cable.CopycatCableBlock; @@ -49,7 +49,6 @@ import com.drmangotea.tfmg.content.electricity.utilities.diode.EncasedDiodeBlock import com.drmangotea.tfmg.content.electricity.utilities.electric_motor.ElectricMotorBlock; import com.drmangotea.tfmg.content.electricity.utilities.electric_pump.ElectricPumpBlock; import com.drmangotea.tfmg.content.electricity.utilities.electric_switch.ElectricSwitchBlock; -import com.drmangotea.tfmg.content.electricity.utilities.fuse_block.FuseBlock; import com.drmangotea.tfmg.content.electricity.utilities.polarizer.PolarizerBlock; import com.drmangotea.tfmg.content.electricity.utilities.potentiometer.PotentiometerBlock; import com.drmangotea.tfmg.content.electricity.utilities.potentiometer.EncasedPotentiometerBlock; @@ -97,23 +96,21 @@ import com.drmangotea.tfmg.content.machinery.misc.winding_machine.WindingMachine import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.IndustrialPipeBlock; import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationControllerBlock; import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.output.DistillationOutputBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.PumpjackBaseBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.crank.PumpjackCrankBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.PumpjackGenerator; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerConnectorBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerHeadBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.PumpjackHammerPartBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerConnectorBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerHeadBlock; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.hammer.parts.large.LargePumpjackHammerPartBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.base.PumpjackBaseBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.crank.PumpjackCrankBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.PumpjackGenerator; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerConnectorBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerHeadBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.PumpjackHammerPartBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large.LargePumpjackHammerConnectorBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large.LargePumpjackHammerHeadBlock; +import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.hammer.parts.large.LargePumpjackHammerPartBlock; import com.drmangotea.tfmg.content.machinery.oil_processing.surface_scanner.SurfaceScannerBlock; import com.drmangotea.tfmg.content.machinery.vat.base.VatBlock; import com.drmangotea.tfmg.content.machinery.vat.base.VatGenerator; import com.drmangotea.tfmg.content.machinery.vat.electrode_holder.ElectrodeHolderBlock; import com.drmangotea.tfmg.content.machinery.vat.industrial_mixer.IndustrialMixerBlock; -import com.simibubi.create.AllItems; -import com.simibubi.create.AllMountedStorageTypes; import com.simibubi.create.AllTags; import com.simibubi.create.api.stress.BlockStressValues; import com.simibubi.create.content.contraptions.bearing.StabilizedBearingMovementBehaviour; @@ -130,7 +127,6 @@ import com.simibubi.create.content.kinetics.motor.CreativeMotorGenerator; import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockModel; import com.simibubi.create.foundation.block.connected.HorizontalCTBehaviour; import com.simibubi.create.foundation.data.*; -import com.tterrag.registrate.providers.loot.RegistrateBlockLootTables; import com.tterrag.registrate.util.DataIngredient; import com.tterrag.registrate.util.entry.BlockEntry; import net.minecraft.client.renderer.RenderType; @@ -179,7 +175,7 @@ public class TFMGBlocks { //------------------ENGINES------------------// public static final BlockEntry TURBINE_ENGINE = REGISTRATE.block("turbine_engine", TurbineEngineBlock::new) - .initialProperties(() -> Blocks.IRON_BLOCK) + .initialProperties(SharedProperties::softMetal) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .properties(BlockBehaviour.Properties::noOcclusion) .addLayer(() -> RenderType::cutoutMipped) @@ -189,7 +185,7 @@ public class TFMGBlocks { .transform(customItemModel()) .register(); public static final BlockEntry REGULAR_ENGINE = REGISTRATE.block("regular_engine", RegularEngineBlock::new) - .initialProperties(() -> Blocks.IRON_BLOCK) + .initialProperties(SharedProperties::softMetal) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .properties(BlockBehaviour.Properties::noOcclusion) .onRegister(connectedTextures(() -> new EngineCTBehavior(TFMGSpriteShifts.REGULAR_ENGINE_TOP, TFMGSpriteShifts.REGULAR_ENGINE_BOTTOM, TFMGSpriteShifts.REGULAR_ENGINE_SIDE))) @@ -199,7 +195,7 @@ public class TFMGBlocks { .transform(customItemModel()) .register(); public static final BlockEntry RADIAL_ENGINE = REGISTRATE.block("radial_engine", RadialEngineBlock::new) - .initialProperties(() -> Blocks.IRON_BLOCK) + .initialProperties(SharedProperties::softMetal) .properties(p -> p.sound(SoundType.NETHERITE_BLOCK)) .properties(BlockBehaviour.Properties::noOcclusion) .transform(TFMGStress.setCapacity(100)) @@ -774,7 +770,7 @@ public class TFMGBlocks { //------------------METALLURGY------------------// public static final BlockEntry BLAST_FURNACE_OUTPUT = REGISTRATE.block("blast_furnace_output", BlastFurnaceOutputBlock::new) .initialProperties(() -> Blocks.NETHER_BRICKS) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .blockstate(BlockStateGen.horizontalBlockProvider(true)) .tag(BlockTags.NEEDS_STONE_TOOL) @@ -784,7 +780,7 @@ public class TFMGBlocks { public static final BlockEntry BLAST_FURNACE_HATCH = REGISTRATE.block("blast_furnace_hatch", BlastFurnaceHatchBlock::new) .initialProperties(() -> Blocks.NETHER_BRICKS) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .tag(TFMGTags.TFMGBlockTags.BLAST_FURNACE_WALL.tag) .tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_WALL.tag) @@ -793,7 +789,7 @@ public class TFMGBlocks { .register(); public static final BlockEntry FIREPROOF_BRICKS = REGISTRATE.block("fireproof_bricks", Block::new) .initialProperties(() -> Blocks.NETHER_BRICKS) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .tag(TFMGTags.TFMGBlockTags.BLAST_FURNACE_WALL.tag) .tag(BlockTags.NEEDS_STONE_TOOL) @@ -803,7 +799,7 @@ public class TFMGBlocks { public static final BlockEntry REINFORCED_FIREPROOF_BRICKS = REGISTRATE.block("reinforced_fireproof_bricks", Block::new) .initialProperties(() -> Blocks.NETHER_BRICKS) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_WALL.tag) .tag(BlockTags.NEEDS_STONE_TOOL) @@ -813,7 +809,7 @@ public class TFMGBlocks { public static final BlockEntry BLAST_FURNACE_REINFORCEMENT = REGISTRATE.block("blast_furnace_reinforcement", Block::new) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.BLAST_FURNACE_REINFORCEMENT))) .tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_SUPPORT.tag) @@ -824,7 +820,7 @@ public class TFMGBlocks { public static final BlockEntry BLAST_FURNACE_REINFORCEMENT_WALL = REGISTRATE.block("blast_furnace_reinforcement_wall", BlastFurnaceReinforcementWallBlock::new) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .properties(BlockBehaviour.Properties::noOcclusion) .onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.BLAST_FURNACE_REINFORCEMENT))) @@ -835,7 +831,7 @@ public class TFMGBlocks { // public static final BlockEntry RUSTED_BLAST_FURNACE_REINFORCEMENT = REGISTRATE.block("rusted_blast_furnace_reinforcement", Block::new) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.RUSTED_BLAST_FURNACE_REINFORCEMENT))) .tag(TFMGTags.TFMGBlockTags.REINFORCED_BLAST_FURNACE_SUPPORT.tag) @@ -846,7 +842,7 @@ public class TFMGBlocks { public static final BlockEntry RUSTED_BLAST_FURNACE_REINFORCEMENT_WALL = REGISTRATE.block("rusted_blast_furnace_reinforcement_wall", BlastFurnaceReinforcementWallBlock::new) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .properties(BlockBehaviour.Properties::noOcclusion) .onRegister(connectedTextures(() -> new HorizontalCTBehaviour(TFMGSpriteShifts.RUSTED_BLAST_FURNACE_REINFORCEMENT))) @@ -858,7 +854,7 @@ public class TFMGBlocks { public static final BlockEntry FIREPROOF_BRICK_REINFORCEMENT = REGISTRATE.block("fireproof_brick_reinforcement", WallBlock::new) .initialProperties(() -> Blocks.NETHER_BRICKS) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(BlockBehaviour.Properties::requiresCorrectToolForDrops) .transform(pickaxeOnly()) .tag(BlockTags.WALLS) .tag(TFMGTags.TFMGBlockTags.BLAST_FURNACE_SUPPORT.tag) @@ -878,7 +874,7 @@ public class TFMGBlocks { .item() .transform(customItemModel()) .register(); - @SuppressWarnings("'addLayer(java.util.function.Supplier>)' is deprecated and marked for removal ") + public static final BlockEntry BLAST_STOVE = REGISTRATE.block("blast_stove", BlastStoveBlock::new) .initialProperties(SharedProperties::copperMetal) @@ -892,9 +888,8 @@ public class TFMGBlocks { public static final BlockEntry CASTING_BASIN = REGISTRATE.block("casting_basin", CastingBasinBlock::new) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.requiresCorrectToolForDrops()) + .properties(p -> p.requiresCorrectToolForDrops().noOcclusion()) .transform(pickaxeOnly()) - .properties(BlockBehaviour.Properties::noOcclusion) .blockstate(BlockStateGen.horizontalBlockProvider(true)) .item() .transform(customItemModel()) diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGCableTypes.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGCableTypes.java index f70e2734..60ebee3b 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGCableTypes.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGCableTypes.java @@ -39,7 +39,7 @@ public class TFMGCableTypes { .transform(TFMGResistivity.setResistivity(1f)) .register(); - // Why is this a thing? I'll leave it her in case you do need it. - Krystal + // Why is this a thing? I'll leave it here in case you do need it. - Krystal //public static final CableTypeEntry steelReinforcedAluminum = REGISTRATE.cableType("steel_reinforced_aluminum", CableType::new) // .properties((p) -> p.color(0xB8A08D).spool(TFMGItems.COPPER_SPOOL)) // .transform(TFMGResistivity.setResistivity(0.0027f)) diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGEntityTypes.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGEntityTypes.java index 0508e128..2f394b37 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGEntityTypes.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGEntityTypes.java @@ -29,11 +29,6 @@ import net.minecraft.world.entity.MobCategory; public class TFMGEntityTypes { - - - - - public static final EntityEntry PIPE_BOMB = register("pipe_bomb", PipeBomb::new, () -> PipeBombRenderer::new, MobCategory.MISC, 4, 20, true, true, PipeBomb::build).register(); @@ -70,9 +65,6 @@ public class TFMGEntityTypes { MobCategory.MISC, 80, 20, true, true, LithiumSpark::build).register(); - - - private static CreateEntityBuilder register(String name, EntityType.EntityFactory factory, NonNullSupplier>> renderer, MobCategory group, int range, int updateFrequency, boolean sendVelocity, boolean immuneToFire, @@ -91,8 +83,6 @@ public class TFMGEntityTypes { .renderer(renderer); } - - public static void init(){ } diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGItems.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGItems.java index b63b3418..9b38783a 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGItems.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGItems.java @@ -6,7 +6,7 @@ import com.drmangotea.tfmg.base.TFMGRegistrate; import com.drmangotea.tfmg.base.TFMGTiers; import com.drmangotea.tfmg.content.decoration.gearbox.SteelVerticalGearboxItem; import com.drmangotea.tfmg.content.electricity.configuration_wrench.ElectriciansWrenchItem; -import com.drmangotea.tfmg.content.electricity.debug.DebugCinderBlockItem; +import com.drmangotea.tfmg.base.debug.DebugCinderBlockItem; import com.drmangotea.tfmg.content.electricity.measurement.MultimeterItem; import com.drmangotea.tfmg.content.electricity.utilities.polarizer.MagnetItem; import com.drmangotea.tfmg.content.electricity.utilities.resistor.ResistorItem; @@ -28,7 +28,6 @@ import com.drmangotea.tfmg.content.items.weapons.lithium_blade.LithiumBladeItem; import com.drmangotea.tfmg.content.items.weapons.quad_potato_cannon.QuadPotatoCannonItem; import com.drmangotea.tfmg.content.machinery.misc.winding_machine.SpoolItem; import com.drmangotea.tfmg.content.machinery.oil_processing.OilHammerItem; -import com.drmangotea.tfmg.content.machinery.oil_processing.pumpjack.pumpjack.base.DepositItem; import com.simibubi.create.AllTags; import com.simibubi.create.content.processing.sequenced.SequencedAssemblyItem; import com.simibubi.create.foundation.data.AssetLookup; @@ -87,6 +86,7 @@ public class TFMGItems { SYNTHETIC_LEATHER = taggedIngredient("synthetic_leather", Tags.Items.LEATHERS, AllTags.commonItemTag("leather")), LIMESAND = taggedIngredient("limesand", TFMGTags.TFMGItemTags.FLUX.tag), SULFUR_DUST = taggedIngredient("sulfur_dust", commonItemTag("dusts/sulfur"), commonItemTag("dusts")), + NITRATE_DUST = taggedIngredient("nitrate_dust", commonItemTag("dusts/saltpeter"), commonItemTag("dusts")), RUBBER_SHEET = taggedIngredient("rubber_sheet", commonItemTag("ingots/rubber"), commonItemTag("dusts")), SILICON_INGOT = taggedIngredient("silicon_ingot", commonItemTag("ingots/silicon"), commonItemTag("dusts")), CRUSHED_LITHIUM = taggedIngredient("crushed_raw_lithium", AllTags.AllItemTags.CRUSHED_RAW_MATERIALS.tag) @@ -123,7 +123,6 @@ public class TFMGItems { .register(), THERMITE_POWDER = REGISTRATE.item("thermite_powder", Item::new).register(), STEEL_MECHANISM = REGISTRATE.item("steel_mechanism", Item::new).register(), - NITRATE_DUST = REGISTRATE.item("nitrate_dust", Item::new).register(), CONCRETE_MIXTURE = REGISTRATE.item("concrete_mixture", Item::new).register(), ASPHALT_MIXTURE = REGISTRATE.item("asphalt_mixture", Item::new).register(), MAGNETIC_ALLOY_INGOT = REGISTRATE.item("magnetic_alloy_ingot", Item::new).register(), @@ -224,10 +223,8 @@ public class TFMGItems { .durability(256)) .register(); - public static final ItemEntry DEPOSIT_ITEM = REGISTRATE.item("deposit_item", DepositItem::new) - .properties(p -> p.stacksTo(1) - .durability(1)) - .register(); + + // public static final ItemEntry // STEEL_HELMET = armor("steel_helmet", TFMGArmorMaterials.STEEL, ArmorItem.Type.HELMET), // STEEL_CHESTPLATE = armor("steel_chestplate", TFMGArmorMaterials.STEEL, ArmorItem.Type.CHESTPLATE), diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGKeys.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGKeys.java index c96ce677..4d258510 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGKeys.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGKeys.java @@ -31,10 +31,6 @@ public enum TFMGKeys { private final int key; private final boolean modifiable; - TFMGKeys(int defaultKey) { - this("", defaultKey, ""); - } - TFMGKeys(String description, int defaultKey, String translation) { this.description = TFMG.MOD_ID + ".keyinfo." + description; this.key = defaultKey; diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGMobEffects.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGMobEffects.java index 4aaee3bf..00205fb4 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGMobEffects.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGMobEffects.java @@ -15,6 +15,9 @@ import net.neoforged.neoforge.registries.DeferredRegister; import java.awt.*; public class TFMGMobEffects { + /** + registers the hellfire effect + */ public static final DeferredRegister MOB_EFFECTS = DeferredRegister.create(Registries.MOB_EFFECT, TFMG.MOD_ID); public static final DeferredHolder HELLFIRE = MOB_EFFECTS.register("hellfire", () -> new HellFireEffect(MobEffectCategory.HARMFUL, new Color(150, 0, 0, 200).getRGB())); diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGMountedStorageTypes.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGMountedStorageTypes.java index e4de7246..fd548e13 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGMountedStorageTypes.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGMountedStorageTypes.java @@ -12,11 +12,9 @@ public class TFMGMountedStorageTypes { public static final RegistryEntry,FluidTankMountedStorageType> TFMG_FLUID_TANK = simpleFluid("tfmg_fluid_tank", FluidTankMountedStorageType::new); - private static > RegistryEntry, T> simpleFluid(String name, Supplier supplier) { return REGISTRATE.mountedFluidStorage(name, supplier).register(); } - public static void register() { - } + public static void register() {} } diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGPackets.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGPackets.java index 48738e76..0d7b2f19 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGPackets.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGPackets.java @@ -11,6 +11,7 @@ import com.drmangotea.tfmg.content.engines.engine_controller.TransmissionRemoveP import com.drmangotea.tfmg.content.engines.engine_controller.packets.*; import com.drmangotea.tfmg.content.items.weapons.advanced_potato_cannon.AdvancedPotatoCannonPacket; import com.drmangotea.tfmg.content.machinery.metallurgy.coke_oven.CokeOvenPacket; +import com.drmangotea.tfmg.content.machinery.oil_processing.distillation_tower.controller.DistillationTowerPacket; import com.drmangotea.tfmg.content.machinery.vat.base.VatEvaluationPacket; import com.simibubi.create.AllPackets; import com.simibubi.create.Create; @@ -32,6 +33,7 @@ public enum TFMGPackets implements BasePacketPayload.PacketTypeProvider { CONNECTION_PACKET(ConnectionPacket.class, ConnectionPacket.STREAM_CODEC), VAT_EVALUATION(VatEvaluationPacket.class, VatEvaluationPacket.STREAM_CODEC), COKE_OVEN_PACKET(CokeOvenPacket.class, CokeOvenPacket.STREAM_CODEC), + DISTILLATION_PACKET(DistillationTowerPacket.class, DistillationTowerPacket.STREAM_CODEC), UPDATE_IN_FRONT_PACKET(UpdateInFrontPacket.class, UpdateInFrontPacket.STREAM_CODEC), TRANSMISSION_REMOVE(TransmissionRemovePacket.class, TransmissionRemovePacket.STREAM_CODEC), CABLE_PLACE_PACKET(CablePlacePacket.class, CablePlacePacket.STREAM_CODEC), diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGPartialModels.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGPartialModels.java index ac9eb3be..68860cac 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGPartialModels.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGPartialModels.java @@ -18,7 +18,6 @@ import java.util.*; public class TFMGPartialModels { public static final PartialModel - AIR_INTAKE_FAN = block("air_intake/fan"), AIR_INTAKE_FAN_MEDIUM = block("air_intake/fan_medium"), AIR_INTAKE_FAN_LARGE = block("air_intake/fan_large"), AIR_INTAKE_FRAME = block("air_intake/frame"), @@ -41,19 +40,9 @@ public class TFMGPartialModels { LEAD_FLYWHEEL = block("lead_flywheel/block"), NICKEL_FLYWHEEL = block("nickel_flywheel/block"), DISTILLATION_CONTROLLER_DIAL = block("steel_distillation_controller/dial"), - PUMPJACK_HAMMER = block("pumpjack/hammer_holder"), - PUMPJACK_FRONT_ROPE = block("pumpjack/pumpjack_front_rope"), - PUMPJACK_CONNECTOR = block("pumpjack/pumpjack_connector"), - PUMPJACK_CRANK_BLOCK = block("pumpjack/pumpjack_crank_block"), PUMPJACK_CRANK = block("pumpjack_crank/crank"), - PUMPJACK_CONNECTORS = block("pumpjack_crank/connectors"), TOWER_GAUGE = block("distillation_tower/gauge"), - SURFACE_SCANNER_DIAL = block("surface_scanner/dial"), - SURFACE_SCANNER_FLAG = block("surface_scanner/flag"), ROTOR = block("rotor/block"), - INGOT_MOLD = block("casting_basin/mold_base"), - BlOCK_MOLD = block("casting_basin/block_mold"), - STATOR_OUTPUT = block("stator/output"), VOLTMETER_DIAL = block("voltmeter/dial"), LIGHT_BULB = block("light_bulb/light"), ALUMINUM_LAMP = block("aluminum_lamp/light"), @@ -76,9 +65,6 @@ public class TFMGPartialModels { SHAFTLESS_LARGE_STEEL_COGHWEEL = block("large_steel_cogwheel_shaftless"), SPOOL = block("winding_machine/spool"), SPOOL_WIRE = block("winding_machine/spool_wire"), - COPPER_SPOOL = block("winding_machine/copper_spool"), - ALUMINUM_SPOOL = block("winding_machine/aluminum_spool"), - CONSTANTAN_SPOOL = block("winding_machine/constantan_spool"), CYLINDER = block("regular_engine/cylinder"), RADIAL_ENGINE_CYLINDER = block("radial_engine/cylinder"), SMALL_CYLINDER = block("regular_engine/cylinder_small"), @@ -107,10 +93,6 @@ public class TFMGPartialModels { LARGE_CENTRIFUGE_MIDDLE = block("industrial_mixer/large_centrifuge_middle"), LARGE_CENTRIFUGE_TOP = block("industrial_mixer/large_centrifuge_top"), LARGE_CENTRIFUGE_ALONE = block("industrial_mixer/large_centrifuge_alone"), - COPPER_ELECTRODE = block("electrode_holder/copper_electrode"), - ZINC_ELECTRODE = block("electrode_holder/zinc_electrode"), - GRAPHITE_ELECTRODE = block("electrode_holder/graphite_electrode"), - GRAPHITE_ELECTRODE_SUPERHEATED = block("electrode_holder/superheated_graphite_electrode"), SURFACE_SCANNER_LIGHT = block("surface_scanner/light"); //Display Segments diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGRecipeTypes.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGRecipeTypes.java index 8c707ff8..ae1096a6 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGRecipeTypes.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGRecipeTypes.java @@ -56,20 +56,6 @@ public enum TFMGRecipeTypes implements IRecipeTypeInfo, StringRepresentable { public static final Codec CODEC = StringRepresentable.fromEnum(AllRecipeTypes::values); - TFMGRecipeTypes(Supplier> serializerSupplier, Supplier> typeSupplier, boolean registerType) { - String name = Lang.asId(name()); - id = Create.asResource(name); - this.serializerSupplier = serializerSupplier; - serializerObject = Registers.SERIALIZER_REGISTER.register(name, serializerSupplier); - if (registerType) { - typeObject = Registers.TYPE_REGISTER.register(name, typeSupplier); - type = typeObject; - } else { - typeObject = null; - type = typeSupplier; - } - isProcessingRecipe = false; - } TFMGRecipeTypes(Supplier> serializerSupplier) { String name = Lang.asId(name()); diff --git a/src/main/java/com/drmangotea/tfmg/registry/TFMGTags.java b/src/main/java/com/drmangotea/tfmg/registry/TFMGTags.java index 9ad6e729..635d1927 100644 --- a/src/main/java/com/drmangotea/tfmg/registry/TFMGTags.java +++ b/src/main/java/com/drmangotea/tfmg/registry/TFMGTags.java @@ -31,8 +31,6 @@ public class TFMGTags { MOD(TFMG.MOD_ID, false, true), COMMON("c") - - ; public final String id; @@ -74,10 +72,6 @@ public class TFMGTags { this(namespace, namespace.optionalDefault, namespace.alwaysDatagenDefault); } - TFMGBlockTags(NameSpace namespace, String path) { - this(namespace, path, namespace.optionalDefault, namespace.alwaysDatagenDefault); - } - TFMGBlockTags(NameSpace namespace, boolean optional, boolean alwaysDatagen) { this(namespace, null, optional, alwaysDatagen); } @@ -191,17 +185,12 @@ public class TFMGTags { public final TagKey tag; public final boolean alwaysDatagen; - TFMGFluidTags() { - this(MOD); - } + TFMGFluidTags(NameSpace namespace) { this(namespace, namespace.optionalDefault, namespace.alwaysDatagenDefault); } - TFMGFluidTags(NameSpace namespace, String path) { - this(namespace, path, namespace.optionalDefault, namespace.alwaysDatagenDefault); - } TFMGFluidTags(NameSpace namespace, boolean optional, boolean alwaysDatagen) { this(namespace, null, optional, alwaysDatagen);