From c917fdb17a600445f6cf7b2ef324b8d9ae616e36 Mon Sep 17 00:00:00 2001 From: bruberu <80226372+bruberu@users.noreply.github.com> Date: Thu, 22 Aug 2024 06:48:39 -0500 Subject: [PATCH 1/6] feat: basic code --- .../supersymmetry/api/util/SuSyUtility.java | 1 + .../SuSyMetaTileEntities.java | 10 + .../electric/MetaTileEntityLandfill.java | 207 ++++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java diff --git a/src/main/java/supersymmetry/api/util/SuSyUtility.java b/src/main/java/supersymmetry/api/util/SuSyUtility.java index 84cd0040b..40f646003 100644 --- a/src/main/java/supersymmetry/api/util/SuSyUtility.java +++ b/src/main/java/supersymmetry/api/util/SuSyUtility.java @@ -56,4 +56,5 @@ public class SuSyUtility { public static ResourceLocation susyId(String path) { return new ResourceLocation(Supersymmetry.MODID, path); } + } diff --git a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java index 1ea96510b..ffb74ac47 100644 --- a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java +++ b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java @@ -30,6 +30,7 @@ import supersymmetry.common.metatileentities.multiblockpart.SusyMetaTileEntityDumpingHatch; import supersymmetry.common.metatileentities.multiblockpart.SusyMetaTileEntityEnergyHatch; import supersymmetry.common.metatileentities.single.electric.MetaTileEntityBathCondenser; +import supersymmetry.common.metatileentities.single.electric.MetaTileEntityLandfill; import supersymmetry.common.metatileentities.single.electric.MetaTileEntityLatexCollector; import supersymmetry.common.metatileentities.single.electric.MetaTileEntityPhaseSeparator; import supersymmetry.common.metatileentities.single.steam.MetaTileEntitySteamLatexCollector; @@ -146,6 +147,8 @@ public class SuSyMetaTileEntities { public static SimpleMachineMetaTileEntity[] TEXTILE_SPINNER; public static SimpleMachineMetaTileEntity[] POLISHING_MACHINE; + public static MetaTileEntityLandfill[] LANDFILL = new MetaTileEntityLandfill[4]; + public static void init() { MAGNETIC_REFRIGERATOR = registerMetaTileEntity(14500, new MetaTileEntityMagneticRefrigerator(susyId("magnetic_refrigerator"))); COAGULATION_TANK = registerMetaTileEntity(14501, new MetaTileEntityCoagulationTank(susyId("coagulation_tank"))); @@ -240,6 +243,12 @@ public static void init() { NEW_ENERGY_OUTPUT_HATCH_16A[2] = registerMetaTileEntity(16005, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.hv"), 3, 16, true)); NEW_ENERGY_OUTPUT_HATCH_16A[3] = registerMetaTileEntity(16006, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.ev"), 4, 16, true)); + LANDFILL[0] = registerMetaTileEntity(16500, new MetaTileEntityLandfill(susyId("landfill.lv"), 1)); + LANDFILL[1] = registerMetaTileEntity(16501, new MetaTileEntityLandfill(susyId("landfill.mv"), 2)); + LANDFILL[2] = registerMetaTileEntity(16502, new MetaTileEntityLandfill(susyId("landfill.hv"), 3)); + LANDFILL[3] = registerMetaTileEntity(16503, new MetaTileEntityLandfill(susyId("landfill.ev"), 4)); + + BASIC_STEAM_TURBINE = registerMetaTileEntity(17000, new MetaTileEntitySUSYLargeTurbine(susyId("basic_steam_turbine"), SuSyRecipeMaps.LARGE_STEAM_TURBINE, 1, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), Textures.SOLID_STEEL_CASING, SusyTextures.LARGE_STEAM_TURBINE_OVERLAY)); BASIC_GAS_TURBINE = registerMetaTileEntity(17001, new MetaTileEntitySUSYLargeTurbine(susyId("basic_gas_turbine"), RecipeMaps.GAS_TURBINE_FUELS, 2, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), Textures.SOLID_STEEL_CASING, SusyTextures.LARGE_GAS_TURBINE_OVERLAY)); @@ -266,6 +275,7 @@ public static void init() { registerSimpleMTE(ELECTROSTATIC_SEPARATOR, 12, 17035, "electrostatic_separator", SuSyRecipeMaps.ELECTROSTATIC_SEPARATOR, SusyTextures.ELECTROSTATIC_SEPARATOR_OVERLAY, true, GTUtility.defaultTankSizeFunction); registerSimpleMTE(POLISHING_MACHINE, 12, 17048, "polishing_machine", SuSyRecipeMaps.POLISHING_MACHINE, SusyTextures.POLISHING_MACHINE_OVERLAY, true, GTUtility.defaultTankSizeFunction); registerSimpleMTE(TEXTILE_SPINNER, 12, 17061, "textile_spinner", SuSyRecipeMaps.SPINNING_RECIPES, SusyTextures.TEXTILE_SPINNER_OVERLAY, true); + } private static void registerSimpleSteamMTE(SuSySimpleSteamMetaTileEntity[] machines, int startId, String name, RecipeMap recipeMap, SuSySteamProgressIndicator progressIndicator, ICubeRenderer texture, boolean isBricked) { diff --git a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java new file mode 100644 index 000000000..21ccfa1fa --- /dev/null +++ b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java @@ -0,0 +1,207 @@ +package supersymmetry.common.metatileentities.single.electric; + +import gregtech.api.capability.GregtechTileCapabilities; +import gregtech.api.capability.IControllable; +import gregtech.api.capability.impl.NotifiableItemStackHandler; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.TieredMetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtechfoodoption.utils.GTFOUtils; +import it.unimi.dsi.fastutil.Stack; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.NotNull; + +import static gregtech.api.GTValues.VA; +import static gregtech.api.capability.GregtechDataCodes.WORKING_ENABLED; + +public class MetaTileEntityLandfill extends TieredMetaTileEntity implements IControllable { + + private boolean isWorkingEnabled = true; + private boolean hasItems = false; + private int numBlocksFilled; + private boolean isDoneFilling; + private ObjectArrayList cachedPos = new ObjectArrayList<>(); // Using both the stack and the list features + + public MetaTileEntityLandfill(ResourceLocation metaTileEntityId, int tier) { + super(metaTileEntityId, tier); + initializeInventory(); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) { + return new MetaTileEntityLandfill(metaTileEntityId, this.getTier()); + } + + @Override + protected ModularUI createUI(EntityPlayer entityPlayer) { + int rowSize = (int) Math.sqrt(getInventorySize()); + return createUITemplate(entityPlayer, rowSize) + .build(getHolder(), entityPlayer); + } + + @Override + public void update() { + super.update(); + if (isWorkingEnabled && !this.getWorld().isRemote && (hasItems || this.notifiedItemInputList != null)) { + this.hasItems = true; + int startSlot = GTFOUtils.getFirstUnemptyItemSlot(this.importItems, 0); + if (startSlot == -1) { + this.hasItems = false; + } + if (startSlot != -1 && this.energyContainer.removeEnergy(VA[getTier()]) == -VA[getTier()]) { + if (!isDoneFilling) { + if (cachedPos == null || cachedPos.isEmpty()) { + cachedPos.push(this.getPos().down()); + } + BlockPos.MutableBlockPos operationPos = new BlockPos.MutableBlockPos(cachedPos.top()); + if (this.isBlocked(getWorld().getBlockState(operationPos)) && cachedPos.size() == 1) { + this.isDoneFilling = true; + } else { + while (getNextBlock(getWorld(), operationPos) && operationPos.getY() > 0) { + cachedPos.push(operationPos.toImmutable()); + } + getWorld().setBlockState(operationPos, Blocks.DIRT.getDefaultState()); + cachedPos.pop(); + numBlocksFilled++; + } + } + if (!isDoneFilling || numBlocksFilled > 1000) { + this.importItems.extractItem(startSlot, getTier(), false); + } + } + + } + } + + + + private boolean getNextBlock(World world, BlockPos.MutableBlockPos pos) { + pos.move(EnumFacing.DOWN); + if (!isBlocked(world.getBlockState(pos))) { + return true; + } else for (EnumFacing facing : EnumFacing.HORIZONTALS) { + if (!isBlocked(world.getBlockState(pos.move(facing)))) { + return true; + } + pos.move(facing.getOpposite()); + } + pos.move(EnumFacing.UP); + return false; + } + + + private boolean isBlocked(IBlockState state) + { + Block block = state.getBlock(); //Forge: state must be valid for position + Material mat = state.getMaterial(); + + if (!(block instanceof BlockDoor) && block != Blocks.STANDING_SIGN && block != Blocks.LADDER && block != Blocks.REEDS) + { + return mat != Material.PORTAL && mat != Material.STRUCTURE_VOID ? mat.blocksMovement() : true; + } + else + { + return true; + } + } + + private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) { + int backgroundWidth = gridSize > 6 ? 176 + (gridSize - 6) * 18 : 176; + int center = backgroundWidth / 2; + + int gridStartX = center - (gridSize * 9); + + int inventoryStartX = center - 9 - 4 * 18; + int inventoryStartY = 18 + 18 * gridSize + 12; + + ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, backgroundWidth, 18 + 18 * gridSize + 94) + .label(10, 5, getMetaFullName()); + + for (int y = 0; y < gridSize; y++) { + for (int x = 0; x < gridSize; x++) { + int index = y * gridSize + x; + + builder.widget(new SlotWidget(importItems, index, + gridStartX + x * 18, 18 + y * 18, true, true) + .setBackgroundTexture(GuiTextures.SLOT)); + } + } + + return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, inventoryStartX, inventoryStartY); + } + + private int getInventorySize() { + int sizeRoot = 1 + Math.min(9, getTier()); + return sizeRoot * sizeRoot; + } + + @Override + protected IItemHandlerModifiable createImportItemHandler() { + return new NotifiableItemStackHandler(this, getInventorySize(), this, false); + } + + @Override + public boolean isWorkingEnabled() { + return isWorkingEnabled; + } + + @Override + public void setWorkingEnabled(boolean b) { + this.isWorkingEnabled = b; + this.writeCustomData(WORKING_ENABLED, buf -> buf.writeBoolean(b)); + } + + @Override + public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { + super.receiveCustomData(dataId, buf); + if (dataId == WORKING_ENABLED) { + this.isWorkingEnabled = buf.readBoolean(); + } + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound data) { + data.setBoolean("workingEnabled", this.isWorkingEnabled); + data.setBoolean("isDoneFilling", this.isDoneFilling); + data.setInteger("numBlocksFilled", this.numBlocksFilled); + return super.writeToNBT(data); + } + + + @Override + public void readFromNBT(NBTTagCompound data) { + super.readFromNBT(data); + this.isWorkingEnabled = data.getBoolean("workingEnabled"); + this.isDoneFilling = data.getBoolean("isDoneFilling"); + this.numBlocksFilled = data.getInteger("numBlocksFilled"); + } + + @Override + public T getCapability(Capability capability, EnumFacing side) { + if (capability == GregtechTileCapabilities.CAPABILITY_CONTROLLABLE) + return GregtechTileCapabilities.CAPABILITY_CONTROLLABLE.cast(this); + return super.getCapability(capability, side); + } + + @Override + public void writeInitialSyncData(@NotNull PacketBuffer buf) { + super.writeInitialSyncData(buf); + } +} From c5ec8faa486c7d5dea45efde70916d56462b7e17 Mon Sep 17 00:00:00 2001 From: bruberu <80226372+bruberu@users.noreply.github.com> Date: Thu, 29 Aug 2024 17:16:21 -0500 Subject: [PATCH 2/6] feat: change to an incinerator --- .../renderer/textures/SusyTextures.java | 1 + .../SuSyMetaTileEntities.java | 12 +- .../electric/MetaTileEntityIncinerator.java | 265 ++++++++++++++++++ .../electric/MetaTileEntityLandfill.java | 207 -------------- .../machines/incinerator/overlay_front.png | Bin 0 -> 261 bytes .../overlay_front_active.png} | Bin .../overlay_front_active_emissive.png | Bin 0 -> 4352 bytes .../machines/incinerator/overlay_top.png | Bin 0 -> 228 bytes .../incinerator/overlay_top_active.png | Bin 0 -> 230 bytes .../overlay_top_active_emissive.png | Bin 0 -> 167 bytes .../overlay_bottom_active_emissive.png | Bin 0 -> 4352 bytes .../resources/assets/susy/lang/en_us.lang | 10 + 12 files changed, 282 insertions(+), 213 deletions(-) create mode 100644 src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java delete mode 100644 src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front.png rename src/main/resources/assets/gregtech/textures/blocks/machines/{roaster/roaster_bottom_active.png => incinerator/overlay_front_active.png} (100%) create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front_active_emissive.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_top.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_top_active.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_top_active_emissive.png create mode 100644 src/main/resources/assets/gregtech/textures/blocks/machines/roaster/overlay_bottom_active_emissive.png diff --git a/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java b/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java index 9e7696b1e..f1085a9bf 100644 --- a/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java +++ b/src/main/java/supersymmetry/client/renderer/textures/SusyTextures.java @@ -32,6 +32,7 @@ public SusyTextures(){ public static final OrientedOverlayRenderer PHASE_SEPARATOR_OVERLAY = new OrientedOverlayRenderer("machines/phase_separator"); public static final OrientedOverlayRenderer BATH_CONDENSER_OVERLAY = new OrientedOverlayRenderer("machines/bath_condenser"); public static final OrientedOverlayRenderer CATALYTIC_REFORMER_OVERLAY = new OrientedOverlayRenderer("multiblock/catalytic_reformer"); + public static final OrientedOverlayRenderer INCINERATOR_OVERLAY = new OrientedOverlayRenderer("machines/incinerator"); public static final OrientedOverlayRenderer FLUID_COMPRESSOR_OVERLAY = new OrientedOverlayRenderer("machines/fluid_compressor"); public static final OrientedOverlayRenderer FLUID_DECOMPRESSOR_OVERLAY = new OrientedOverlayRenderer("machines/fluid_decompressor"); diff --git a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java index ffb74ac47..830e77062 100644 --- a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java +++ b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java @@ -30,7 +30,7 @@ import supersymmetry.common.metatileentities.multiblockpart.SusyMetaTileEntityDumpingHatch; import supersymmetry.common.metatileentities.multiblockpart.SusyMetaTileEntityEnergyHatch; import supersymmetry.common.metatileentities.single.electric.MetaTileEntityBathCondenser; -import supersymmetry.common.metatileentities.single.electric.MetaTileEntityLandfill; +import supersymmetry.common.metatileentities.single.electric.MetaTileEntityIncinerator; import supersymmetry.common.metatileentities.single.electric.MetaTileEntityLatexCollector; import supersymmetry.common.metatileentities.single.electric.MetaTileEntityPhaseSeparator; import supersymmetry.common.metatileentities.single.steam.MetaTileEntitySteamLatexCollector; @@ -147,7 +147,7 @@ public class SuSyMetaTileEntities { public static SimpleMachineMetaTileEntity[] TEXTILE_SPINNER; public static SimpleMachineMetaTileEntity[] POLISHING_MACHINE; - public static MetaTileEntityLandfill[] LANDFILL = new MetaTileEntityLandfill[4]; + public static MetaTileEntityIncinerator[] INCINERATOR = new MetaTileEntityIncinerator[4]; public static void init() { MAGNETIC_REFRIGERATOR = registerMetaTileEntity(14500, new MetaTileEntityMagneticRefrigerator(susyId("magnetic_refrigerator"))); @@ -243,10 +243,10 @@ public static void init() { NEW_ENERGY_OUTPUT_HATCH_16A[2] = registerMetaTileEntity(16005, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.hv"), 3, 16, true)); NEW_ENERGY_OUTPUT_HATCH_16A[3] = registerMetaTileEntity(16006, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.ev"), 4, 16, true)); - LANDFILL[0] = registerMetaTileEntity(16500, new MetaTileEntityLandfill(susyId("landfill.lv"), 1)); - LANDFILL[1] = registerMetaTileEntity(16501, new MetaTileEntityLandfill(susyId("landfill.mv"), 2)); - LANDFILL[2] = registerMetaTileEntity(16502, new MetaTileEntityLandfill(susyId("landfill.hv"), 3)); - LANDFILL[3] = registerMetaTileEntity(16503, new MetaTileEntityLandfill(susyId("landfill.ev"), 4)); + INCINERATOR[0] = registerMetaTileEntity(16500, new MetaTileEntityIncinerator(susyId("incinerator.lv"), 1, 4, 1)); + INCINERATOR[1] = registerMetaTileEntity(16501, new MetaTileEntityIncinerator(susyId("incinerator.mv"), 2, 2, 1)); + INCINERATOR[2] = registerMetaTileEntity(16502, new MetaTileEntityIncinerator(susyId("incinerator.hv"), 3, 1, 1)); + INCINERATOR[3] = registerMetaTileEntity(16503, new MetaTileEntityIncinerator(susyId("incinerator.ev"), 4, 1, 2)); BASIC_STEAM_TURBINE = registerMetaTileEntity(17000, new MetaTileEntitySUSYLargeTurbine(susyId("basic_steam_turbine"), SuSyRecipeMaps.LARGE_STEAM_TURBINE, 1, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), Textures.SOLID_STEEL_CASING, SusyTextures.LARGE_STEAM_TURBINE_OVERLAY)); diff --git a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java new file mode 100644 index 000000000..861985993 --- /dev/null +++ b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java @@ -0,0 +1,265 @@ +package supersymmetry.common.metatileentities.single.electric; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.vec.Matrix4; +import gregtech.api.capability.GregtechTileCapabilities; +import gregtech.api.capability.IControllable; +import gregtech.api.capability.impl.NotifiableItemStackHandler; +import gregtech.api.gui.GuiTextures; +import gregtech.api.gui.ModularUI; +import gregtech.api.gui.widgets.AdvancedTextWidget; +import gregtech.api.gui.widgets.SlotWidget; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.TieredMetaTileEntity; +import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; +import gregtechfoodoption.utils.GTFOUtils; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.world.World; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.items.IItemHandlerModifiable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import supersymmetry.client.renderer.textures.SusyTextures; + +import java.util.List; + +import static gregtech.api.GTValues.V; +import static gregtech.api.capability.GregtechDataCodes.UPDATE_ACTIVE; +import static gregtech.api.capability.GregtechDataCodes.WORKING_ENABLED; + +public class MetaTileEntityIncinerator extends TieredMetaTileEntity implements IControllable { + + private boolean isWorkingEnabled = true; + private boolean isActive; + private boolean hasItems = false; + private int progress = 0; + private boolean isClogged = false; + public final int maxProgress; + public final int itemsPerRun; + public static final int UPDATE_CLOGGED = 3488; + + public MetaTileEntityIncinerator(ResourceLocation metaTileEntityId, int tier, int maxProgress, int itemsPerRun) { + super(metaTileEntityId, tier); + initializeInventory(); + this.maxProgress = maxProgress; + this.itemsPerRun = itemsPerRun; + } + + @Override + public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { + super.renderMetaTileEntity(renderState, translation, pipeline); + SusyTextures.INCINERATOR_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive && isWorkingEnabled, true); + } + + @Override + public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) { + return new MetaTileEntityIncinerator(metaTileEntityId, this.getTier(), maxProgress, itemsPerRun); + } + + @Override + protected ModularUI createUI(EntityPlayer entityPlayer) { + int rowSize = (int) Math.sqrt(getInventorySize()); + return createUITemplate(entityPlayer, rowSize) + .build(getHolder(), entityPlayer); + } + + @Override + public void update() { + super.update(); + if (isActive() && this.getOffsetTimer() % 5 == 0) { + if (this.getWorld().isRemote) { + this.incineratingParticles(); + } else { + getWorld().playSound(null, getPos(), SoundEvents.ENTITY_GENERIC_BURN, SoundCategory.BLOCKS, 1.0F, 1.0F); + } + } + + if (isWorkingEnabled && !this.getWorld().isRemote && (hasItems || this.notifiedItemInputList != null)) { + if (this.getOffsetTimer() % 40 == 0) { + for (BlockPos pos : BlockPos.getAllInBox(getPos().up(1), getPos().up(8))) { + IBlockState state = getWorld().getBlockState(pos); + if (!state.getBlock().isAir(state, getWorld(), pos)) { + setWorkingEnabled(false); + setClogged(true); + } + } + } + + this.hasItems = true; + int startSlot = GTFOUtils.getFirstUnemptyItemSlot(this.importItems, 0); + if (startSlot == -1) { + this.hasItems = false; + } else if (this.energyContainer.removeEnergy(V[getTier()] / 2) == -V[getTier()] / 2) { + if (!this.isActive) + setActive(true); + progress++; + if (progress >= maxProgress) { + this.importItems.extractItem(startSlot, itemsPerRun, false); + progress = 0; + } + } else { + if (this.isActive) + setActive(false); + } + + } + } + + @Override + public boolean isActive() { + return isActive; + } + + public void setActive(boolean active) { + isActive = active; + this.writeCustomData(UPDATE_ACTIVE, buf -> buf.writeBoolean(active)); + } + + @SideOnly(Side.CLIENT) + private void incineratingParticles() { + BlockPos pos = this.getPos(); + double xPos = pos.getX() + Math.random(); + double yPos = pos.getY() + 0.5D; + double zPos = pos.getZ() + Math.random(); + + double ySpd = 1 + Math.random(); + double xSpd = (Math.random() - 0.5D) / 4; + double zSpd = (Math.random() - 0.5D) / 4; + + getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, xSpd, ySpd, zSpd); + } + + private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) { + int backgroundWidth = gridSize > 6 ? 176 + (gridSize - 6) * 18 : 176; + int center = backgroundWidth / 2; + + int gridStartX = center - (gridSize * 9); + + int inventoryStartX = center - 9 - 4 * 18; + int inventoryStartY = 30 + 18 * gridSize + 12; + + ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, backgroundWidth, 30 + 18 * gridSize + 94) + .label(10, 5, getMetaFullName()); + + builder.widget(new AdvancedTextWidget(10, 18, this::getDisplayText, 0)); + + for (int y = 0; y < gridSize; y++) { + for (int x = 0; x < gridSize; x++) { + int index = y * gridSize + x; + + builder.widget(new SlotWidget(importItems, index, + gridStartX + x * 18, 30 + y * 18, true, true) + .setBackgroundTexture(GuiTextures.SLOT)); + } + } + + return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, inventoryStartX, inventoryStartY); + } + + private int getInventorySize() { + int sizeRoot = 1 + Math.min(9, getTier()); + return sizeRoot * sizeRoot; + } + + @Override + protected IItemHandlerModifiable createImportItemHandler() { + return new NotifiableItemStackHandler(this, getInventorySize(), this, false); + } + + @Override + public boolean isWorkingEnabled() { + return isWorkingEnabled; + } + + @Override + public void setWorkingEnabled(boolean b) { + this.isWorkingEnabled = b; + this.writeCustomData(WORKING_ENABLED, buf -> buf.writeBoolean(b)); + } + + public void setClogged(boolean b) { + this.isClogged = b; + this.writeCustomData(UPDATE_CLOGGED, buf -> buf.writeBoolean(b)); + } + + public void getDisplayText(List list) { + list.add(new TextComponentTranslation(isClogged ? "gregtech.multiblock.incinerator.clogged" : "gregtech.multiblock.incinerator.working")); + } + + @Override + public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { + super.receiveCustomData(dataId, buf); + if (dataId == WORKING_ENABLED) { + this.isWorkingEnabled = buf.readBoolean(); + } else if (dataId == UPDATE_CLOGGED) { + this.isClogged = buf.readBoolean(); + } else if (dataId == UPDATE_ACTIVE) { + this.isActive = buf.readBoolean(); + } + } + + @Override + public NBTTagCompound writeToNBT(NBTTagCompound data) { + data.setBoolean("workingEnabled", this.isWorkingEnabled); + data.setInteger("progress", this.progress); + data.setBoolean("isClogged", this.isClogged); + data.setBoolean("isActive", this.isActive); + return super.writeToNBT(data); + } + + + @Override + public void readFromNBT(NBTTagCompound data) { + super.readFromNBT(data); + this.isWorkingEnabled = data.getBoolean("workingEnabled"); + this.progress = data.getInteger("progress"); + this.isClogged = data.getBoolean("isClogged"); + this.isActive = data.getBoolean("isActive"); + } + + @Override + public void writeInitialSyncData(@NotNull PacketBuffer buf) { + super.writeInitialSyncData(buf); + buf.writeInt(this.progress); + buf.writeBoolean(this.isClogged); + buf.writeBoolean(this.isActive); + } + + @Override + public void receiveInitialSyncData(@NotNull PacketBuffer buf) { + super.receiveInitialSyncData(buf); + this.progress = buf.readInt(); + this.isClogged = buf.readBoolean(); + this.isActive = buf.readBoolean(); + } + + @Override + public T getCapability(Capability capability, EnumFacing side) { + if (capability == GregtechTileCapabilities.CAPABILITY_CONTROLLABLE) + return GregtechTileCapabilities.CAPABILITY_CONTROLLABLE.cast(this); + return super.getCapability(capability, side); + } + + @Override + public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { + tooltip.add(I18n.format("gregtech.machine.incinerator.tooltip.1", itemsPerRun, maxProgress)); + tooltip.add(I18n.format("gregtech.machine.incinerator.tooltip.2")); + tooltip.add(I18n.format("gregtech.machine.incinerator.tooltip.3")); + } +} diff --git a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java deleted file mode 100644 index 21ccfa1fa..000000000 --- a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityLandfill.java +++ /dev/null @@ -1,207 +0,0 @@ -package supersymmetry.common.metatileentities.single.electric; - -import gregtech.api.capability.GregtechTileCapabilities; -import gregtech.api.capability.IControllable; -import gregtech.api.capability.impl.NotifiableItemStackHandler; -import gregtech.api.gui.GuiTextures; -import gregtech.api.gui.ModularUI; -import gregtech.api.gui.widgets.SlotWidget; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.TieredMetaTileEntity; -import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; -import gregtechfoodoption.utils.GTFOUtils; -import it.unimi.dsi.fastutil.Stack; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.minecraft.block.Block; -import net.minecraft.block.BlockDoor; -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.items.IItemHandlerModifiable; -import org.jetbrains.annotations.NotNull; - -import static gregtech.api.GTValues.VA; -import static gregtech.api.capability.GregtechDataCodes.WORKING_ENABLED; - -public class MetaTileEntityLandfill extends TieredMetaTileEntity implements IControllable { - - private boolean isWorkingEnabled = true; - private boolean hasItems = false; - private int numBlocksFilled; - private boolean isDoneFilling; - private ObjectArrayList cachedPos = new ObjectArrayList<>(); // Using both the stack and the list features - - public MetaTileEntityLandfill(ResourceLocation metaTileEntityId, int tier) { - super(metaTileEntityId, tier); - initializeInventory(); - } - - @Override - public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) { - return new MetaTileEntityLandfill(metaTileEntityId, this.getTier()); - } - - @Override - protected ModularUI createUI(EntityPlayer entityPlayer) { - int rowSize = (int) Math.sqrt(getInventorySize()); - return createUITemplate(entityPlayer, rowSize) - .build(getHolder(), entityPlayer); - } - - @Override - public void update() { - super.update(); - if (isWorkingEnabled && !this.getWorld().isRemote && (hasItems || this.notifiedItemInputList != null)) { - this.hasItems = true; - int startSlot = GTFOUtils.getFirstUnemptyItemSlot(this.importItems, 0); - if (startSlot == -1) { - this.hasItems = false; - } - if (startSlot != -1 && this.energyContainer.removeEnergy(VA[getTier()]) == -VA[getTier()]) { - if (!isDoneFilling) { - if (cachedPos == null || cachedPos.isEmpty()) { - cachedPos.push(this.getPos().down()); - } - BlockPos.MutableBlockPos operationPos = new BlockPos.MutableBlockPos(cachedPos.top()); - if (this.isBlocked(getWorld().getBlockState(operationPos)) && cachedPos.size() == 1) { - this.isDoneFilling = true; - } else { - while (getNextBlock(getWorld(), operationPos) && operationPos.getY() > 0) { - cachedPos.push(operationPos.toImmutable()); - } - getWorld().setBlockState(operationPos, Blocks.DIRT.getDefaultState()); - cachedPos.pop(); - numBlocksFilled++; - } - } - if (!isDoneFilling || numBlocksFilled > 1000) { - this.importItems.extractItem(startSlot, getTier(), false); - } - } - - } - } - - - - private boolean getNextBlock(World world, BlockPos.MutableBlockPos pos) { - pos.move(EnumFacing.DOWN); - if (!isBlocked(world.getBlockState(pos))) { - return true; - } else for (EnumFacing facing : EnumFacing.HORIZONTALS) { - if (!isBlocked(world.getBlockState(pos.move(facing)))) { - return true; - } - pos.move(facing.getOpposite()); - } - pos.move(EnumFacing.UP); - return false; - } - - - private boolean isBlocked(IBlockState state) - { - Block block = state.getBlock(); //Forge: state must be valid for position - Material mat = state.getMaterial(); - - if (!(block instanceof BlockDoor) && block != Blocks.STANDING_SIGN && block != Blocks.LADDER && block != Blocks.REEDS) - { - return mat != Material.PORTAL && mat != Material.STRUCTURE_VOID ? mat.blocksMovement() : true; - } - else - { - return true; - } - } - - private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) { - int backgroundWidth = gridSize > 6 ? 176 + (gridSize - 6) * 18 : 176; - int center = backgroundWidth / 2; - - int gridStartX = center - (gridSize * 9); - - int inventoryStartX = center - 9 - 4 * 18; - int inventoryStartY = 18 + 18 * gridSize + 12; - - ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, backgroundWidth, 18 + 18 * gridSize + 94) - .label(10, 5, getMetaFullName()); - - for (int y = 0; y < gridSize; y++) { - for (int x = 0; x < gridSize; x++) { - int index = y * gridSize + x; - - builder.widget(new SlotWidget(importItems, index, - gridStartX + x * 18, 18 + y * 18, true, true) - .setBackgroundTexture(GuiTextures.SLOT)); - } - } - - return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, inventoryStartX, inventoryStartY); - } - - private int getInventorySize() { - int sizeRoot = 1 + Math.min(9, getTier()); - return sizeRoot * sizeRoot; - } - - @Override - protected IItemHandlerModifiable createImportItemHandler() { - return new NotifiableItemStackHandler(this, getInventorySize(), this, false); - } - - @Override - public boolean isWorkingEnabled() { - return isWorkingEnabled; - } - - @Override - public void setWorkingEnabled(boolean b) { - this.isWorkingEnabled = b; - this.writeCustomData(WORKING_ENABLED, buf -> buf.writeBoolean(b)); - } - - @Override - public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { - super.receiveCustomData(dataId, buf); - if (dataId == WORKING_ENABLED) { - this.isWorkingEnabled = buf.readBoolean(); - } - } - - @Override - public NBTTagCompound writeToNBT(NBTTagCompound data) { - data.setBoolean("workingEnabled", this.isWorkingEnabled); - data.setBoolean("isDoneFilling", this.isDoneFilling); - data.setInteger("numBlocksFilled", this.numBlocksFilled); - return super.writeToNBT(data); - } - - - @Override - public void readFromNBT(NBTTagCompound data) { - super.readFromNBT(data); - this.isWorkingEnabled = data.getBoolean("workingEnabled"); - this.isDoneFilling = data.getBoolean("isDoneFilling"); - this.numBlocksFilled = data.getInteger("numBlocksFilled"); - } - - @Override - public T getCapability(Capability capability, EnumFacing side) { - if (capability == GregtechTileCapabilities.CAPABILITY_CONTROLLABLE) - return GregtechTileCapabilities.CAPABILITY_CONTROLLABLE.cast(this); - return super.getCapability(capability, side); - } - - @Override - public void writeInitialSyncData(@NotNull PacketBuffer buf) { - super.writeInitialSyncData(buf); - } -} diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front.png b/src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front.png new file mode 100644 index 0000000000000000000000000000000000000000..3fcac96422d2c9fad199751f861c4fa0c8641f45 GIT binary patch literal 261 zcmV+g0s8)lP)Zf~<262h;m!N(Be z!FX-k@ZR?m>K@m;EM@irfqUQcW+BuN!~CsF1YX+)Wf8=wT(_>1A?z6e5FX=La7w8l zEMu+rjKFhUjkO_0vxcyCX9T_pX)@wzjtC%^N09lB;Hr8D$dz;UrljxxKsAETjv+?$ zs+XvgSf00000 LNkvXXu0mjfW+-k# literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/roaster/roaster_bottom_active.png b/src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front_active.png similarity index 100% rename from src/main/resources/assets/gregtech/textures/blocks/machines/roaster/roaster_bottom_active.png rename to src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front_active.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front_active_emissive.png b/src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_front_active_emissive.png new file mode 100644 index 0000000000000000000000000000000000000000..abad930aef430683ff285eace4b840d6d25a36a6 GIT binary patch literal 4352 zcmeHKdr%bj9be>i9Ob2AjE`iq#0bjX?mhM%+dB|BgtH!8fFiMwxVI13cz1i;E!^Rw z1~7@#7)x>Jln_nxz!)vYcPwGlf{|L&(lk>aO@yEkZ1Fz*=H&G9bzfyD z2bXzg58R&9^SSM{cdyfmdx?{;M$VY@&aM~FxH~)EUt0F@Ktt5?S59YMpLXiUh4)iV z{xlDF^bA0sY^mQ2PwPGZ*SudfY`cbLF5TF0zw>XpVECELXC682y74{)g{|YWvmLhV z?BQxa4Q*?hEP34vW*vL3=$)K-@g<2*_c~rrpPF3t>Ab1GUHESDvTFR$&Dd7mlWD3~ z>sK5-y6M<^4IB1$#CO!gcf-zqb?)s;$eagQ+P?L-&VBIs*H!fbS{HV&` zyW1yMshi7_!*?m15#j5pMO=$|uFWRSdhX7(>$g-V_L5r%{Wsq;Z3xR~3bs7jZvQaL z+{MpqyVKacGj&H#f6s-d%71yc>B=vT3vIEgShLpEUUZ{}a_;W?Xz|RwZ*EU2NXjj? zZ(IGuh21A=H|#Cx*z<+uUTn5$4f~rbx|f@dAT4m#y83yGQ@a;!E_r=wY}(mPfolne ze%@H7JhXWE#nJ_lGni8e526ou?*C8olxGW5Or%-u}8f+JW};zO}J8ch+_h zcd7=Ux3}-O80YmWUP(?})z#hE@b9i~R<)n`S3*pb??Pn1;#n|tK^{z3seK7a3vLy~ z2u@ZNbbGOePH1U>XeyEKq-~N2G$N$DblW zgfOhEpZ4)ykrzC$gh@GtYSDrqKo1Y+=l0s|Bk&&o5DS10EJ%4VwF<}FZfvZFU(Bfi zAVUd#uZO=FY*MU{^$XQLn$4+UJz~mO2!O6rW@S znrBG)QNtMs+{ijnJ)YBdyx>Igl7QW}F1WdRsi8F00c83R$^g89h$0xB+!)btY7& zce1F-Xv9%HK@%+P)Hn?$wG743(9 z;9xg5a_sQcAGoIij|M?Zi+bWu-(GfZ`e*i5p3csaUNi2{nlm zC{B?07<+-?x!V6_Eo~my9BO$U?+5W~Wl?BH6|q&JRcPtr<*fw6@}?juI#hz6s$oOT z0$3pxT}gQ=Sa5m_jq9+S|GrUROaw(3Sd^pmPE==5j=7E z;KTssW3ws%kAN#Mo-$W(s@$kFnX?h=KqV`60T71bM)bRcVM7ID(wQ+_u^IagCuZ4T z%pn8(LNai8fwK@BIShw50~!2~zoB0IkRf1rBFMP-ouF%iu5mFiF5`*mnxJc342;Wo zV!HlsbSXzar&teo3krabB~`>XG2lZh%K4LAD>Mx}Wt^(-xee|y-n?i05EMH_y27B= zw&_3^E!ylk(U%mnleLj#dh{hA+F`S16&wHbdDHH=N$SLi{=Vqm{JV=UL5)#wghfPr zx?r6mF^Ncg!5Ut?fFG=jJB`sv-#+zL^Xe;|mgz0J9H=!%g`BGU^0kAlCy&;BvA$~O znoW@#_nc_x!p)U07KYD0|Ci?0y1`E#D=pcohR%NW#+L<-w+`HUa4h-xeKSk89;v%+ zTd&%dzjn#;UnicQ`{61@Q2~>?^D*byVBE$7F)tlRfBEj9vh$*H`?8nX%y{W;-5;PJdx@v7EBifGW?l_N^~hVtfI@|yE{-7kV)quyLRo`zw-wUG&C_YGyO{rKHYNm=8rut zUmcd*;I?2k)G!cmO}hK*YmbWS<6U20OGZ}yl!&POS&(&1x>s34pMl~3*=&DFMv=Wh P%Naaf{an^LB{Ts5R|ig= literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_top_active.png b/src/main/resources/assets/gregtech/textures/blocks/machines/incinerator/overlay_top_active.png new file mode 100644 index 0000000000000000000000000000000000000000..df70d190cca422cbbd13ead24285402385b9a815 GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G^tAk28_ZrvZCAbW|YuPggKE*5S>A&KULKsknDPZ!4!i_^(}{{OdUR&D5PbTT-> z%hBKcUtUhU-+Y2ZA?u>PKEAFaQ?Z<NS%G}E0G|-o^=5KF=H;&PIv~YV666>BpW*3t11}(tv%n*=n1O*?5QG`)Q{pEA z1!X*4978mMlM`H+w}>P#FllgmP1I{(FcC;dVPR;P!0^%P#eOBAItEWyKbLh*2~7a| CuqDX= literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/blocks/machines/roaster/overlay_bottom_active_emissive.png b/src/main/resources/assets/gregtech/textures/blocks/machines/roaster/overlay_bottom_active_emissive.png new file mode 100644 index 0000000000000000000000000000000000000000..abad930aef430683ff285eace4b840d6d25a36a6 GIT binary patch literal 4352 zcmeHKdr%bj9be>i9Ob2AjE`iq#0bjX?mhM%+dB|BgtH!8fFiMwxVI13cz1i;E!^Rw z1~7@#7)x>Jln_nxz!)vYcPwGlf{|L&(lk>aO@yEkZ1Fz*=H&G9bzfyD z2bXzg58R&9^SSM{cdyfmdx?{;M$VY@&aM~FxH~)EUt0F@Ktt5?S59YMpLXiUh4)iV z{xlDF^bA0sY^mQ2PwPGZ*SudfY`cbLF5TF0zw>XpVECELXC682y74{)g{|YWvmLhV z?BQxa4Q*?hEP34vW*vL3=$)K-@g<2*_c~rrpPF3t>Ab1GUHESDvTFR$&Dd7mlWD3~ z>sK5-y6M<^4IB1$#CO!gcf-zqb?)s;$eagQ+P?L-&VBIs*H!fbS{HV&` zyW1yMshi7_!*?m15#j5pMO=$|uFWRSdhX7(>$g-V_L5r%{Wsq;Z3xR~3bs7jZvQaL z+{MpqyVKacGj&H#f6s-d%71yc>B=vT3vIEgShLpEUUZ{}a_;W?Xz|RwZ*EU2NXjj? zZ(IGuh21A=H|#Cx*z<+uUTn5$4f~rbx|f@dAT4m#y83yGQ@a;!E_r=wY}(mPfolne ze%@H7JhXWE#nJ_lGni8e526ou?*C8olxGW5Or%-u}8f+JW};zO}J8ch+_h zcd7=Ux3}-O80YmWUP(?})z#hE@b9i~R<)n`S3*pb??Pn1;#n|tK^{z3seK7a3vLy~ z2u@ZNbbGOePH1U>XeyEKq-~N2G$N$DblW zgfOhEpZ4)ykrzC$gh@GtYSDrqKo1Y+=l0s|Bk&&o5DS10EJ%4VwF<}FZfvZFU(Bfi zAVUd#uZO=FY*MU{^$XQLn$4+UJz~mO2!O6rW@S znrBG)QNtMs+{ijnJ)YBdyx>Igl7QW}F1WdRsi8F00c83R$^g89h$0xB+!)btY7& zce1F-Xv9%HK@%+P)Hn?$wG743(9 z;9xg5a_sQcAGoIij|M?Zi+bWu-(GfZ`e*i5p3csaUNi2{nlm zC{B?07<+-?x!V6_Eo~my9BO$U?+5W~Wl?BH6|q&JRcPtr<*fw6@}?juI#hz6s$oOT z0$3pxT}gQ=Sa5m_jq9+S|GrUROaw(3Sd^pmPE==5j=7E z;KTssW3ws%kAN#Mo-$W(s@$kFnX?h=KqV`60T71bM)bRcVM7ID(wQ+_u^IagCuZ4T z%pn8(LNai8fwK@BIShw50~!2~zoB0IkRf1rBFMP-ouF%iu5mFiF5`*mnxJc342;Wo zV!HlsbSXzar&teo3krabB~`>XG2lZh%K4LAD>Mx}Wt^(-xee|y-n?i05EMH_y27B= zw&_3^E!ylk(U%mnleLj#dh{hA+F`S16&wHbdDHH=N$SLi{=Vqm{JV=UL5)#wghfPr zx?r6mF^Ncg!5Ut?fFG=jJB`sv-#+zL^Xe;|mgz0J9H=!%g`BGU^0kAlCy&;BvA$~O znoW@#_nc_x!p)U07KYD0|Ci?0y1`E#D=pcohR%NW#+L<-w+`HUa4h-xeKSk89;v%+ zTd&%dzjn#;UnicQ`{61@Q2~>?^D*byVBE$7F)tlRfBEj9vh$*H`?8nX Date: Thu, 29 Aug 2024 20:21:48 -0500 Subject: [PATCH 3/6] feat: implement feedback on balancing --- .../common/metatileentities/SuSyMetaTileEntities.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java index 830e77062..3ee3fa73a 100644 --- a/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java +++ b/src/main/java/supersymmetry/common/metatileentities/SuSyMetaTileEntities.java @@ -243,10 +243,10 @@ public static void init() { NEW_ENERGY_OUTPUT_HATCH_16A[2] = registerMetaTileEntity(16005, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.hv"), 3, 16, true)); NEW_ENERGY_OUTPUT_HATCH_16A[3] = registerMetaTileEntity(16006, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.ev"), 4, 16, true)); - INCINERATOR[0] = registerMetaTileEntity(16500, new MetaTileEntityIncinerator(susyId("incinerator.lv"), 1, 4, 1)); - INCINERATOR[1] = registerMetaTileEntity(16501, new MetaTileEntityIncinerator(susyId("incinerator.mv"), 2, 2, 1)); - INCINERATOR[2] = registerMetaTileEntity(16502, new MetaTileEntityIncinerator(susyId("incinerator.hv"), 3, 1, 1)); - INCINERATOR[3] = registerMetaTileEntity(16503, new MetaTileEntityIncinerator(susyId("incinerator.ev"), 4, 1, 2)); + INCINERATOR[0] = registerMetaTileEntity(16500, new MetaTileEntityIncinerator(susyId("incinerator.lv"), 1, 20, 10)); + INCINERATOR[1] = registerMetaTileEntity(16501, new MetaTileEntityIncinerator(susyId("incinerator.mv"), 2, 20, 20)); + INCINERATOR[2] = registerMetaTileEntity(16502, new MetaTileEntityIncinerator(susyId("incinerator.hv"), 3, 20, 40)); + INCINERATOR[3] = registerMetaTileEntity(16503, new MetaTileEntityIncinerator(susyId("incinerator.ev"), 4, 10, 40)); BASIC_STEAM_TURBINE = registerMetaTileEntity(17000, new MetaTileEntitySUSYLargeTurbine(susyId("basic_steam_turbine"), SuSyRecipeMaps.LARGE_STEAM_TURBINE, 1, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), Textures.SOLID_STEEL_CASING, SusyTextures.LARGE_STEAM_TURBINE_OVERLAY)); From 0ca7b232fc7e7324f8d9d5bbf236422538d32b16 Mon Sep 17 00:00:00 2001 From: bruberu <80226372+bruberu@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:13:18 -0600 Subject: [PATCH 4/6] fix: rendering updates --- .../electric/MetaTileEntityIncinerator.java | 68 +++++++++++-------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java index 861985993..e6d656e38 100644 --- a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java +++ b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java @@ -46,7 +46,7 @@ public class MetaTileEntityIncinerator extends TieredMetaTileEntity implements IControllable { private boolean isWorkingEnabled = true; - private boolean isActive; + private boolean canProgress; private boolean hasItems = false; private int progress = 0; private boolean isClogged = false; @@ -64,7 +64,7 @@ public MetaTileEntityIncinerator(ResourceLocation metaTileEntityId, int tier, in @Override public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) { super.renderMetaTileEntity(renderState, translation, pipeline); - SusyTextures.INCINERATOR_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), isActive && isWorkingEnabled, true); + SusyTextures.INCINERATOR_OVERLAY.renderOrientedState(renderState, translation, pipeline, getFrontFacing(), this.isActive(), true); } @Override @@ -92,57 +92,66 @@ public void update() { if (isWorkingEnabled && !this.getWorld().isRemote && (hasItems || this.notifiedItemInputList != null)) { if (this.getOffsetTimer() % 40 == 0) { - for (BlockPos pos : BlockPos.getAllInBox(getPos().up(1), getPos().up(8))) { - IBlockState state = getWorld().getBlockState(pos); - if (!state.getBlock().isAir(state, getWorld(), pos)) { - setWorkingEnabled(false); - setClogged(true); - } - } + checkClogged(); } this.hasItems = true; int startSlot = GTFOUtils.getFirstUnemptyItemSlot(this.importItems, 0); if (startSlot == -1) { this.hasItems = false; + progress = 0; + if (this.canProgress) + setCanProgress(false); } else if (this.energyContainer.removeEnergy(V[getTier()] / 2) == -V[getTier()] / 2) { - if (!this.isActive) - setActive(true); + if (!this.canProgress) + setCanProgress(true); progress++; if (progress >= maxProgress) { this.importItems.extractItem(startSlot, itemsPerRun, false); progress = 0; } } else { - if (this.isActive) - setActive(false); + if (this.canProgress) + setCanProgress(false); } + } + } + public void checkClogged() { + for (BlockPos pos : BlockPos.getAllInBox(getPos().up(1), getPos().up(8))) { + IBlockState state = getWorld().getBlockState(pos); + if (!state.getBlock().isAir(state, getWorld(), pos)) { + setWorkingEnabled(false); + setClogged(true); + return; + } } + setClogged(false); } @Override public boolean isActive() { - return isActive; + return canProgress && isWorkingEnabled && !isClogged; } - public void setActive(boolean active) { - isActive = active; - this.writeCustomData(UPDATE_ACTIVE, buf -> buf.writeBoolean(active)); + public void setCanProgress(boolean canProgress) { + this.canProgress = canProgress; + this.writeCustomData(UPDATE_ACTIVE, buf -> buf.writeBoolean(canProgress)); } @SideOnly(Side.CLIENT) private void incineratingParticles() { BlockPos pos = this.getPos(); - double xPos = pos.getX() + Math.random(); + double xPos = pos.getX() + Math.random() / 2; double yPos = pos.getY() + 0.5D; - double zPos = pos.getZ() + Math.random(); + double zPos = pos.getZ() + Math.random() / 2; - double ySpd = 1 + Math.random(); - double xSpd = (Math.random() - 0.5D) / 4; - double zSpd = (Math.random() - 0.5D) / 4; + double ySpd = 0.1D + Math.random() / 3; + double xSpd = (Math.random() - 0.5D) / 3; + double zSpd = (Math.random() - 0.5D) / 3; getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, xSpd, ySpd, zSpd); + getWorld().spawnParticle(EnumParticleTypes.SMOKE_LARGE, xPos, yPos, zPos, xSpd, ySpd, zSpd); } private ModularUI.Builder createUITemplate(EntityPlayer player, int gridSize) { @@ -207,10 +216,13 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) { super.receiveCustomData(dataId, buf); if (dataId == WORKING_ENABLED) { this.isWorkingEnabled = buf.readBoolean(); + scheduleRenderUpdate(); } else if (dataId == UPDATE_CLOGGED) { this.isClogged = buf.readBoolean(); + scheduleRenderUpdate(); } else if (dataId == UPDATE_ACTIVE) { - this.isActive = buf.readBoolean(); + this.canProgress = buf.readBoolean(); + scheduleRenderUpdate(); } } @@ -219,7 +231,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound data) { data.setBoolean("workingEnabled", this.isWorkingEnabled); data.setInteger("progress", this.progress); data.setBoolean("isClogged", this.isClogged); - data.setBoolean("isActive", this.isActive); + data.setBoolean("canProgress", this.canProgress); return super.writeToNBT(data); } @@ -230,23 +242,25 @@ public void readFromNBT(NBTTagCompound data) { this.isWorkingEnabled = data.getBoolean("workingEnabled"); this.progress = data.getInteger("progress"); this.isClogged = data.getBoolean("isClogged"); - this.isActive = data.getBoolean("isActive"); + this.canProgress = data.getBoolean("canProgress"); } @Override public void writeInitialSyncData(@NotNull PacketBuffer buf) { super.writeInitialSyncData(buf); + buf.writeBoolean(this.isWorkingEnabled); buf.writeInt(this.progress); buf.writeBoolean(this.isClogged); - buf.writeBoolean(this.isActive); + buf.writeBoolean(this.canProgress); } @Override public void receiveInitialSyncData(@NotNull PacketBuffer buf) { super.receiveInitialSyncData(buf); + this.isWorkingEnabled = buf.readBoolean(); this.progress = buf.readInt(); this.isClogged = buf.readBoolean(); - this.isActive = buf.readBoolean(); + this.canProgress = buf.readBoolean(); } @Override From 3c4aab14472af61d9924938693fb25877bd967df Mon Sep 17 00:00:00 2001 From: bruberu <80226372+bruberu@users.noreply.github.com> Date: Sun, 12 Jan 2025 14:27:37 -0600 Subject: [PATCH 5/6] feat: ok I guess I can make it turn on automatically Technically, I already am limiting the number of clog-checks, so I might as well do this. --- .../single/electric/MetaTileEntityIncinerator.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java index e6d656e38..d70d5e58a 100644 --- a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java +++ b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java @@ -89,12 +89,10 @@ public void update() { getWorld().playSound(null, getPos(), SoundEvents.ENTITY_GENERIC_BURN, SoundCategory.BLOCKS, 1.0F, 1.0F); } } - - if (isWorkingEnabled && !this.getWorld().isRemote && (hasItems || this.notifiedItemInputList != null)) { - if (this.getOffsetTimer() % 40 == 0) { - checkClogged(); - } - + if (!this.getWorld().isRemote && this.getOffsetTimer() % 40 == 0) { + checkClogged(); + } + if (!isClogged && isWorkingEnabled && !this.getWorld().isRemote && (hasItems || this.notifiedItemInputList != null)) { this.hasItems = true; int startSlot = GTFOUtils.getFirstUnemptyItemSlot(this.importItems, 0); if (startSlot == -1) { @@ -121,8 +119,8 @@ public void checkClogged() { for (BlockPos pos : BlockPos.getAllInBox(getPos().up(1), getPos().up(8))) { IBlockState state = getWorld().getBlockState(pos); if (!state.getBlock().isAir(state, getWorld(), pos)) { - setWorkingEnabled(false); setClogged(true); + progress = 0; return; } } From cebc3d1b170c74c6f27519b6a08fe9591d823efc Mon Sep 17 00:00:00 2001 From: bruberu <80226372+bruberu@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:38:25 -0600 Subject: [PATCH 6/6] feat: more lang --- .../single/electric/MetaTileEntityIncinerator.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java index d70d5e58a..5cdfb9a99 100644 --- a/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java +++ b/src/main/java/supersymmetry/common/metatileentities/single/electric/MetaTileEntityIncinerator.java @@ -3,6 +3,7 @@ import codechicken.lib.render.CCRenderState; import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Matrix4; +import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IControllable; import gregtech.api.capability.impl.NotifiableItemStackHandler; @@ -270,6 +271,9 @@ public T getCapability(Capability capability, EnumFacing side) { @Override public void addInformation(ItemStack stack, @Nullable World player, @NotNull List tooltip, boolean advanced) { + tooltip.add(I18n.format("gregtech.universal.tooltip.max_voltage_in", energyContainer.getInputVoltage(), GTValues.VNF[getTier()])); + tooltip.add(I18n.format("gregtech.universal.tooltip.energy_storage_capacity", energyContainer.getEnergyCapacity())); + tooltip.add(I18n.format("gregtech.universal.tooltip.item_storage_capacity", getInventorySize())); tooltip.add(I18n.format("gregtech.machine.incinerator.tooltip.1", itemsPerRun, maxProgress)); tooltip.add(I18n.format("gregtech.machine.incinerator.tooltip.2")); tooltip.add(I18n.format("gregtech.machine.incinerator.tooltip.3"));