Fixes galore!

This commit is contained in:
Aidan C. Brady 2014-07-11 00:34:05 -04:00
parent eda233f1cf
commit 60b226600f
9 changed files with 120 additions and 49 deletions

View file

@ -18,7 +18,7 @@ public class GuiBucketIO extends GuiElement
@Override
public Rectangle4i getBounds(int guiWidth, int guiHeight)
{
return new Rectangle4i(guiWidth - 26, guiHeight + 4, 26, 57);
return new Rectangle4i(guiWidth + 176, guiHeight + 66, 26, 57);
}
@Override
@ -26,7 +26,7 @@ public class GuiBucketIO extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth - 26, guiHeight + 4, 0, 0, 26, 57);
guiObj.drawTexturedRect(guiWidth + 176, guiHeight + 66, 0, 0, 26, 57);
mc.renderEngine.bindTexture(defaultLocation);
}
@ -40,8 +40,20 @@ public class GuiBucketIO extends GuiElement
}
@Override
public void preMouseClicked(int xAxis, int yAxis, int button) {}
public void preMouseClicked(int xAxis, int yAxis, int button)
{
if((xAxis >= 180 && xAxis <= 196 && yAxis >= 71 && yAxis <= 87) || (xAxis >= 180 && xAxis <= 196 && yAxis >= 102 && yAxis <= 118))
{
offsetX(26);
}
}
@Override
public void mouseClicked(int xAxis, int yAxis, int button) {}
public void mouseClicked(int xAxis, int yAxis, int button)
{
if((xAxis >= 180 && xAxis <= 196 && yAxis >= 71 && yAxis <= 87) || (xAxis >= 180 && xAxis <= 196 && yAxis >= 102 && yAxis <= 118))
{
offsetX(-26);
}
}
}

View file

@ -47,7 +47,9 @@ public abstract class GuiElement
try {
int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize);
MekanismUtils.setPrivateValue(guiObj, size + xSize, GuiContainer.class, ObfuscatedNames.GuiContainer_xSize);
} catch(Exception e) {}
} catch(Exception e) {
e.printStackTrace();
}
}
}
@ -58,7 +60,36 @@ public abstract class GuiElement
try {
int size = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize);
MekanismUtils.setPrivateValue(guiObj, size + ySize, GuiContainer.class, ObfuscatedNames.GuiContainer_ySize);
} catch(Exception e) {}
} catch(Exception e) {
e.printStackTrace();
}
}
}
protected void offsetLeft(int guiLeft)
{
if(guiObj instanceof GuiContainer)
{
try {
int left = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
System.out.println(left + " " + guiLeft);
MekanismUtils.setPrivateValue(guiObj, left + guiLeft, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft);
} catch(Exception e) {
e.printStackTrace();
}
}
}
protected void offsetTop(int guiTop)
{
if(guiObj instanceof GuiContainer)
{
try {
int top = (Integer)MekanismUtils.getPrivateValue(guiObj, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);
MekanismUtils.setPrivateValue(guiObj, top + guiTop, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop);
} catch(Exception e) {
e.printStackTrace();
}
}
}

View file

@ -72,36 +72,30 @@ public class GuiUpgradeManagement extends GuiElement
@Override
public void preMouseClicked(int xAxis, int yAxis, int button)
{
if(button == 0)
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
{
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
{
offsetX(26);
}
offsetX(26);
}
}
@Override
public void mouseClicked(int xAxis, int yAxis, int button)
{
if(button == 0)
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
{
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetHandler.sendToServer(new RemoveUpgradeMessage(Coord4D.get(tileEntity), (byte)0));
}
SoundHandler.playSound("gui.button.press");
Mekanism.packetHandler.sendToServer(new RemoveUpgradeMessage(Coord4D.get(tileEntity), (byte)0));
}
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetHandler.sendToServer(new RemoveUpgradeMessage(Coord4D.get(tileEntity), (byte)1));
}
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
{
SoundHandler.playSound("gui.button.press");
Mekanism.packetHandler.sendToServer(new RemoveUpgradeMessage(Coord4D.get(tileEntity), (byte)1));
}
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
{
offsetX(-26);
}
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
{
offsetX(-26);
}
}
}

View file

@ -5,6 +5,7 @@ import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tile.TileEntityChemicalCrystallizer;
import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer;
@ -80,7 +81,7 @@ public class ContainerChemicalCrystallizer extends Container
}
}
else {
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
@ -88,45 +89,61 @@ public class ContainerChemicalCrystallizer extends Container
}
else if(slotID == 1)
{
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
else if(ChargeUtils.canBeDischarged(slotStack))
{
if(slotID != 3)
if(slotID != 2)
{
if(!mergeItemStack(slotStack, 2, 3, false))
{
return null;
}
}
else if(slotID == 3)
else if(slotID == 2)
{
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
{
if(!mergeItemStack(slotStack, 3, 4, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
else {
if(slotID >= 3 && slotID <= 29)
if(slotID >= 4 && slotID <= 30)
{
if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false))
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 30)
{
if(!mergeItemStack(slotStack, 3, 29, false))
if(!mergeItemStack(slotStack, 4, 30, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}

View file

@ -4,6 +4,7 @@ import mekanism.api.gas.IGasItem;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotMachineUpgrade;
import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.tile.TileEntityChemicalOxidizer;
@ -28,15 +29,15 @@ public class ContainerChemicalOxidizer extends Container
int slotX;
for(slotX = 0; slotX < 3; ++slotX)
for(slotX = 0; slotX < 3; slotX++)
{
for(int slotY = 0; slotY < 9; ++slotY)
for(int slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
}
}
for(slotX = 0; slotX < 9; ++slotX)
for(slotX = 0; slotX < 9; slotX++)
{
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
}
@ -89,7 +90,7 @@ public class ContainerChemicalOxidizer extends Container
}
else if(slotID == 1)
{
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
@ -105,29 +106,45 @@ public class ContainerChemicalOxidizer extends Container
}
}
else {
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
{
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
{
if(!mergeItemStack(slotStack, 3, 4, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
else {
if(slotID >= 3 && slotID <= 29)
if(slotID >= 4 && slotID <= 30)
{
if(!mergeItemStack(slotStack, 30, inventorySlots.size(), false))
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 30)
{
if(!mergeItemStack(slotStack, 3, 29, false))
if(!mergeItemStack(slotStack, 4, 30, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 3, inventorySlots.size(), true))
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}

View file

@ -21,8 +21,8 @@ public class ContainerChemicalWasher extends Container
public ContainerChemicalWasher(InventoryPlayer inventory, TileEntityChemicalWasher tentity)
{
tileEntity = tentity;
addSlotToContainer(new Slot(tentity, 0, -20, 9));
addSlotToContainer(new SlotOutput(tentity, 1, -20, 40));
addSlotToContainer(new Slot(tentity, 0, 180, 71));
addSlotToContainer(new SlotOutput(tentity, 1, 180, 102));
addSlotToContainer(new SlotStorageTank(tentity, 2, 155, 56));
addSlotToContainer(new SlotDischarge(tentity, 3, 155, 5));

View file

@ -26,15 +26,15 @@ public class ContainerElectricMachine extends Container
addSlotToContainer(new SlotMachineUpgrade(tentity, 3, 180, 11));
int slotX;
for(slotX = 0; slotX < 3; ++slotX)
for(slotX = 0; slotX < 3; slotX++)
{
for(int slotY = 0; slotY < 9; ++slotY)
for(int slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
}
}
for(slotX = 0; slotX < 9; ++slotX)
for(slotX = 0; slotX < 9; slotX++)
{
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB