Merge pull request #1132 from JohannesGaessler/ItemDistributor

Item Distributor
This commit is contained in:
Blood-Asp 2017-07-06 22:36:37 +02:00 committed by GitHub
commit 8cfd1ff724
16 changed files with 560 additions and 8 deletions

View file

@ -0,0 +1,231 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="640"
height="640"
viewBox="0 0 169.33333 169.33334"
version="1.1"
id="svg8"
inkscape:version="0.92.1 r15371"
sodipodi:docname="item_distributor.svg"
inkscape:export-filename="./AUTOMATION_ITEMDISTRIBUTOR.png"
inkscape:export-xdpi="2.4000001"
inkscape:export-ydpi="2.4000001">
<defs
id="defs2">
<linearGradient
inkscape:collect="always"
id="linearGradient4567">
<stop
style="stop-color:#ffffff;stop-opacity:1"
offset="0"
id="stop4563" />
<stop
id="stop4571"
offset="0.5"
style="stop-color:#a05a2c;stop-opacity:1" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop4565" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4567"
id="linearGradient4569"
x1="-169.33333"
y1="-41.666683"
x2="338.66666"
y2="466.33331"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="-296.2953"
inkscape:cy="383.54174"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1017"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid4485" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-127.66665)">
<image
y="117.08331"
x="-243.41666"
id="image4495"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI WXMAAAsSAAALEgHS3X78AAAAB3RJTUUH3gQWES0RM2zKJgAAAJ1JREFUOMvtk1EKglAURMdoV9ra UnIptoFoc84ZsA+NVCKFPvrpwuU9Lsy5wzxeMQyDvqmDvqzfA47rQddda7Bsy1iY8W7LRm17qT8C jHW/3c6ASJREgEJUnspm00FskaWYIIhstjPobcFSHKIEgbczAGbiKM4EQfQ7ALYnyLiZ2WnY4cBP B1PnBbH3OMCqqlODe/WrZ+RNiMX/L+gBEUbAGtDL/toAAAAASUVORK5CYII= "
style="image-rendering:optimizeSpeed"
preserveAspectRatio="none"
height="169.33333"
width="169.33333" />
<g
id="g4596"
style="stroke:none;fill-opacity:1;fill:url(#linearGradient4569)">
<rect
y="138.24998"
x="10.583333"
height="10.583333"
width="148.16667"
id="rect4498"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)"
id="rect4500"
width="148.16667"
height="10.583333"
x="10.583333"
y="275.83331" />
<rect
y="148.83331"
x="148.16667"
height="127"
width="10.583333"
id="rect4502"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="148.83331"
x="10.583333"
height="127"
width="10.583333"
id="rect4504"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="159.41666"
x="95.25"
height="21.166666"
width="10.583333"
id="rect4506"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="148.83331"
x="105.83333"
height="21.166666"
width="10.583333"
id="rect4508"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="148.83331"
x="63.499996"
height="31.75"
width="10.583333"
id="rect4510"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="180.58331"
x="21.166666"
height="10.583333"
width="31.75"
id="rect4512"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="191.16666"
x="42.333332"
height="10.583333"
width="10.583333"
id="rect4514"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="212.33331"
x="31.75"
height="10.583333"
width="21.166666"
id="rect4518"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="244.08331"
x="95.25"
height="31.75"
width="10.583333"
id="rect4520"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="191.16666"
x="116.41666"
height="10.583333"
width="21.166666"
id="rect4526"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="180.58331"
x="127"
height="10.583333"
width="21.166666"
id="rect4528"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="222.91664"
x="21.166666"
height="10.583333"
width="21.166666"
id="rect4568"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="244.08333"
x="63.5"
height="21.166666"
width="10.583333"
id="rect4570"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="254.66666"
x="52.916664"
height="21.166666"
width="10.583333"
id="rect4572"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="222.91664"
x="116.41666"
height="10.583333"
width="21.166666"
id="rect4574"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
<rect
y="233.49998"
x="127"
height="10.583333"
width="21.166666"
id="rect4576"
style="opacity:1;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.58749988, 1.58749988000000000;stroke-dashoffset:0;stroke-opacity:1;fill:url(#linearGradient4569)" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -547,6 +547,7 @@ public enum ItemList implements IItemContainer {
Automation_ChestBuffer_ULV, Automation_ChestBuffer_LV, Automation_ChestBuffer_MV, Automation_ChestBuffer_HV, Automation_ChestBuffer_EV, Automation_ChestBuffer_IV, Automation_ChestBuffer_LuV, Automation_ChestBuffer_ZPM, Automation_ChestBuffer_UV, Automation_ChestBuffer_MAX,
Automation_SuperBuffer_ULV, Automation_SuperBuffer_LV, Automation_SuperBuffer_MV, Automation_SuperBuffer_HV, Automation_SuperBuffer_EV, Automation_SuperBuffer_IV, Automation_SuperBuffer_LuV, Automation_SuperBuffer_ZPM, Automation_SuperBuffer_UV, Automation_SuperBuffer_MAX,
Automation_Regulator_ULV, Automation_Regulator_LV, Automation_Regulator_MV, Automation_Regulator_HV, Automation_Regulator_EV, Automation_Regulator_IV, Automation_Regulator_LuV, Automation_Regulator_ZPM, Automation_Regulator_UV, Automation_Regulator_MAX,
Automation_ItemDistributor_ULV, Automation_ItemDistributor_LV, Automation_ItemDistributor_MV, Automation_ItemDistributor_HV, Automation_ItemDistributor_EV, Automation_ItemDistributor_IV, Automation_ItemDistributor_LuV, Automation_ItemDistributor_ZPM, Automation_ItemDistributor_UV, Automation_ItemDistributor_MAX,
Hatch_Dynamo_ULV, Hatch_Dynamo_LV, Hatch_Dynamo_MV, Hatch_Dynamo_HV, Hatch_Dynamo_EV, Hatch_Dynamo_IV, Hatch_Dynamo_LuV, Hatch_Dynamo_ZPM, Hatch_Dynamo_UV, Hatch_Dynamo_MAX,
Hatch_Energy_ULV, Hatch_Energy_LV, Hatch_Energy_MV, Hatch_Energy_HV, Hatch_Energy_EV, Hatch_Energy_IV, Hatch_Energy_LuV, Hatch_Energy_ZPM, Hatch_Energy_UV, Hatch_Energy_MAX,

View file

@ -18,7 +18,7 @@ public class Textures {
, RENDERING_ERROR, PIPE_RESTRICTOR, INSULATION_FULL, INSULATION_TINY, INSULATION_SMALL, INSULATION_MEDIUM, INSULATION_MEDIUM_PLUS, INSULATION_LARGE, INSULATION_HUGE, CFOAM_FRESH,
CFOAM_HARDENED, SOLARPANEL, SOLARPANEL_8V, SOLARPANEL_LV, SOLARPANEL_MV, SOLARPANEL_HV, SOLARPANEL_EV, SOLARPANEL_IV, SOLARPANEL_LuV, SOLARPANEL_ZPM,
SOLARPANEL_UV, VENT_NORMAL, VENT_ADVANCED, COVER_WOOD_PLATE, ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, AUTOMATION_FILTER, AUTOMATION_TYPEFILTER,
AUTOMATION_CHESTBUFFER, AUTOMATION_SUPERBUFFER, AUTOMATION_REGULATOR, CONCRETE_LIGHT_STONE, CONCRETE_LIGHT_COBBLE, CONCRETE_LIGHT_COBBLE_MOSSY,
AUTOMATION_CHESTBUFFER, AUTOMATION_SUPERBUFFER, AUTOMATION_REGULATOR, AUTOMATION_ITEMDISTRIBUTOR, CONCRETE_LIGHT_STONE, CONCRETE_LIGHT_COBBLE, CONCRETE_LIGHT_COBBLE_MOSSY,
CONCRETE_LIGHT_BRICKS, CONCRETE_LIGHT_BRICKS_CRACKED, CONCRETE_LIGHT_BRICKS_MOSSY, CONCRETE_LIGHT_BRICKS_CHISELED, CONCRETE_LIGHT_SMOOTH, CONCRETE_DARK_STONE,
CONCRETE_DARK_COBBLE, CONCRETE_DARK_COBBLE_MOSSY, CONCRETE_DARK_BRICKS, CONCRETE_DARK_BRICKS_CRACKED, CONCRETE_DARK_BRICKS_MOSSY, CONCRETE_DARK_BRICKS_CHISELED,
CONCRETE_DARK_SMOOTH, GRANITE_BLACK_STONE, GRANITE_BLACK_COBBLE, GRANITE_BLACK_COBBLE_MOSSY, GRANITE_BLACK_BRICKS, GRANITE_BLACK_BRICKS_CRACKED, GRANITE_BLACK_BRICKS_MOSSY,

View file

@ -19,6 +19,10 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
}
public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
}
public GT_MetaTileEntity_Buffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}

View file

@ -550,12 +550,15 @@ public class GT_Utility {
if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) {
if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, aTileEntity1.getStackInSlot(tGrabSlots[i]))) {
if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, aTileEntity1.getStackInSlot(tGrabSlots[i]), aMaxTargetStackSize)) {
tMovedItemCount = moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, aMaxMoveAtOnce, aMinMoveAtOnce);
tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce);
if (tMovedItemCount >= aMaxMoveAtOnce) {
return tMovedItemCount;
}
}
}
}
}
if (tMovedItemCount > 0) return tMovedItemCount;
if (tMovedItemCount > 0) return tMovedItemCount;
}
if (aDoCheckChests && aTileEntity1 instanceof TileEntityChest) {

View file

@ -0,0 +1,77 @@
package gregtech.common.gui;
import gregtech.api.gui.GT_ContainerMetaTile_Machine;
import gregtech.api.gui.GT_Slot_Holo;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
import gregtech.common.tileentities.automation.GT_MetaTileEntity_ItemDistributor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class GT_Container_ItemDistributor
extends GT_ContainerMetaTile_Machine {
public GT_Container_ItemDistributor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
}
public void addSlots(InventoryPlayer aInventoryPlayer) {
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(this.mTileEntity, x + y * 9, 8 + x * 18, 5 + y * 18));
}
}
addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 8, 63, false, true, 1));
addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 26, 63, false, true, 1));
addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 27, 44, 63, false, true, 1));
}
public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
if (aSlotIndex < 27) {
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
}
Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex);
if (tSlot != null) {
if (this.mTileEntity.getMetaTileEntity() == null) {
return null;
}
if (aSlotIndex == 27) {
((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bOutput = (!((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bOutput);
if (((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bOutput) {
GT_Utility.sendChatToPlayer(aPlayer, trans("116","Emit Energy to Outputside"));
} else {
GT_Utility.sendChatToPlayer(aPlayer, trans("117","Don't emit Energy"));
}
return null;
}
if (aSlotIndex == 28) {
((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull = (!((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull);
if (((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bRedstoneIfFull) {
GT_Utility.sendChatToPlayer(aPlayer, trans("118","Emit Redstone if no Slot is free"));
} else {
GT_Utility.sendChatToPlayer(aPlayer, trans("119","Don't emit Redstone"));
}
return null;
}
if (aSlotIndex == 29) {
((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bInvert = (!((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bInvert);
if (((GT_MetaTileEntity_ItemDistributor) this.mTileEntity.getMetaTileEntity()).bInvert) {
GT_Utility.sendChatToPlayer(aPlayer, trans("120","Invert Redstone"));
} else {
GT_Utility.sendChatToPlayer(aPlayer, trans("121","Don't invert Redstone"));
}
return null;
}
}
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
}
public int getSlotCount() {
return 27;
}
public int getShiftClickSlotCount() {
return 27;
}
}

View file

@ -0,0 +1,19 @@
package gregtech.common.gui;
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.InventoryPlayer;
public class GT_GUIContainer_ItemDistributor
extends GT_GUIContainerMetaTile_Machine {
public GT_GUIContainer_ItemDistributor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
super(new GT_Container_ItemDistributor(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/ItemDistributor.png");
}
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
int x = (this.width - this.xSize) / 2;
int y = (this.height - this.ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -14,13 +14,20 @@ import net.minecraft.entity.player.InventoryPlayer;
public class GT_MetaTileEntity_ChestBuffer
extends GT_MetaTileEntity_Buffer {
public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 28, "Buffering lots of incoming Items");
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_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
}
public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String[] aDescription) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
}
public GT_MetaTileEntity_ChestBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}

View file

@ -19,7 +19,10 @@ public class GT_MetaTileEntity_Filter
public boolean bInvertFilter = false;
public GT_MetaTileEntity_Filter(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 19, "Filtering incoming Items");
super(aID, aName, aNameRegional, aTier, 19, new String[]{
"Filters up to 9 different Items",
"Use Screwdriver to regulate output stack size",
"Consumes 1EU per moved Item"});
}
public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {

View file

@ -0,0 +1,169 @@
package gregtech.common.tileentities.automation;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_ItemDistributor;
import gregtech.common.gui.GT_GUIContainer_ItemDistributor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer {
private byte[] itemsPerSide = new byte[6];
private byte currentSide = 0, currentSideItemCount = 0;
public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 28, new String[]{
"Distributes Items between different Machine Sides",
"Default Items per Machine Side: 0",
"Use Screwdriver to increase/decrease Items per Side",
"Consumes 1EU per moved Item"});
}
public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
String aDescription) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
}
public GT_MetaTileEntity_ItemDistributor(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
public GT_MetaTileEntity_ItemDistributor(String aName, int aTier, int aInvSlotCount, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_ItemDistributor(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray,
this.mTextures);
}
protected void fillStacksIntoFirstSlots() {
for (int i = 0; i < this.mInventory.length - 1; i++) {
for (int j = i + 1; j < this.mInventory.length - 1; j++) {
if ((this.mInventory[j] != null)
&& ((this.mInventory[i] == null) || (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])))) {
GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1,
(byte) 64, (byte) 1);
}
}
}
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity);
}
public ITexture getOverlayIcon() {
return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR);
}
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_Container_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return aSide == aBaseMetaTileEntity.getFrontFacing();
}
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
if (aSide == aFacing) {
return mTextures[0][aColorIndex + 1];
} else {
return mTextures[1][aColorIndex + 1];
}
}
@Override
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] returnTextures = new ITexture[2][17][];
ITexture baseIcon = getOverlayIcon(), pipeIcon = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT);
for (int i = 0; i < 17; i++) {
returnTextures[0][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], baseIcon};
returnTextures[1][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], pipeIcon, baseIcon};
}
return returnTextures;
}
@Override
public boolean isInputFacing(byte aSide) {
return getBaseMetaTileEntity().getFrontFacing() == aSide || itemsPerSide[aSide] == 0;
}
@Override
public boolean isOutputFacing(byte aSide) {
return getBaseMetaTileEntity().getFrontFacing() != aSide && itemsPerSide[aSide] > 0;
}
public boolean isValidSlot(int aIndex) {
return aIndex < this.mInventory.length - 1;
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
itemsPerSide = aNBT.getByteArray("mItemsPerSide");
currentSide = aNBT.getByte("mCurrentSide");
currentSideItemCount = aNBT.getByte("mCurrentSideItemCount");
}
protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
fillStacksIntoFirstSlots();
int movedItems = 0;
TileEntity adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide);
int inspectedSides = 0;
while (itemsPerSide[currentSide] == 0) {
currentSide = (byte) ((currentSide + 1) % 6);
currentSideItemCount = 0;
adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide);
inspectedSides += 1;
if (inspectedSides == 6) {
return;
}
}
movedItems = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, adjacentTileEntity, currentSide,
GT_Utility.getOppositeSide(currentSide), null, false, (byte) 64, (byte) 1,
(byte) (itemsPerSide[currentSide] - currentSideItemCount), (byte) 1);
currentSideItemCount += movedItems;
if (currentSideItemCount >= itemsPerSide[currentSide]) {
currentSide = (byte) ((currentSide + 1) % 6);
currentSideItemCount = 0;
}
if (movedItems > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
mSuccess = 50;
aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(movedItems), true);
}
fillStacksIntoFirstSlots();
}
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
//Adjust items per side by 1 or -1, constrained to the cyclic interval [0, 127]
itemsPerSide[aSide] += aPlayer.isSneaking() ? -1 : 1;
itemsPerSide[aSide] = (byte) ((itemsPerSide[aSide] + 128) % 128);
GT_Utility.sendChatToPlayer(aPlayer, trans("110", "Items per side: " + itemsPerSide[aSide]));
}
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setByteArray("mItemsPerSide", itemsPerSide);
aNBT.setByte("mCurrentSide", currentSide);
aNBT.setByte("mCurrentSideItemCount", currentSideItemCount);
}
@Override
public void setItemNBT(NBTTagCompound aNBT) {
super.setItemNBT(aNBT);
aNBT.setByteArray("mItemsPerSide", itemsPerSide);
}
}

View file

@ -9,6 +9,7 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_Regulator;
import gregtech.common.gui.GT_GUIContainer_Regulator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -21,7 +22,11 @@ public class GT_MetaTileEntity_Regulator
private boolean charge = false, decharge = false;
public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 20, "Regulating incoming Items");
super(aID, aName, aNameRegional, aTier, 20, new String[]{
"Filters up to 9 different Items",
"Allows Item-specific output stack size",
"Allows Item-specific output slot",
"Consumes 1EU per moved Item"});
}
public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
@ -78,6 +83,11 @@ public class GT_MetaTileEntity_Regulator
this.mTargetSlots[8] = aNBT.getInteger("mTargetSlot9");
}
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
//Regulation per Screwdriver is overridden by GUI regulation.
}
public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
int i = 0;
for (int tCosts = 0; i < 9; i++) {

View file

@ -12,7 +12,10 @@ import net.minecraft.entity.player.InventoryPlayer;
public class GT_MetaTileEntity_SuperBuffer
extends GT_MetaTileEntity_ChestBuffer {
public GT_MetaTileEntity_SuperBuffer(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 257, "Buffering up to 256 Stacks");
super(aID, aName, aNameRegional, aTier, 257, new String[]{
"Buffers up to 256 Item Stacks",
"Use Screwdriver to regulate output stack size",
"Consumes 1EU per moved Item"});
}
public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {

View file

@ -24,7 +24,10 @@ public class GT_MetaTileEntity_TypeFilter
public OrePrefixes mPrefix = OrePrefixes.ore;
public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 11, "Filtering incoming Items by Type");
super(aID, aName, aNameRegional, aTier, 11, new String[]{
"Filters 1 Item Type",
"Use Screwdriver to regulate output stack size",
"Consumes 1 EU per moved Item"});
}
public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {

View file

@ -1570,6 +1570,28 @@ public class GT_Loader_MetaTileEntities implements Runnable {
GT_ModHandler.addCraftingRecipe(ItemList.Automation_SuperBuffer_ZPM.get(1L, new Object[0]), bitsd, new Object[]{"DMV", "DDD", 'M', ItemList.Hull_ZPM, 'V', ItemList.Conveyor_Module_ZPM, 'D', ItemList.Tool_DataStick});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_SuperBuffer_UV.get(1L, new Object[0]), bitsd, new Object[]{"DMV", "DDD", 'M', ItemList.Hull_UV, 'V', ItemList.Conveyor_Module_UV, 'D', ItemList.Tool_DataStick});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_SuperBuffer_MAX.get(1L, new Object[0]), bitsd, new Object[]{"DMV", "DDD", 'M', ItemList.Hull_MAX, 'V', ItemList.Conveyor_Module_UV, 'D', ItemList.Tool_DataStick});
ItemList.Automation_ItemDistributor_ULV.set(new GT_MetaTileEntity_ItemDistributor(9320, "automation.itemdistributor.tier.00", "Ultra Low Voltage Item Distributor", 0).getStackForm(1L));
ItemList.Automation_ItemDistributor_LV.set(new GT_MetaTileEntity_ItemDistributor(9321, "automation.itemdistributor.tier.01", "Low Voltage Item Distributor", 1).getStackForm(1L));
ItemList.Automation_ItemDistributor_MV.set(new GT_MetaTileEntity_ItemDistributor(9322, "automation.itemdistributor.tier.02", "Medium Voltage Item Distributor", 2).getStackForm(1L));
ItemList.Automation_ItemDistributor_HV.set(new GT_MetaTileEntity_ItemDistributor(9323, "automation.itemdistributor.tier.03", "High Voltage Item Distributor", 3).getStackForm(1L));
ItemList.Automation_ItemDistributor_EV.set(new GT_MetaTileEntity_ItemDistributor(9324, "automation.itemdistributor.tier.04", "Extreme Voltage Item Distributor", 4).getStackForm(1L));
ItemList.Automation_ItemDistributor_IV.set(new GT_MetaTileEntity_ItemDistributor(9325, "automation.itemdistributor.tier.05", "Insane Voltage Item Distributor", 5).getStackForm(1L));
ItemList.Automation_ItemDistributor_LuV.set(new GT_MetaTileEntity_ItemDistributor(9326, "automation.itemdistributor.tier.06", "Ludicrous Voltage Item Distributor", 6).getStackForm(1L));
ItemList.Automation_ItemDistributor_ZPM.set(new GT_MetaTileEntity_ItemDistributor(9327, "automation.itemdistributor.tier.07", "ZPM Voltage Item Distributor", 7).getStackForm(1L));
ItemList.Automation_ItemDistributor_UV.set(new GT_MetaTileEntity_ItemDistributor(9328, "automation.itemdistributor.tier.08", "Ultimate Voltage Item Distributor", 8).getStackForm(1L));
ItemList.Automation_ItemDistributor_MAX.set(new GT_MetaTileEntity_ItemDistributor(9329, "automation.itemdistributor.tier.09", "MAX Voltage Item Distributor", 9).getStackForm(1L));
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_ULV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_ULV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_LV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_LV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_MV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_MV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_HV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_HV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_EV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_EV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_IV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_IV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_LuV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_LuV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_ZPM.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_ZPM, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_UV.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_UV, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
GT_ModHandler.addCraftingRecipe(ItemList.Automation_ItemDistributor_MAX.get(1L, new Object[0]), bitsd, new Object[]{"XCX", "VMV", " V ", 'M', ItemList.Hull_MAX, 'V', ItemList.Conveyor_Module_LV, 'C', OreDictNames.craftingChest, 'X', OrePrefixes.circuit.get(Materials.Good)});
}
private static void makeWires(Materials aMaterial, int aStartID, long aLossInsulated, long aLoss, long aAmperage, long aVoltage, boolean aInsulatable, boolean aAutoInsulated) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB