-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed Universal macerator - Fixed microwave, scanner and IC2 maps - Fixed bunch of RecipeLogic & Recipe bugs - Misc tweaks
- Loading branch information
1 parent
f492b86
commit 16ff279
Showing
20 changed files
with
562 additions
and
223 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
src/main/java/gregtechmod/common/containers/UniversalMacerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
package gregtechmod.common.containers; | ||
|
||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
import cpw.mods.fml.relauncher.Side; | ||
import cpw.mods.fml.relauncher.SideOnly; | ||
import gregtechmod.api.gui.GT_ContainerMetaTile_Machine; | ||
import gregtechmod.api.gui.GT_Slot_Holo; | ||
import gregtechmod.api.gui.GT_Slot_Output; | ||
import gregtechmod.api.interfaces.IGregTechTileEntity; | ||
import gregtechmod.api.interfaces.IRecipeWorkable; | ||
import gregtechmod.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; | ||
|
||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.entity.player.InventoryPlayer; | ||
import net.minecraft.inventory.ICrafting; | ||
import net.minecraft.inventory.Slot; | ||
import net.minecraft.item.ItemStack; | ||
|
||
/** | ||
* @author TheDarkDnKTv | ||
* | ||
*/ | ||
public class UniversalMacerator extends GT_ContainerMetaTile_Machine { | ||
|
||
public boolean mOutputting = false, mItemTransfer = false, mSeperatedInputs = false; | ||
|
||
/** | ||
* @param aInventoryPlayer | ||
* @param aTileEntity | ||
*/ | ||
public UniversalMacerator(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { | ||
super(aInventoryPlayer, aTileEntity); | ||
} | ||
|
||
@Override | ||
public void addSlots(InventoryPlayer aInventoryPlayer) { | ||
addSlotToContainer(new Slot(mTileEntity, 1, 35, 25)); | ||
addSlotToContainer(new Slot(mTileEntity, 2, 53, 25)); | ||
addSlotToContainer(new Slot(mTileEntity, 7, 80, 63)); | ||
List<ItemStack> outputs = ((IRecipeWorkable) mTileEntity.getMetaTileEntity()).getOutputItems(); | ||
for (int i = 0; i < outputs.size(); i++) { | ||
int xOffset = 18 * (i % 2); | ||
int yOffset = 18 * (i / 2); | ||
|
||
addSlotToContainer(new GT_Slot_Output(mTileEntity, 3 + i, 107 + xOffset, 16 + yOffset)); | ||
} | ||
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 8, 63, false, true, 1)); | ||
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 26, 63, false, true, 1)); | ||
addSlotToContainer(new GT_Slot_Holo(mTileEntity, 0, 44, 63, false, true, 1)); | ||
} | ||
|
||
@Override | ||
public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { | ||
if (aSlotIndex < 7) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); | ||
|
||
Slot tSlot = (Slot)inventorySlots.get(aSlotIndex); | ||
if (tSlot != null) { | ||
if (mTileEntity.getMetaTileEntity() == null) return null; | ||
if (aSlotIndex == 7) { | ||
((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bOutput = !((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bOutput; | ||
return null; | ||
} | ||
if (aSlotIndex == 8) { | ||
((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bItemTransfer = !((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bItemTransfer; | ||
return null; | ||
} | ||
if (aSlotIndex == 9) { | ||
((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bSeperatedInputs = !((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bSeperatedInputs; | ||
return null; | ||
} | ||
} | ||
|
||
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); | ||
} | ||
|
||
@Override | ||
public void detectAndSendChanges() { | ||
super.detectAndSendChanges(); | ||
if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; | ||
|
||
mOutputting = ((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bOutput; | ||
mItemTransfer = ((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bItemTransfer; | ||
mSeperatedInputs = ((GT_MetaTileEntity_BasicMachine)mTileEntity.getMetaTileEntity()).bSeperatedInputs; | ||
|
||
@SuppressWarnings("rawtypes") | ||
Iterator var2 = this.crafters.iterator(); | ||
while (var2.hasNext()) { | ||
ICrafting var1 = (ICrafting)var2.next(); | ||
var1.sendProgressBarUpdate(this, 101, mOutputting?1:0); | ||
var1.sendProgressBarUpdate(this, 102, mItemTransfer?1:0); | ||
var1.sendProgressBarUpdate(this, 103, mSeperatedInputs?1:0); | ||
} | ||
} | ||
|
||
@Override | ||
@SideOnly(Side.CLIENT) | ||
public void updateProgressBar(int par1, int par2) { | ||
super.updateProgressBar(par1, par2); | ||
switch (par1) { | ||
case 101: mOutputting = (par2 != 0); break; | ||
case 102: mItemTransfer = (par2 != 0); break; | ||
case 103: mSeperatedInputs = (par2 != 0); break; | ||
} | ||
} | ||
|
||
@Override | ||
public int getSlotCount() { | ||
return 7; | ||
} | ||
|
||
@Override | ||
public int getShiftClickSlotCount() { | ||
return 2; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/gregtechmod/common/gui/GUI_UniversalMacerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package gregtechmod.common.gui; | ||
|
||
import gregtechmod.api.GregTech_API; | ||
import gregtechmod.api.gui.GT_GUIContainerMetaTile_Machine; | ||
import gregtechmod.api.interfaces.IGregTechTileEntity; | ||
import gregtechmod.common.containers.UniversalMacerator; | ||
import net.minecraft.entity.player.InventoryPlayer; | ||
|
||
/** | ||
* @author TheDarkDnKTv | ||
* | ||
*/ | ||
public class GUI_UniversalMacerator extends GT_GUIContainerMetaTile_Machine { | ||
|
||
private final String mName; | ||
/** | ||
* @param aInventoryPlayer | ||
* @param aTileEntity | ||
* @param aName | ||
* @param aTextureFile | ||
*/ | ||
public GUI_UniversalMacerator(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) { | ||
super(new UniversalMacerator(aInventoryPlayer, aTileEntity), GregTech_API.GUI_PATH + aTextureFile); | ||
mName = aName; | ||
} | ||
|
||
@Override | ||
protected void drawGuiContainerForegroundLayer(int par1, int par2) { | ||
fontRenderer.drawString(mName, 8, 4, 4210752); | ||
} | ||
|
||
@Override | ||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { | ||
super.drawGuiContainerBackgroundLayer(par1, par2, par3); | ||
int x = (width - xSize) / 2; | ||
int y = (height - ySize) / 2; | ||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize); | ||
if (mContainer != null) { | ||
if (((UniversalMacerator)mContainer).mOutputting) drawTexturedModalRect(x + 7, y + 62, 176, 18, 18, 18); | ||
if (((UniversalMacerator)mContainer).mItemTransfer) drawTexturedModalRect(x + 25, y + 62, 176, 36, 18, 18); | ||
if (((UniversalMacerator)mContainer).mSeperatedInputs) drawTexturedModalRect(x + 43, y + 62, 176, 54, 18, 18); | ||
|
||
if (mContainer.mMaxProgressTime > 0) { | ||
int tSize = 20, tProgress = Math.max(1, Math.min(tSize, (mContainer.mProgressTime>0?1:0) + (mContainer.mProgressTime * tSize) / mContainer.mMaxProgressTime)) % (tSize+1); | ||
drawTexturedModalRect(x + 78, y + 24, 176, 0, tProgress , 18); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.