diff options
author | ddoubleo <54915478+ddoubleo@users.noreply.github.com> | 2024-07-15 05:39:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-15 09:39:29 +0700 |
commit | e0d55a7759cc5dffc48d4dd424478c41ad1a82a3 (patch) | |
tree | b16c662d0bc1145d51cfe1d71e3db2a13793581b /src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities | |
parent | 73674dcf3e0f9b330fc3c8461bc151a4a2f0052c (diff) | |
download | GT5-Unofficial-e0d55a7759cc5dffc48d4dd424478c41ad1a82a3.tar.gz GT5-Unofficial-e0d55a7759cc5dffc48d4dd424478c41ad1a82a3.tar.bz2 GT5-Unofficial-e0d55a7759cc5dffc48d4dd424478c41ad1a82a3.zip |
Amazon warehouse is now an unpackager too (#2723)
* Amazon warehouse is now an unpackager too
* Fixed unpackager recipes not showing up in NEI for the Warehouse. Edited the tooltip
* sa
(cherry picked from commit e42861816ba516bd3da1f28d068a1e800e6098ee)
---------
Co-authored-by: bdoubleo <user@MacBook-Pro-user.local>
Co-authored-by: Dream Master <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities')
-rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java | 72 |
1 files changed, 70 insertions, 2 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java index 0e71c3b9b1..10ccf64e96 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GMTE_AmazonPackager.java @@ -10,7 +10,21 @@ import static gregtech.api.enums.GT_HatchElement.Muffler; import static gregtech.api.enums.GT_HatchElement.OutputBus; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import javax.annotation.Nonnull; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -28,14 +42,19 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_AmazonPackager> implements ISurvivalConstructable { private int mCasing; + private boolean mPackageMode = true; + private static IStructureDefinition<GMTE_AmazonPackager> STRUCTURE_DEFINITION = null; @Override @@ -53,7 +72,7 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_Amazon @Override public String getMachineType() { - return "Packager"; + return "Packager, Unpackager"; } @Override @@ -82,6 +101,7 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_Amazon tt.addMachineType(getMachineType()) .addInfo("Controller Block for the Amazon Warehouse") .addInfo("This Multiblock is used for EXTREME packaging requirements") + .addInfo("Can be configured with a screwdriver to work as an Unpackager") .addInfo("Dust Schematics are inserted into the input busses") .addInfo("If inserted into the controller, it is shared across all busses") .addInfo("1x, 2x, 3x & Other Schematics are to be placed into the controller GUI slot") @@ -119,7 +139,13 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_Amazon @Override public RecipeMap<?> getRecipeMap() { - return RecipeMaps.packagerRecipes; + return mPackageMode ? RecipeMaps.packagerRecipes : RecipeMaps.unpackagerRecipes; + } + + @Nonnull + @Override + public Collection<RecipeMap<?>> getAvailableRecipeMaps() { + return Arrays.asList(RecipeMaps.packagerRecipes, RecipeMaps.unpackagerRecipes); } @Override @@ -165,4 +191,46 @@ public class GMTE_AmazonPackager extends GregtechMeta_MultiBlockBase<GMTE_Amazon public boolean supportsInputSeparation() { return true; } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setBoolean("mPackageMode", mPackageMode); + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mPackageMode = aNBT.getBoolean("mPackageMode"); + super.loadNBTData(aNBT); + } + + @Override + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, + int z) { + super.getWailaNBTData(player, tile, tag, world, x, y, z); + tag.setBoolean("mode", mPackageMode); + } + + @Override + public void onModeChangeByScrewdriver(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mPackageMode = !mPackageMode; + if (mPackageMode) { + PlayerUtils.messagePlayer(aPlayer, "Now running in Packager Mode."); + } else { + PlayerUtils.messagePlayer(aPlayer, "Now running in Unpackager Mode."); + } + mLastRecipe = null; + } + + @Override + public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + super.getWailaBody(itemStack, currentTip, accessor, config); + final NBTTagCompound tag = accessor.getNBTData(); + currentTip.add( + StatCollector.translateToLocal("GT5U.machines.oreprocessor1") + " " + + EnumChatFormatting.WHITE + + StatCollector.translateToLocal("GT5U.GTPP_MULTI_PACKAGER.mode." + (tag.getBoolean("mode") ? 1 : 0)) + + EnumChatFormatting.RESET); + } } |