diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-05-29 14:00:21 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-05-29 14:00:21 +1000 |
commit | a2377acf4dc0dedc087fe83ca5665d142ab26ba1 (patch) | |
tree | 91664db8d5a3cdd781b6f87ab4d4296d5f68f40f /src/Java/gtPlusPlus/xmod/gregtech/common | |
parent | 524a1242befd9b1ddb3dc591ac7a16148b272ea8 (diff) | |
download | GT5-Unofficial-a2377acf4dc0dedc087fe83ca5665d142ab26ba1.tar.gz GT5-Unofficial-a2377acf4dc0dedc087fe83ca5665d142ab26ba1.tar.bz2 GT5-Unofficial-a2377acf4dc0dedc087fe83ca5665d142ab26ba1.zip |
+ Attempted to make some server friendly threaded Super Buffers.
+ Initial work on an infinite item holder, for test setups.
% Renamed GregtechSuperTanks.java to GregtechSuperChests.java.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
4 files changed, 225 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 7acefa104c..d84e89619e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -352,6 +352,10 @@ public class TexturesGtBlock { private static final CustomIcon Internal_Overlay_UU_Matter = new CustomIcon("TileEntities/adv_machine_uum"); public static final CustomIcon Overlay_UU_Matter = Internal_Overlay_UU_Matter; + //Buffer Overlays + private static final CustomIcon Internal_OVERLAY_AUTOMATION_SUPERBUFFER = new CustomIcon("iconsets/AUTOMATION_SUPERBUFFER"); + public static final CustomIcon OVERLAY_AUTOMATION_SUPERBUFFER = Internal_OVERLAY_AUTOMATION_SUPERBUFFER; + //Metroid related public static final CustomIcon TEXTURE_METAL_PANEL_A = new CustomIcon("metro/TEXTURE_METAL_PANEL_A"); @@ -494,5 +498,8 @@ public class TexturesGtBlock { TEXTURE_CASING_FUSION_COIL_II_7, TEXTURE_CASING_FUSION_COIL_II_8, TEXTURE_CASING_FUSION_COIL_II_9, TEXTURE_CASING_FUSION_COIL_II_10, TEXTURE_CASING_FUSION_COIL_II_11, TEXTURE_CASING_FUSION_COIL_II_12}; + + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedChestBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedChestBuffer.java new file mode 100644 index 0000000000..022dfcb40a --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedChestBuffer.java @@ -0,0 +1,75 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.automation; + +import gregtech.common.gui.GT_GUIContainer_ChestBuffer; + +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ThreadedBuffer; + +import gregtech.common.gui.GT_Container_ChestBuffer; +import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.interfaces.ITexture; + +public class GT_MetaTileEntity_ThreadedChestBuffer extends GT_MetaTileEntity_ThreadedBuffer { + public GT_MetaTileEntity_ThreadedChestBuffer(final int aID, final String aName, final String aNameRegional, + final int aTier) { + super(aID, aName, aNameRegional, aTier, 28, new String[]{"Buffers up to 27 Item Stacks", + "Use Screwdriver to regulate output stack size", "Consumes 1EU per moved Item"}); + } + + public GT_MetaTileEntity_ThreadedChestBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, + final int aInvSlotCount, final String aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + } + + public GT_MetaTileEntity_ThreadedChestBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, + final int aInvSlotCount, final String[] aDescription) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription); + } + + public GT_MetaTileEntity_ThreadedChestBuffer(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public GT_MetaTileEntity_ThreadedChestBuffer(final String aName, final int aTier, final int aInvSlotCount, + final String[] aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return (IMetaTileEntity) new GT_MetaTileEntity_ThreadedChestBuffer(this.mName, this.mTier, this.mInventorySynchro.length, + this.mDescriptionArray, this.mTextures); + } + + public ITexture getOverlayIcon() { + return (ITexture) new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.AUTOMATION_CHESTBUFFER); + } + + public boolean isValidSlot(final int aIndex) { + return aIndex < this.mInventorySynchro.length - 1; + } + + protected void moveItems(final IGregTechTileEntity aBaseMetaTileEntity, final long aTimer) { + this.fillStacksIntoFirstSlots(); + super.moveItems(aBaseMetaTileEntity, aTimer); + this.fillStacksIntoFirstSlots(); + } + + protected synchronized void fillStacksIntoFirstSlots() { + this.mLogicThread.fillStacksIntoFirstSlots(this); + } + + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java new file mode 100644 index 0000000000..9643ca3394 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/automation/GT_MetaTileEntity_ThreadedSuperBuffer.java @@ -0,0 +1,56 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.automation; + +import gregtech.common.gui.GT_GUIContainer_SuperBuffer; + +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; + +import gregtech.common.gui.GT_Container_SuperBuffer; +import net.minecraft.entity.player.InventoryPlayer; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.interfaces.ITexture; + +public class GT_MetaTileEntity_ThreadedSuperBuffer extends GT_MetaTileEntity_ThreadedChestBuffer { + + public GT_MetaTileEntity_ThreadedSuperBuffer(final int aID, final String aName, final String aNameRegional, + final int aTier) { + super(aID, aName, aNameRegional, aTier, 257, new String[]{ + "Server friendly", + "Buffers up to 256 Item Stacks", + "Use Screwdriver to regulate output stack size", + "Consumes 1EU per moved Item", + CORE.GT_Tooltip}); + } + + public GT_MetaTileEntity_ThreadedSuperBuffer(final String aName, final int aTier, final int aInvSlotCount, + final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public GT_MetaTileEntity_ThreadedSuperBuffer(final String aName, final int aTier, final int aInvSlotCount, + final String[] aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + } + + public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return (IMetaTileEntity) new GT_MetaTileEntity_ThreadedSuperBuffer(this.mName, this.mTier, this.mInventorySynchro.length, + this.mDescriptionArray, this.mTextures); + } + + public ITexture getOverlayIcon() { + return (ITexture) new GT_RenderedTexture((IIconContainer) TexturesGtBlock.OVERLAY_AUTOMATION_SUPERBUFFER); + } + + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity); + } + + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, + final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java new file mode 100644 index 0000000000..5aa004637c --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/creative/GT_MetaTileEntity_InfiniteItemHolder.java @@ -0,0 +1,87 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.storage.creative; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; + +public class GT_MetaTileEntity_InfiniteItemHolder extends GT_MetaTileEntity_TieredChest { + + public GT_MetaTileEntity_InfiniteItemHolder(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_InfiniteItemHolder(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + + if (aPlayer.worldObj.isRemote) { + return false; + } + + if (!KeyboardUtils.isShiftKeyDown()) { + if (this.mItemStack == null) { + if (aPlayer.getHeldItem() != null) { + this.mItemStack = aPlayer.getHeldItem().copy(); + this.mItemCount = Short.MAX_VALUE; + } + } + else { + if (aPlayer.getHeldItem() == null) { + this.mItemStack = null; + this.mItemCount = 0; + } + } + } + else { + PlayerUtils.messagePlayer(aPlayer, "Currently holding: "+(this.mItemStack != null ? this.mItemStack.getDisplayName() : "Nothing")+" x"+this.mItemCount); + } + return super.onRightclick(aBaseMetaTileEntity, aPlayer); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return null; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + super.onPostTick(aBaseMetaTileEntity, aTimer); + } + + @Override + public void setItemCount(int aCount) { + super.setItemCount(Short.MAX_VALUE); + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + // TODO Auto-generated method stub + return super.allowPullStack(aBaseMetaTileEntity, aIndex, aSide, aStack); + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + // TODO Auto-generated method stub + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack); + } + + + + + +} |