mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 19:59:58 +00:00
Add all types of buffer and a lot of clean up to ALL GUIs.
Configurable IO rate still needed
This commit is contained in:
1 parent
b4d5a88a75
commit
3add27b550
46 files changed
+559
-327
No files matched your search
@@ -422,6 +422,10 @@ tile.blockExperienceObelisk.tooltip.detailed.line1=Stores Experience
|
||||
tile.blockExperienceObelisk.tooltip.detailed.line2=Can output liquid XP to
|
||||
tile.blockExperienceObelisk.tooltip.detailed.line3=adjacent tanks
|
||||
|
||||
tile.blockBuffer.basic.name=Item Buffer
|
||||
tile.blockBuffer.power.name=Power Buffer
|
||||
tile.blockBuffer.omni.name=Omni Buffer
|
||||
|
||||
enderio.machine.tooltip.configured=(Configured)
|
||||
|
||||
//Blocks
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 257 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 257 KiB After Width: | Height: | Size: 257 KiB |
@@ -71,6 +71,12 @@ public class IconButtonEIO extends GuiButton {
|
||||
}
|
||||
}
|
||||
|
||||
public IconButtonEIO setPosition(int x, int y) {
|
||||
this.xOrigin = x;
|
||||
this.yOrigin = y;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IconButtonEIO setIconMargin(int x, int y) {
|
||||
marginX = x;
|
||||
marginY = y;
|
||||
|
||||
@@ -94,7 +94,8 @@ public final class IconEIO {
|
||||
|
||||
public static final IconEIO IO_WHATSIT = new IconEIO(192, 148, 13, 13);
|
||||
|
||||
public static final IconEIO RECIPE = new IconEIO(128, 116, 24, 24);
|
||||
public static final IconEIO RECIPE = new IconEIO(16, 132, 16, 16);
|
||||
public static final IconEIO RECIPE_BUTTON = new IconEIO(128, 116, 24, 24);
|
||||
|
||||
public static final IconEIO ADD_BUT = new IconEIO(139, 246, 10, 10);
|
||||
public static final IconEIO MINUS_BUT = new IconEIO(129, 246, 10, 10);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package crazypants.enderio.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -214,27 +213,16 @@ public abstract class AbstractMachineBlock<T extends AbstractMachineEntity> exte
|
||||
public int quantityDropped(Random r) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
if(!world.isRemote) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof AbstractMachineEntity) {
|
||||
AbstractMachineEntity machineEntity = (AbstractMachineEntity) te;
|
||||
ItemStack itemStack = new ItemStack(this);
|
||||
machineEntity.writeToItemStack(itemStack);
|
||||
ret.add(itemStack);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
protected boolean shouldDropDefaultItem(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
if(!world.isRemote && (!player.capabilities.isCreativeMode)) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof AbstractMachineEntity) {
|
||||
if(te instanceof AbstractMachineEntity && shouldDropDefaultItem(world, player, x, y, z)) {
|
||||
AbstractMachineEntity machineEntity = (AbstractMachineEntity) te;
|
||||
int meta = damageDropped(world.getBlockMetadata(x, y, z));
|
||||
ItemStack itemStack = new ItemStack(this, 1, meta);
|
||||
@@ -250,7 +238,7 @@ public abstract class AbstractMachineBlock<T extends AbstractMachineEntity> exte
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
return super.removedByPlayer(world, player, x, y, z);
|
||||
return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,7 @@ import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
|
||||
private TileAlloySmelter tileEntity;
|
||||
public class GuiAlloySmelter extends GuiPoweredMachineBase<TileAlloySmelter> {
|
||||
|
||||
private IconButton vanillaFurnaceButton;
|
||||
|
||||
@@ -28,7 +26,6 @@ public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
|
||||
public GuiAlloySmelter(InventoryPlayer par1InventoryPlayer, TileAlloySmelter furnaceInventory) {
|
||||
super(furnaceInventory, new ContainerAlloySmelter(par1InventoryPlayer, furnaceInventory));
|
||||
this.tileEntity = furnaceInventory;
|
||||
|
||||
addToolTip(new GuiToolTip(new Rectangle(0, 0, 0, 0), "") {
|
||||
|
||||
@@ -37,9 +34,9 @@ public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
text.clear();
|
||||
text.add(Lang.localize("gui.alloy.mode.heading"));
|
||||
String txt = Lang.localize("gui.alloy.mode.all");
|
||||
if(tileEntity.getMode() == Mode.ALLOY) {
|
||||
if(getTileEntity().getMode() == Mode.ALLOY) {
|
||||
txt = Lang.localize("gui.alloy.mode.alloy");
|
||||
} else if(tileEntity.getMode() == Mode.FURNACE) {
|
||||
} else if(getTileEntity().getMode() == Mode.FURNACE) {
|
||||
txt = Lang.localize("gui.alloy.mode.furnace");
|
||||
}
|
||||
text.add(txt);
|
||||
@@ -54,6 +51,7 @@ public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
@@ -69,7 +67,7 @@ public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
|
||||
@Override
|
||||
protected void renderSlotHighlight(int slot, Vector4f col) {
|
||||
if(tileEntity.getSlotDefinition().isOutputSlot(slot)) {
|
||||
if(getTileEntity().getSlotDefinition().isOutputSlot(slot)) {
|
||||
renderSlotHighlight(col, 75, 54, 24, 24);
|
||||
} else {
|
||||
super.renderSlotHighlight(slot, col);
|
||||
@@ -79,9 +77,9 @@ public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton.id == SMELT_MODE_BUTTON_ID) {
|
||||
tileEntity.setMode(tileEntity.getMode().next());
|
||||
getTileEntity().setMode(getTileEntity().getMode().next());
|
||||
vanillaFurnaceButton.setIcon(getIconForMode());
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketClientState(tileEntity));
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketClientState(getTileEntity()));
|
||||
} else {
|
||||
super.actionPerformed(par1GuiButton);
|
||||
}
|
||||
@@ -89,9 +87,9 @@ public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
|
||||
private IIcon getIconForMode() {
|
||||
IIcon icon = EnderIO.blockAlloySmelter.vanillaSmeltingOn;
|
||||
if(tileEntity.getMode() == Mode.ALLOY) {
|
||||
if(getTileEntity().getMode() == Mode.ALLOY) {
|
||||
icon = EnderIO.blockAlloySmelter.vanillaSmeltingOff;
|
||||
} else if(tileEntity.getMode() == Mode.FURNACE) {
|
||||
} else if(getTileEntity().getMode() == Mode.FURNACE) {
|
||||
icon = EnderIO.blockAlloySmelter.vanillaSmeltingOnly;
|
||||
}
|
||||
return icon;
|
||||
@@ -112,8 +110,8 @@ public class GuiAlloySmelter extends GuiPoweredMachineBase {
|
||||
|
||||
int scaled;
|
||||
|
||||
if(tileEntity.getProgress() < 1 && tileEntity.getProgress() > 0) {
|
||||
scaled = tileEntity.getProgressScaled(14) + 1;
|
||||
if(getTileEntity().getProgress() < 1 && getTileEntity().getProgress() > 0) {
|
||||
scaled = getTileEntity().getProgressScaled(14) + 1;
|
||||
drawTexturedModalRect(sx + 55, sy + 49 - scaled, 176, 14 - scaled, 14, scaled);
|
||||
drawTexturedModalRect(sx + 103, sy + 49 - scaled, 176, 14 - scaled, 14, scaled);
|
||||
}
|
||||
|
||||
@@ -14,16 +14,14 @@ import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiAttractor extends GuiPoweredMachineBase {
|
||||
public class GuiAttractor extends GuiPoweredMachineBase<TileAttractor> {
|
||||
|
||||
private static final int RANGE_ID = 8738924;
|
||||
|
||||
private TileAttractor ta;
|
||||
private ToggleButtonEIO showRangeB;
|
||||
|
||||
public GuiAttractor(InventoryPlayer par1InventoryPlayer, TileAttractor te) {
|
||||
super(te, new ContainerAttractor(par1InventoryPlayer, te));
|
||||
ta = te;
|
||||
|
||||
int x = getXSize() - 5 - BUTTON_SIZE;
|
||||
showRangeB = new ToggleButtonEIO(this, RANGE_ID, x, 44, IconEIO.ADD_BUT, IconEIO.ADD_BUT);
|
||||
@@ -35,14 +33,14 @@ public class GuiAttractor extends GuiPoweredMachineBase {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
showRangeB.onGuiInit();
|
||||
showRangeB.setSelected(ta.isShowingRange());
|
||||
showRangeB.setSelected(getTileEntity().isShowingRange());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
super.actionPerformed(b);
|
||||
if(b.id == RANGE_ID) {
|
||||
ta.setShowRange(showRangeB.isSelected());
|
||||
getTileEntity().setShowRange(showRangeB.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +55,7 @@ public class GuiAttractor extends GuiPoweredMachineBase {
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
|
||||
int range = (int) ta.getRange();
|
||||
int range = (int) getTileEntity().getRange();
|
||||
drawCenteredString(fontRendererObj, Lang.localize("gui.spawnGurad.range") + " " + range, getGuiLeft() + sx/2 + 9, getGuiTop() + 68, ColorUtil.getRGB(Color.white));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
package crazypants.enderio.machine.buffer;
|
||||
|
||||
import info.jbcs.minecraft.chisel.api.IFacade;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
@@ -19,7 +27,7 @@ import crazypants.enderio.machine.painter.BasicPainterTemplate;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
|
||||
public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFacade {
|
||||
|
||||
|
||||
public static BlockBuffer create() {
|
||||
BlockBuffer res = new BlockBuffer();
|
||||
res.init();
|
||||
@@ -33,8 +41,9 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_BUFFER, this);
|
||||
GameRegistry.registerBlock(this, BlockItemBuffer.class, modObject.unlocalisedName);
|
||||
GameRegistry.registerTileEntity(teClass, modObject.unlocalisedName + "TileEntity");
|
||||
EnderIO.guiHandler.registerGuiHandler(getGuiId(), this);
|
||||
MachineRecipeRegistry.instance.registerRecipe(ModObject.blockPainter.unlocalisedName, new PainterTemplate());
|
||||
}
|
||||
|
||||
@@ -89,22 +98,53 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack par6ItemStack) {
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
if(entity instanceof EntityPlayer) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileBuffer) {
|
||||
TileBuffer ta = (TileBuffer) te;
|
||||
ta.setSourceBlock(PainterUtil.getSourceBlock(par6ItemStack));
|
||||
ta.setSourceBlockMetadata(PainterUtil.getSourceBlockMetadata(par6ItemStack));
|
||||
if(stack.stackTagCompound != null) {
|
||||
ta.readCommon(stack.stackTagCompound);
|
||||
}
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldDropDefaultItem(World world, EntityPlayer player, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack createItemStackForSourceBlock(Block block, int damage) {
|
||||
ItemStack result = new ItemStack(this, 1, damage);
|
||||
PainterUtil.setSourceBlock(result, block, damage);
|
||||
return result;
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
if(!world.isRemote) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileBuffer) {
|
||||
TileBuffer cb = (TileBuffer) te;
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
dropBlockAsItem(world, x, y, z, createDrop(cb));
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
}
|
||||
|
||||
private ItemStack createDrop(TileBuffer te) {
|
||||
ItemStack stack = new ItemStack(this, 1, BlockItemBuffer.Type.get(te).ordinal());
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
te.writeCommon(stack.stackTagCompound);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public ItemStack createItemStackForSourceBlock(ItemStack machine, Block block, int sourceMeta) {
|
||||
PainterUtil.setSourceBlock(machine, block, sourceMeta);
|
||||
return machine;
|
||||
}
|
||||
|
||||
public final class PainterTemplate extends BasicPainterTemplate {
|
||||
@@ -119,7 +159,8 @@ public class BlockBuffer extends AbstractMachineBlock<TileBuffer> implements IFa
|
||||
if(paintSource == null) {
|
||||
return new ResultStack[0];
|
||||
}
|
||||
return new ResultStack[] { new ResultStack(createItemStackForSourceBlock(Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage())) };
|
||||
return new ResultStack[] { new ResultStack(createItemStackForSourceBlock(MachineRecipeInput.getInputForSlot(0, inputs).copy(),
|
||||
Block.getBlockFromItem(paintSource.getItem()), paintSource.getItemDamage())) };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package crazypants.enderio.machine.buffer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlockWithMetadata;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import crazypants.enderio.ModObject;
|
||||
|
||||
public class BlockItemBuffer extends ItemBlockWithMetadata {
|
||||
|
||||
public enum Type {
|
||||
BASIC(true, false, false),
|
||||
POWER(false, true, false),
|
||||
OMNI(true, true, false),
|
||||
CREATIVE(true, true, true);
|
||||
|
||||
final boolean hasInventory;
|
||||
final boolean hasPower;
|
||||
final boolean isCreative;
|
||||
|
||||
private Type(boolean hasInventory, boolean hasPower, boolean isCreative) {
|
||||
this.hasInventory = hasInventory;
|
||||
this.hasPower = hasPower;
|
||||
this.isCreative = isCreative;
|
||||
}
|
||||
|
||||
public static Type get(TileBuffer buffer) {
|
||||
return !buffer.hasPower() ? BASIC : !buffer.hasInventory() ? POWER : !buffer.isCreative() ? OMNI : CREATIVE;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return "tile." + ModObject.blockBuffer.unlocalisedName + "." + name().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
public BlockItemBuffer(Block block) {
|
||||
super(block, block);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (Type type : Type.values()) {
|
||||
list.add(new ItemStack(item, 1, type.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return Type.values()[stack.getItemDamage()].getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||
super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
if(world.getBlock(x, y, z) == field_150939_a) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileBuffer) {
|
||||
TileBuffer buffer = ((TileBuffer) te);
|
||||
Type t = Type.values()[metadata];
|
||||
buffer.setHasInventory(t.hasInventory);
|
||||
buffer.setHasPower(t.hasPower);
|
||||
buffer.setCreative(t.isCreative);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,26 @@ import java.awt.Point;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.gui.AbstractMachineContainer;
|
||||
|
||||
public class ContainerBuffer extends AbstractMachineContainer {
|
||||
|
||||
public ContainerBuffer(InventoryPlayer playerInv, AbstractMachineEntity te) {
|
||||
|
||||
public ContainerBuffer(InventoryPlayer playerInv, TileBuffer te) {
|
||||
super(playerInv, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addMachineSlots(InventoryPlayer playerInv) {
|
||||
Point point = new Point(62, 15);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(this.tileEntity, i, point.x + ((i % 3) * 18), point.y + ((i / 3) * 18)));
|
||||
if(((TileBuffer)tileEntity).hasInventory()) {
|
||||
Point point = new Point(62, 15);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(this.tileEntity, i, point.x + ((i % 3) * 18), point.y + ((i / 3) * 18)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPlayerInventoryOffset() {
|
||||
return new Point(8, 96);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,21 @@
|
||||
package crazypants.enderio.machine.buffer;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import crazypants.enderio.machine.gui.GuiMachineBase;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiBuffer extends GuiMachineBase {
|
||||
|
||||
public class GuiBuffer extends GuiPoweredMachineBase<TileBuffer> {
|
||||
|
||||
public GuiBuffer(InventoryPlayer par1InventoryPlayer, TileBuffer te) {
|
||||
super(te, new ContainerBuffer(par1InventoryPlayer, te));
|
||||
redstoneButton.setPosition(116, 24);
|
||||
configB.setPosition(116, 42);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -17,6 +23,36 @@ public class GuiBuffer extends GuiMachineBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean renderPowerBar() {
|
||||
return getTileEntity().hasPower();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYSize() {
|
||||
return ySize + 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerHeight() {
|
||||
return 52;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerX() {
|
||||
return 48;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerY() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPowerV() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -24,8 +60,51 @@ public class GuiBuffer extends GuiMachineBase {
|
||||
int sx = (width - xSize) / 2;
|
||||
int sy = (height - ySize) / 2;
|
||||
|
||||
drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
|
||||
|
||||
drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
|
||||
|
||||
if (getTileEntity().hasPower()) {
|
||||
drawPowerBg(sx, sy);
|
||||
}
|
||||
|
||||
if (getTileEntity().hasInventory()) {
|
||||
drawSlotBg(sx, sy);
|
||||
}
|
||||
|
||||
String invName = Lang.localize(getTileEntity().getInventoryName() + ".name", false);
|
||||
getFontRenderer().drawStringWithShadow(invName, sx + (xSize / 2) - (getFontRenderer().getStringWidth(invName) / 2), sy + 4, 0xFFFFFF);
|
||||
RenderUtil.bindTexture("enderio:textures/gui/buffer.png");
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
}
|
||||
|
||||
public void renderSlotHighlights(IoMode mode) {
|
||||
for (int slot = 0; slot <= getTileEntity().getSizeInventory(); slot++) {
|
||||
renderSlotHighlight(slot, mode);
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderSlotHighlight(int slot, IoMode mode) {
|
||||
Slot invSlot = (Slot) inventorySlots.inventorySlots.get(slot);
|
||||
if (mode == IoMode.PULL) {
|
||||
renderSlotHighlight(slot, PULL_COLOR);
|
||||
} else if (mode == IoMode.PUSH) {
|
||||
renderSlotHighlight(slot, PUSH_COLOR);
|
||||
} else if (mode == IoMode.PUSH_PULL) {
|
||||
renderSplitHighlight(invSlot.xDisplayPosition, invSlot.yDisplayPosition, 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
protected void renderSplitHighlight(int x, int y, int width, int height) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
RenderUtil.renderQuad2D(getGuiLeft() + x, getGuiTop() + y, 0, width, height / 2, PULL_COLOR);
|
||||
RenderUtil.renderQuad2D(getGuiLeft() + x, getGuiTop() + y + (height / 2), 0, width, height / 2, PUSH_COLOR);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private void drawPowerBg(int sx, int sy) {
|
||||
drawTexturedModalRect(sx + 47, sy + 14, xSize + 10, 0, 12, 54);
|
||||
}
|
||||
|
||||
private void drawSlotBg(int sx, int sy) {
|
||||
drawTexturedModalRect(sx + 61, sy + 14, xSize + 22, 0, 54, 54);
|
||||
}
|
||||
}
|
||||
@@ -5,25 +5,33 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.machine.AbstractPowerConsumerEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
import crazypants.enderio.machine.painter.IPaintableTileEntity;
|
||||
import crazypants.enderio.machine.painter.PainterUtil;
|
||||
import crazypants.enderio.power.PowerDistributor;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class TileBuffer extends AbstractMachineEntity implements IPaintableTileEntity {
|
||||
public class TileBuffer extends AbstractPowerConsumerEntity implements IPaintableTileEntity {
|
||||
|
||||
private Block sourceBlock;
|
||||
private int sourceBlockMetadata;
|
||||
|
||||
private boolean hasPower, hasInventory, isCreative;
|
||||
|
||||
private PowerDistributor dist;
|
||||
|
||||
private final int maxOut = Config.powerConduitTierThreeRF;
|
||||
|
||||
public TileBuffer() {
|
||||
super(new SlotDefinition(9, 0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMachineName() {
|
||||
return ModObject.blockBuffer.unlocalisedName;
|
||||
return BlockItemBuffer.Type.get(this).getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,24 +46,71 @@ public class TileBuffer extends AbstractMachineEntity implements IPaintableTileE
|
||||
|
||||
@Override
|
||||
public float getProgress() {
|
||||
return 0; // no tasks
|
||||
return 0; // none
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean processTasks(boolean redstoneCheckPassed) {
|
||||
return false; // no tasks
|
||||
if (getEnergyStored() <= 0) {
|
||||
return false;
|
||||
}
|
||||
if (dist == null) {
|
||||
dist = new PowerDistributor(new BlockCoord(this));
|
||||
}
|
||||
int transmitted = dist.transmitEnergy(worldObj, Math.min(maxOut, getEnergyStored()));
|
||||
setEnergyStored(getEnergyStored() - transmitted);
|
||||
return transmitted > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIoMode(ForgeDirection faceHit, IoMode mode) {
|
||||
super.setIoMode(faceHit, mode);
|
||||
if (dist != null) {
|
||||
dist.neighboursChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack var2, int side) {
|
||||
return super.canInsertItem(slot, var2, side) && getIoMode(ForgeDirection.VALID_DIRECTIONS[side]).canRecieveInput();
|
||||
return hasInventory() && super.canInsertItem(slot, var2, side) && getIoMode(ForgeDirection.VALID_DIRECTIONS[side]).canRecieveInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemstack, int side) {
|
||||
return super.canExtractItem(slot, itemstack, side) && getIoMode(ForgeDirection.VALID_DIRECTIONS[side]).canOutput();
|
||||
return hasInventory() && super.canExtractItem(slot, itemstack, side) && getIoMode(ForgeDirection.VALID_DIRECTIONS[side]).canOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
return hasPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyRecieved(ForgeDirection dir) {
|
||||
return maxOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return hasPower() ? super.receiveEnergy(from, maxReceive, isCreative() || simulate) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean doPull(ForgeDirection dir) {
|
||||
ItemStack[] invCopy = new ItemStack[inventory.length];
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
invCopy[i] = inventory[i] == null ? null : inventory[i].copy();
|
||||
}
|
||||
|
||||
boolean ret = super.doPull(dir);
|
||||
|
||||
if(isCreative()) {
|
||||
inventory = invCopy;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean doPush(ForgeDirection dir) {
|
||||
|
||||
@@ -63,9 +118,29 @@ public class TileBuffer extends AbstractMachineEntity implements IPaintableTileE
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack[] invCopy = new ItemStack[inventory.length];
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
invCopy[i] = inventory[i] == null ? null : inventory[i].copy();
|
||||
}
|
||||
|
||||
BlockCoord loc = getLocation().getLocation(dir);
|
||||
TileEntity te = worldObj.getTileEntity(loc.x, loc.y, loc.z);
|
||||
return doPush(dir, te, slotDefinition.minInputSlot, slotDefinition.maxInputSlot);
|
||||
|
||||
boolean ret = super.doPush(dir, te, slotDefinition.minInputSlot, slotDefinition.maxInputSlot);
|
||||
|
||||
if(isCreative()) {
|
||||
inventory = invCopy;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound nbtRoot) {
|
||||
super.writeCustomNBT(nbtRoot);
|
||||
nbtRoot.setBoolean("hasInv", hasInventory);
|
||||
nbtRoot.setBoolean("hasPower", hasPower);
|
||||
nbtRoot.setBoolean("creative", isCreative);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,6 +149,14 @@ public class TileBuffer extends AbstractMachineEntity implements IPaintableTileE
|
||||
PainterUtil.setSourceBlock(nbtRoot, sourceBlock, sourceBlockMetadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound nbtRoot) {
|
||||
super.readCustomNBT(nbtRoot);
|
||||
this.hasInventory = nbtRoot.getBoolean("hasInv");
|
||||
this.hasPower = nbtRoot.getBoolean("hasPower");
|
||||
this.isCreative = nbtRoot.getBoolean("creative");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCommon(NBTTagCompound nbtRoot) {
|
||||
super.readCommon(nbtRoot);
|
||||
@@ -100,4 +183,29 @@ public class TileBuffer extends AbstractMachineEntity implements IPaintableTileE
|
||||
public Block getSourceBlock() {
|
||||
return sourceBlock;
|
||||
}
|
||||
|
||||
public boolean hasInventory() {
|
||||
return hasInventory;
|
||||
}
|
||||
|
||||
public void setHasInventory(boolean hasInventory) {
|
||||
this.hasInventory = hasInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPower() {
|
||||
return hasPower;
|
||||
}
|
||||
|
||||
public void setHasPower(boolean hasPower) {
|
||||
this.hasPower = hasPower;
|
||||
}
|
||||
|
||||
public boolean isCreative() {
|
||||
return isCreative;
|
||||
}
|
||||
|
||||
public void setCreative(boolean isCreative) {
|
||||
this.isCreative = isCreative;
|
||||
}
|
||||
}
|
||||
@@ -17,15 +17,12 @@ import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class GuiCrafter extends GuiPoweredMachineBase {
|
||||
|
||||
private IItemBuffer entity;
|
||||
public class GuiCrafter extends GuiPoweredMachineBase<TileCrafter> {
|
||||
|
||||
private ToggleButtonEIO bufferSizeB;
|
||||
|
||||
public GuiCrafter(InventoryPlayer par1InventoryPlayer, TileCrafter te) {
|
||||
super(te, new ContainerCrafter(par1InventoryPlayer, te));
|
||||
entity = te;
|
||||
xSize = getXSize();
|
||||
|
||||
int x = getXSize() - 5 - 16;
|
||||
@@ -46,8 +43,8 @@ public class GuiCrafter extends GuiPoweredMachineBase {
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
super.actionPerformed(b);
|
||||
if(b == bufferSizeB) {
|
||||
entity.setBufferStacks(bufferSizeB.isSelected());
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemBuffer(entity));
|
||||
getTileEntity().setBufferStacks(bufferSizeB.isSelected());
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemBuffer(getTileEntity()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,13 +7,10 @@ import org.lwjgl.opengl.GL11;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class GuiCrusher extends GuiPoweredMachineBase {
|
||||
|
||||
private TileCrusher tileEntity;
|
||||
public class GuiCrusher extends GuiPoweredMachineBase<TileCrusher> {
|
||||
|
||||
public GuiCrusher(InventoryPlayer par1InventoryPlayer, TileCrusher inventory) {
|
||||
super(inventory, new ContainerCrusher(par1InventoryPlayer, inventory));
|
||||
tileEntity = inventory;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,10 +26,10 @@ public class GuiCrusher extends GuiPoweredMachineBase {
|
||||
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
int barHeight = tileEntity.getProgressScaled(24);
|
||||
int barHeight = getTileEntity().getProgressScaled(24);
|
||||
drawTexturedModalRect(guiLeft + 79, guiTop + 31, 200, 0, 18, barHeight + 1);
|
||||
|
||||
barHeight = tileEntity.getBallDurationScaled(16);
|
||||
barHeight = getTileEntity().getBallDurationScaled(16);
|
||||
if(barHeight > 0) {
|
||||
drawTexturedModalRect(guiLeft + 142, guiTop + 23 + (16 - barHeight), 186, 31, 4, barHeight);
|
||||
}
|
||||
|
||||
@@ -16,14 +16,10 @@ import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
public class GuiFarmStation extends GuiPoweredMachineBase {
|
||||
|
||||
private TileFarmStation farm;
|
||||
public class GuiFarmStation extends GuiPoweredMachineBase<TileFarmStation> {
|
||||
|
||||
public GuiFarmStation(InventoryPlayer par1InventoryPlayer, TileFarmStation machine) {
|
||||
super(machine, new FarmStationContainer(par1InventoryPlayer, machine));
|
||||
|
||||
this.farm = machine;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -43,15 +39,15 @@ public class GuiFarmStation extends GuiPoweredMachineBase {
|
||||
|
||||
private int id = 0;
|
||||
private IconButtonEIO createButton(int x, int y) {
|
||||
return new ToggleButtonEIO(this, id, x, y, IconEIO.UNLOCKED, IconEIO.LOCKED).setSelected(farm.lockedSlots.contains(id++ + farm.minSupSlot)).setIconMargin(3, 3);
|
||||
return new ToggleButtonEIO(this, id, x, y, IconEIO.UNLOCKED, IconEIO.LOCKED).setSelected(getTileEntity().lockedSlots.contains(id++ + getTileEntity().minSupSlot)).setIconMargin(3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawForegroundImpl(int mouseX, int mouseY) {
|
||||
super.drawForegroundImpl(mouseX, mouseY);
|
||||
|
||||
if(inventorySlots.inventorySlots.size() >= farm.maxSupSlot && !isConfigOverlayEnabled()) {
|
||||
for (int i : farm.lockedSlots) {
|
||||
if(inventorySlots.inventorySlots.size() >= getTileEntity().maxSupSlot && !isConfigOverlayEnabled()) {
|
||||
for (int i : getTileEntity().lockedSlots) {
|
||||
if (i < inventorySlots.inventorySlots.size()) { // hack to allow old broken farms to be opened
|
||||
Slot slot = inventorySlots.getSlot(i);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -86,7 +82,7 @@ public class GuiFarmStation extends GuiPoweredMachineBase {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
if (b instanceof ToggleButtonEIO) {
|
||||
farm.toggleLockedState(b.id);
|
||||
getTileEntity().toggleLockedState(b.id);
|
||||
}
|
||||
super.actionPerformed(b);
|
||||
}
|
||||
|
||||
+8
-11
@@ -17,13 +17,10 @@ import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiCombustionGenerator extends GuiPoweredMachineBase {
|
||||
|
||||
private TileCombustionGenerator gen;
|
||||
public class GuiCombustionGenerator extends GuiPoweredMachineBase<TileCombustionGenerator> {
|
||||
|
||||
public GuiCombustionGenerator(InventoryPlayer par1InventoryPlayer, TileCombustionGenerator te) {
|
||||
super(te, new ContainerCombustionEngine(par1InventoryPlayer, te));
|
||||
gen = te;
|
||||
|
||||
addToolTip(new GuiToolTip(new Rectangle(114, 21, 15, 47), "") {
|
||||
|
||||
@@ -31,11 +28,11 @@ public class GuiCombustionGenerator extends GuiPoweredMachineBase {
|
||||
protected void updateText() {
|
||||
text.clear();
|
||||
String heading = Lang.localize("combustionGenerator.coolantTank");
|
||||
if(gen.getCoolantTank().getFluid() != null) {
|
||||
heading += ": " + gen.getCoolantTank().getFluid().getFluid().getLocalizedName();
|
||||
if(getTileEntity().getCoolantTank().getFluid() != null) {
|
||||
heading += ": " + getTileEntity().getCoolantTank().getFluid().getLocalizedName();
|
||||
}
|
||||
text.add(heading);
|
||||
text.add(Fluids.toCapactityString(gen.getCoolantTank()));
|
||||
text.add(Fluids.toCapactityString(getTileEntity().getCoolantTank()));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -46,11 +43,11 @@ public class GuiCombustionGenerator extends GuiPoweredMachineBase {
|
||||
protected void updateText() {
|
||||
text.clear();
|
||||
String heading = Lang.localize("combustionGenerator.fuelTank");
|
||||
if(gen.getFuelTank().getFluid() != null) {
|
||||
heading += ": " + gen.getFuelTank().getFluid().getFluid().getLocalizedName();
|
||||
if(getTileEntity().getFuelTank().getFluid() != null) {
|
||||
heading += ": " + getTileEntity().getFuelTank().getFluid().getLocalizedName();
|
||||
}
|
||||
text.add(heading);
|
||||
text.add(Fluids.toCapactityString(gen.getFuelTank()));
|
||||
text.add(Fluids.toCapactityString(getTileEntity().getFuelTank()));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -85,7 +82,7 @@ public class GuiCombustionGenerator extends GuiPoweredMachineBase {
|
||||
int sx = (width - xSize) / 2;
|
||||
int sy = (height - ySize) / 2;
|
||||
drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
|
||||
int scaled;
|
||||
TileCombustionGenerator gen = getTileEntity();
|
||||
|
||||
FontRenderer fr = getFontRenderer();
|
||||
int output = 0;
|
||||
|
||||
+6
-9
@@ -16,13 +16,10 @@ import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiStirlingGenerator extends GuiPoweredMachineBase {
|
||||
|
||||
private TileEntityStirlingGenerator entity;
|
||||
public class GuiStirlingGenerator extends GuiPoweredMachineBase<TileEntityStirlingGenerator> {
|
||||
|
||||
public GuiStirlingGenerator(InventoryPlayer par1InventoryPlayer, TileEntityStirlingGenerator te) {
|
||||
super(te, new StirlingGeneratorContainer(par1InventoryPlayer, te));
|
||||
this.entity = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,8 +37,8 @@ public class GuiStirlingGenerator extends GuiPoweredMachineBase {
|
||||
drawTexturedModalRect(sx, sy, 0, 0, this.xSize, this.ySize);
|
||||
int scaled;
|
||||
|
||||
if(entity.getProgress() < 1 && entity.getProgress() > 0) {
|
||||
scaled = entity.getProgressScaled(12);
|
||||
if(getTileEntity().getProgress() < 1 && getTileEntity().getProgress() > 0) {
|
||||
scaled = getTileEntity().getProgressScaled(12);
|
||||
drawTexturedModalRect(sx + 80, sy + 64 - scaled, 176, 12 - scaled, 14, scaled + 2);
|
||||
}
|
||||
|
||||
@@ -51,15 +48,15 @@ public class GuiStirlingGenerator extends GuiPoweredMachineBase {
|
||||
int y = guiTop + fr.FONT_HEIGHT / 2 + 3;
|
||||
|
||||
int output = 0;
|
||||
if(entity.isActive()) {
|
||||
output = entity.getPowerUsePerTick();
|
||||
if(getTileEntity().isActive()) {
|
||||
output = getTileEntity().getPowerUsePerTick();
|
||||
}
|
||||
String txt = Lang.localize("stirlingGenerator.output") + " " + PowerDisplayUtil.formatPower(output) + " " + PowerDisplayUtil.abrevation()
|
||||
+ PowerDisplayUtil.perTickStr();
|
||||
int sw = fr.getStringWidth(txt);
|
||||
fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, y, ColorUtil.getRGB(Color.WHITE));
|
||||
|
||||
txt = Lang.localize("stirlingGenerator.burnRate") + " " + (entity.getBurnTimeMultiplier()) + "x";
|
||||
txt = Lang.localize("stirlingGenerator.burnRate") + " " + (getTileEntity().getBurnTimeMultiplier()) + "x";
|
||||
sw = fr.getStringWidth(txt);
|
||||
y += fr.FONT_HEIGHT + 3;
|
||||
fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, y, ColorUtil.getRGB(Color.WHITE));
|
||||
|
||||
@@ -17,14 +17,11 @@ import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiZombieGenerator extends GuiPoweredMachineBase {
|
||||
|
||||
private TileZombieGenerator gen;
|
||||
public class GuiZombieGenerator extends GuiPoweredMachineBase<TileZombieGenerator> {
|
||||
|
||||
public GuiZombieGenerator(InventoryPlayer inventory, TileZombieGenerator tileEntity) {
|
||||
super(tileEntity, new ContainerZombieGenerator(inventory, tileEntity));
|
||||
gen = tileEntity;
|
||||
|
||||
|
||||
addToolTip(new GuiToolTip(new Rectangle(80, 21, 15, 47), "") {
|
||||
|
||||
@Override
|
||||
@@ -32,7 +29,7 @@ public class GuiZombieGenerator extends GuiPoweredMachineBase {
|
||||
text.clear();
|
||||
String heading = Lang.localize("zombieGenerator.fuelTank");
|
||||
text.add(heading);
|
||||
text.add(Fluids.toCapactityString(gen.fuelTank));
|
||||
text.add(Fluids.toCapactityString(getTileEntity().fuelTank));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -65,7 +62,7 @@ public class GuiZombieGenerator extends GuiPoweredMachineBase {
|
||||
int sx = (width - xSize) / 2;
|
||||
int sy = (height - ySize) / 2;
|
||||
drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
|
||||
int scaled;
|
||||
TileZombieGenerator gen = getTileEntity();
|
||||
|
||||
FontRenderer fr = getFontRenderer();
|
||||
int output = 0;
|
||||
|
||||
@@ -11,6 +11,7 @@ import crazypants.enderio.gui.IconButtonEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.gui.IoConfigRenderer.SelectedFace;
|
||||
import crazypants.enderio.gui.RedstoneModeButton;
|
||||
import crazypants.enderio.gui.ToggleButtonEIO;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.SlotDefinition;
|
||||
@@ -20,23 +21,26 @@ import crazypants.util.BlockCoord;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
public abstract class GuiMachineBase<T extends AbstractMachineEntity> extends GuiContainerBase {
|
||||
|
||||
public static final Vector4f PUSH_COLOR = new Vector4f(0.8f, 0.4f, 0.1f, 0.5f);
|
||||
public static final Vector4f PULL_COLOR = new Vector4f(0.1f, 0.4f, 0.8f, 0.5f);
|
||||
|
||||
public static final int BUTTON_SIZE = 16;
|
||||
private static final int CONFIG_ID = 8962349;
|
||||
private static final int RECIPE_ID = CONFIG_ID + 1;
|
||||
|
||||
private AbstractMachineEntity tileEntity;
|
||||
private T tileEntity;
|
||||
|
||||
protected RedstoneModeButton redstoneButton;
|
||||
|
||||
private GuiOverlayIoConfig configOverlay;
|
||||
|
||||
protected IconButtonEIO configB;
|
||||
protected ToggleButtonEIO configB;
|
||||
|
||||
protected IconButtonEIO recipeButton;
|
||||
|
||||
protected GuiMachineBase(AbstractMachineEntity machine, Container par1Container) {
|
||||
protected GuiMachineBase(T machine, Container par1Container) {
|
||||
super(par1Container);
|
||||
tileEntity = machine;
|
||||
|
||||
@@ -47,7 +51,7 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
redstoneButton = new RedstoneModeButton(this, -1, x, y, tileEntity, new BlockCoord(tileEntity));
|
||||
|
||||
y += 19;
|
||||
configB = new IconButtonEIO(this, CONFIG_ID, x, y, IconEIO.IO_CONFIG_UP);
|
||||
configB = new ToggleButtonEIO(this, CONFIG_ID, x, y, IconEIO.IO_CONFIG_UP, IconEIO.IO_CONFIG_DOWN);
|
||||
configB.setToolTip(Lang.localize("gui.machine.ioMode.overlay.tooltip"));
|
||||
|
||||
configOverlay = new GuiOverlayIoConfig(machine) {
|
||||
@@ -55,11 +59,17 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
configB.setIcon(visible ? IconEIO.IO_CONFIG_DOWN : IconEIO.IO_CONFIG_UP);
|
||||
configB.setSelected(visible);
|
||||
}
|
||||
|
||||
};
|
||||
addOverlay(configOverlay);
|
||||
|
||||
y += 19;
|
||||
|
||||
recipeButton = new IconButtonEIO(this, RECIPE_ID, x, y, IconEIO.RECIPE);
|
||||
recipeButton.visible = false;
|
||||
recipeButton.setIconMargin(3, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,6 +86,7 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
super.initGui();
|
||||
redstoneButton.onGuiInit();
|
||||
configB.onGuiInit();
|
||||
recipeButton.onGuiInit();
|
||||
}
|
||||
|
||||
protected boolean showRecipeButton() {
|
||||
@@ -86,20 +97,16 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int k = (width - xSize) / 2;
|
||||
int l = (height - ySize) / 2;
|
||||
|
||||
for (int i = 0; i < buttonList.size(); ++i) {
|
||||
GuiButton guibutton = (GuiButton) buttonList.get(i);
|
||||
guibutton.drawButton(mc, 0, 0);
|
||||
}
|
||||
|
||||
if(showRecipeButton()) {
|
||||
IconEIO.RECIPE.renderIcon(k + 155, l + 43, 16, 16, 0, true);
|
||||
recipeButton.visible = true;
|
||||
}
|
||||
|
||||
renderSlotHighlights();
|
||||
|
||||
}
|
||||
|
||||
public void renderSlotHighlights() {
|
||||
@@ -140,4 +147,8 @@ public abstract class GuiMachineBase extends GuiContainerBase {
|
||||
protected boolean isConfigOverlayEnabled() {
|
||||
return configOverlay.isVisible();
|
||||
}
|
||||
|
||||
protected T getTileEntity() {
|
||||
return tileEntity;
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.IIcon;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.gui.IGuiOverlay;
|
||||
import crazypants.enderio.gui.IoConfigRenderer;
|
||||
import crazypants.enderio.gui.IoConfigRenderer.SelectedFace;
|
||||
@@ -114,9 +112,6 @@ public class GuiOverlayIoConfig implements IGuiOverlay {
|
||||
}
|
||||
|
||||
public SelectedFace getSelection() {
|
||||
return renderer.getSelection();
|
||||
return visible ? renderer.getSelection() : null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import crazypants.enderio.machine.AbstractPoweredMachineEntity;
|
||||
import crazypants.enderio.machine.power.PowerDisplayUtil;
|
||||
import crazypants.gui.GuiToolTip;
|
||||
|
||||
public abstract class GuiPoweredMachineBase extends GuiMachineBase {
|
||||
public abstract class GuiPoweredMachineBase<T extends AbstractPoweredMachineEntity> extends GuiMachineBase<T> {
|
||||
|
||||
protected static final int POWER_Y = 14;
|
||||
protected final int POWER_X = 15;
|
||||
@@ -19,11 +19,8 @@ public abstract class GuiPoweredMachineBase extends GuiMachineBase {
|
||||
protected static final int POWER_HEIGHT = 42;
|
||||
protected static final int BOTTOM_POWER_Y = POWER_Y + POWER_HEIGHT;
|
||||
|
||||
private AbstractPoweredMachineEntity tileEntity;
|
||||
|
||||
public GuiPoweredMachineBase(AbstractPoweredMachineEntity machine, Container container) {
|
||||
public GuiPoweredMachineBase(T machine, Container container) {
|
||||
super(machine, container);
|
||||
tileEntity = machine;
|
||||
if(renderPowerBar()) {
|
||||
addToolTip(new GuiToolTip(new Rectangle(getPowerX(), getPowerY(), getPowerWidth(), getPowerHeight()), "") {
|
||||
|
||||
@@ -44,18 +41,18 @@ public abstract class GuiPoweredMachineBase extends GuiMachineBase {
|
||||
}
|
||||
|
||||
protected int getPowerOutputValue() {
|
||||
return tileEntity.getPowerUsePerTick();
|
||||
return getTileEntity().getPowerUsePerTick();
|
||||
}
|
||||
|
||||
protected void updatePowerBarTooltip(List<String> text) {
|
||||
text.add(getPowerOutputLabel() + PowerDisplayUtil.formatPower(getPowerOutputValue()) + " " + PowerDisplayUtil.abrevation()
|
||||
+ PowerDisplayUtil.perTickStr());
|
||||
text.add(PowerDisplayUtil.formatStoredPower(tileEntity.getEnergyStored(), tileEntity.getCapacitor().getMaxEnergyStored()));
|
||||
text.add(PowerDisplayUtil.formatStoredPower(getTileEntity().getEnergyStored(), getTileEntity().getCapacitor().getMaxEnergyStored()));
|
||||
}
|
||||
|
||||
public void renderPowerBar(int k, int l) {
|
||||
if(renderPowerBar()) {
|
||||
int i1 = tileEntity.getEnergyStoredScaled(getPowerHeight());
|
||||
int i1 = getTileEntity().getEnergyStoredScaled(getPowerHeight());
|
||||
// x, y, u, v, width, height
|
||||
drawTexturedModalRect(k + getPowerX(), l + (getPowerY() + getPowerHeight()) - i1, getPowerU(), getPowerV(), getPowerWidth(), i1);
|
||||
}
|
||||
|
||||
@@ -20,19 +20,16 @@ import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
import crazypants.util.SoundUtil;
|
||||
|
||||
public class GuiKillerJoe extends GuiMachineBase {
|
||||
public class GuiKillerJoe extends GuiMachineBase<TileKillerJoe> {
|
||||
|
||||
private static final int XP_ID = 3489;
|
||||
private static final int XP10_ID = 34892;
|
||||
|
||||
private TileKillerJoe joe;
|
||||
|
||||
private IconButtonEIO xpB;
|
||||
private IconButtonEIO xp10B;
|
||||
|
||||
public GuiKillerJoe(InventoryPlayer inventory, TileKillerJoe tileEntity) {
|
||||
super(tileEntity, new ContainerKillerJoe(inventory, tileEntity));
|
||||
joe = tileEntity;
|
||||
|
||||
addToolTip(new GuiToolTip(new Rectangle(18, 11, 15, 47), "") {
|
||||
|
||||
@@ -41,7 +38,7 @@ public class GuiKillerJoe extends GuiMachineBase {
|
||||
text.clear();
|
||||
String heading = Lang.localize("killerJoe.fuelTank");
|
||||
text.add(heading);
|
||||
text.add(Fluids.toCapactityString(joe.fuelTank));
|
||||
text.add(Fluids.toCapactityString(getTileEntity().fuelTank));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -65,11 +62,11 @@ public class GuiKillerJoe extends GuiMachineBase {
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
super.actionPerformed(b);
|
||||
if(b.id == XP_ID) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketGivePlayerXP(joe, 1));
|
||||
SoundUtil.playClientSoundFX("random.orb", joe);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketGivePlayerXP(getTileEntity(), 1));
|
||||
SoundUtil.playClientSoundFX("random.orb", getTileEntity());
|
||||
} else if(b.id == XP10_ID) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketGivePlayerXP(joe, 10));
|
||||
SoundUtil.playClientSoundFX("random.orb", joe);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketGivePlayerXP(getTileEntity(), 10));
|
||||
SoundUtil.playClientSoundFX("random.orb", getTileEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +99,7 @@ public class GuiKillerJoe extends GuiMachineBase {
|
||||
|
||||
int x = guiLeft + 18;
|
||||
int y = guiTop + 11;
|
||||
TileKillerJoe joe = getTileEntity();
|
||||
if(joe.fuelTank.getFluidAmount() > 0) {
|
||||
RenderUtil.renderGuiTank(joe.fuelTank.getFluid(), joe.fuelTank.getCapacity(), joe.fuelTank.getFluidAmount(), x, y, zLevel, 16, 47);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,6 @@ public class BlockElectricLight extends BlockEio implements IRedstoneConnectable
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
Item equipped = stack.getItem();
|
||||
ITool tool = ToolUtil.getEquippedTool(player);
|
||||
if(tool != null && tool.canUse(stack, player, x, y, z) && player.isSneaking() && !world.isRemote) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
@@ -217,24 +216,6 @@ public class BlockElectricLight extends BlockEio implements IRedstoneConnectable
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
|
||||
ArrayList<ItemStack> res = new ArrayList<ItemStack>();
|
||||
if(!world.isRemote) {
|
||||
TileEntity t = world.getTileEntity(x, y, z);
|
||||
TileElectricLight te = null;
|
||||
if(t instanceof TileElectricLight) {
|
||||
te = (TileElectricLight) t;
|
||||
}
|
||||
if(t != null) {
|
||||
ItemStack st = createDrop(te);
|
||||
res.add(st);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private ItemStack createDrop(TileElectricLight te) {
|
||||
int meta = te.isInvereted() ? 1 : 0;
|
||||
if(!te.isRequiresPower()) {
|
||||
@@ -246,9 +227,8 @@ public class BlockElectricLight extends BlockEio implements IRedstoneConnectable
|
||||
return st;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||
if(!world.isRemote) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileElectricLight) {
|
||||
@@ -258,7 +238,7 @@ public class BlockElectricLight extends BlockEio implements IRedstoneConnectable
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.removedByPlayer(world, player, x, y, z);
|
||||
return super.removedByPlayer(world, player, x, y, z, willHarvest);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,6 @@ import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.AbstractPoweredMachineEntity;
|
||||
|
||||
public class BlockPainter extends AbstractMachineBlock<TileEntityPainter> {
|
||||
|
||||
@@ -44,7 +43,7 @@ public class BlockPainter extends AbstractMachineBlock<TileEntityPainter> {
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
return new GuiPainter(player.inventory, (AbstractPoweredMachineEntity) te);
|
||||
return new GuiPainter(player.inventory, (TileEntityPainter) te);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,19 +7,15 @@ import org.lwjgl.opengl.GL11;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.AbstractPoweredMachineEntity;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiPainter extends GuiPoweredMachineBase {
|
||||
public class GuiPainter extends GuiPoweredMachineBase<TileEntityPainter> {
|
||||
|
||||
private AbstractMachineEntity tileEntity;
|
||||
|
||||
public GuiPainter(InventoryPlayer par1InventoryPlayer, AbstractPoweredMachineEntity furnaceInventory) {
|
||||
super(furnaceInventory, new PainterContainer(par1InventoryPlayer, furnaceInventory));
|
||||
tileEntity = furnaceInventory;
|
||||
public GuiPainter(InventoryPlayer par1InventoryPlayer, TileEntityPainter te) {
|
||||
super(te, new PainterContainer(par1InventoryPlayer, te));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +32,7 @@ public class GuiPainter extends GuiPoweredMachineBase {
|
||||
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
|
||||
int i1;
|
||||
|
||||
i1 = tileEntity.getProgressScaled(24);
|
||||
i1 = getTileEntity().getProgressScaled(24);
|
||||
drawTexturedModalRect(k + 88, l + 34, 176, 14, i1 + 1, 16);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
@@ -49,7 +45,7 @@ public class GuiPainter extends GuiPoweredMachineBase {
|
||||
|
||||
@Override
|
||||
protected void renderSlotHighlight(int slot, Vector4f col) {
|
||||
if(tileEntity.getSlotDefinition().isOutputSlot(slot)) {
|
||||
if(getTileEntity().getSlotDefinition().isOutputSlot(slot)) {
|
||||
renderSlotHighlight(col, 117,31,24,24);
|
||||
} else if(slot != 1) {
|
||||
super.renderSlotHighlight(slot, col);
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BlockSliceAndSplice extends AbstractMachineBlock<TileSliceAndSplice
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof TileSliceAndSplice) {
|
||||
return new GuiSliceAndSplice(player.inventory, (AbstractPoweredMachineEntity) te);
|
||||
return new GuiSliceAndSplice(player.inventory, (TileSliceAndSplice) te);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4,18 +4,13 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.AbstractPoweredMachineEntity;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class GuiSliceAndSplice extends GuiPoweredMachineBase {
|
||||
public class GuiSliceAndSplice extends GuiPoweredMachineBase<TileSliceAndSplice> {
|
||||
|
||||
private AbstractMachineEntity tileEntity;
|
||||
|
||||
public GuiSliceAndSplice(InventoryPlayer par1InventoryPlayer, AbstractPoweredMachineEntity te) {
|
||||
public GuiSliceAndSplice(InventoryPlayer par1InventoryPlayer, TileSliceAndSplice te) {
|
||||
super(te, new ContainerSliceAndSplice(par1InventoryPlayer, te));
|
||||
tileEntity = te;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +27,7 @@ public class GuiSliceAndSplice extends GuiPoweredMachineBase {
|
||||
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
|
||||
int i1;
|
||||
|
||||
i1 = tileEntity.getProgressScaled(24);
|
||||
i1 = getTileEntity().getProgressScaled(24);
|
||||
drawTexturedModalRect(k + 101, l + 46, 176, 14, i1 + 1, 16);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
|
||||
@@ -1,42 +1,29 @@
|
||||
package crazypants.enderio.machine.soul;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
|
||||
import crazypants.enderio.gui.IconButtonEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.enderio.machine.painter.PainterContainer;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.xp.ExperienceBarRenderer;
|
||||
import crazypants.enderio.xp.PacketDrainPlayerXP;
|
||||
import crazypants.enderio.xp.XpUtil;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.SoundUtil;
|
||||
import crazypants.vecmath.Vector4f;
|
||||
|
||||
public class GuiSoulBinder extends GuiPoweredMachineBase {
|
||||
public class GuiSoulBinder extends GuiPoweredMachineBase<TileSoulBinder> {
|
||||
|
||||
private static final int PLAYER_XP_ID = 985162394;
|
||||
|
||||
private TileSoulBinder tileEntity;
|
||||
|
||||
private IconButtonEIO usePlayerXP;
|
||||
|
||||
public GuiSoulBinder(InventoryPlayer par1InventoryPlayer, TileSoulBinder te) {
|
||||
super(te, new ContainerSoulBinder(par1InventoryPlayer, te));
|
||||
tileEntity = te;
|
||||
usePlayerXP = new IconButtonEIO(this, PLAYER_XP_ID, 125, 57, IconEIO.XP);
|
||||
usePlayerXP.visible = false;
|
||||
usePlayerXP.setToolTip("Use Player XP");
|
||||
@@ -54,8 +41,8 @@ public class GuiSoulBinder extends GuiPoweredMachineBase {
|
||||
if(b.id == PLAYER_XP_ID) {
|
||||
int xp = XpUtil.getPlayerXP(Minecraft.getMinecraft().thePlayer);
|
||||
if(xp > 0 || Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketDrainPlayerXP(tileEntity, tileEntity.getCurrentlyRequiredLevel(), true));
|
||||
SoundUtil.playClientSoundFX("random.orb", tileEntity);
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketDrainPlayerXP(getTileEntity(), getTileEntity().getCurrentlyRequiredLevel(), true));
|
||||
SoundUtil.playClientSoundFX("random.orb", getTileEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,13 +61,15 @@ public class GuiSoulBinder extends GuiPoweredMachineBase {
|
||||
drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
int i1;
|
||||
|
||||
i1 = tileEntity.getProgressScaled(24);
|
||||
TileSoulBinder binder = getTileEntity();
|
||||
|
||||
i1 = binder.getProgressScaled(24);
|
||||
drawTexturedModalRect(k + 80, l + 34, 176, 14, i1 + 1, 16);
|
||||
|
||||
boolean needsXp = tileEntity.getCurrentlyRequiredLevel() > 0 && tileEntity.getCurrentlyRequiredLevel() > tileEntity.getContainer().getExperienceLevel();
|
||||
boolean needsXp = getTileEntity().getCurrentlyRequiredLevel() > 0 && binder.getCurrentlyRequiredLevel() > binder.getContainer().getExperienceLevel();
|
||||
usePlayerXP.visible = needsXp;
|
||||
|
||||
ExperienceBarRenderer.render(this, getGuiLeft() + 56, getGuiTop() + 68, 65, tileEntity.getContainer(), tileEntity.getCurrentlyRequiredLevel());
|
||||
ExperienceBarRenderer.render(this, getGuiLeft() + 56, getGuiTop() + 68, 65, binder.getContainer(), binder.getCurrentlyRequiredLevel());
|
||||
|
||||
RenderUtil.bindTexture("enderio:textures/gui/soulFuser.png");
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
|
||||
@@ -15,17 +15,13 @@ import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class GuiPoweredSpawner extends GuiPoweredMachineBase {
|
||||
public class GuiPoweredSpawner extends GuiPoweredMachineBase<TilePoweredSpawner> {
|
||||
|
||||
private IconButtonEIO modeB;
|
||||
|
||||
private TilePoweredSpawner spawner;
|
||||
|
||||
public GuiPoweredSpawner(InventoryPlayer par1InventoryPlayer, TilePoweredSpawner te) {
|
||||
super(te, new ContainerPoweredSpawner(par1InventoryPlayer, te));
|
||||
|
||||
spawner = te;
|
||||
|
||||
modeB = new IconButtonEIO(this, 8888, 115, 10, IconEIO.RIGHT_ARROW);
|
||||
modeB.setSize(10, 16);
|
||||
}
|
||||
@@ -39,8 +35,8 @@ public class GuiPoweredSpawner extends GuiPoweredMachineBase {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton par1GuiButton) {
|
||||
if(par1GuiButton == modeB) {
|
||||
spawner.setSpawnMode(!spawner.isSpawnMode());
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketMode(spawner));
|
||||
getTileEntity().setSpawnMode(!getTileEntity().isSpawnMode());
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketMode(getTileEntity()));
|
||||
} else {
|
||||
super.actionPerformed(par1GuiButton);
|
||||
}
|
||||
@@ -57,6 +53,8 @@ public class GuiPoweredSpawner extends GuiPoweredMachineBase {
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
|
||||
TilePoweredSpawner spawner = getTileEntity();
|
||||
|
||||
int left = getGuiLeft();
|
||||
int top = getGuiTop();
|
||||
|
||||
|
||||
@@ -14,16 +14,14 @@ import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiSpawnGurad extends GuiPoweredMachineBase {
|
||||
public class GuiSpawnGurad extends GuiPoweredMachineBase<TileSpawnGuard> {
|
||||
|
||||
TileSpawnGuard sg;
|
||||
ToggleButtonEIO showRangeB;
|
||||
|
||||
private static final int RANGE_ID = 8738924;
|
||||
|
||||
public GuiSpawnGurad(InventoryPlayer par1InventoryPlayer, TileSpawnGuard te) {
|
||||
super(te, new ContainerSpawnGuard(par1InventoryPlayer, te));
|
||||
sg = te;
|
||||
|
||||
int x = getXSize() - 5 - BUTTON_SIZE;
|
||||
showRangeB = new ToggleButtonEIO(this, RANGE_ID, x, 44, IconEIO.ADD_BUT, IconEIO.ADD_BUT);
|
||||
@@ -35,7 +33,7 @@ public class GuiSpawnGurad extends GuiPoweredMachineBase {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
showRangeB.onGuiInit();
|
||||
showRangeB.setSelected(sg.isShowingRange());
|
||||
showRangeB.setSelected(getTileEntity().isShowingRange());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +47,7 @@ public class GuiSpawnGurad extends GuiPoweredMachineBase {
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
|
||||
int range = (int) sg.getRange();
|
||||
int range = (int) getTileEntity().getRange();
|
||||
drawCenteredString(fontRendererObj, Lang.localize("gui.spawnGurad.range") + " " + range, getGuiLeft() + sx/2 + 9, getGuiTop() + 68, ColorUtil.getRGB(Color.white));
|
||||
}
|
||||
|
||||
@@ -57,7 +55,7 @@ public class GuiSpawnGurad extends GuiPoweredMachineBase {
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
super.actionPerformed(b);
|
||||
if(b.id == RANGE_ID) {
|
||||
sg.setShowRange(showRangeB.isSelected());
|
||||
getTileEntity().setShowRange(showRangeB.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import crazypants.gui.GuiToolTip;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiTank extends GuiMachineBase {
|
||||
public class GuiTank extends GuiMachineBase<TileTank> {
|
||||
|
||||
private TileTank entity;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GuiTank extends GuiMachineBase {
|
||||
text.clear();
|
||||
String heading = Lang.localize("tank.tank");
|
||||
if(entity.tank.getFluid() != null) {
|
||||
heading += ": " + entity.tank.getFluid().getFluid().getLocalizedName();
|
||||
heading += ": " + entity.tank.getFluid().getLocalizedName();
|
||||
}
|
||||
text.add(heading);
|
||||
text.add(Fluids.toCapactityString(entity.tank));
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ChannelTab implements ITabPanel {
|
||||
public ChannelTab(GuiTransceiver guiTransceiver, ChannelType type) {
|
||||
parent = guiTransceiver;
|
||||
this.type = type;
|
||||
transceiver = guiTransceiver.transceiver;
|
||||
transceiver = guiTransceiver.getTransciever();
|
||||
|
||||
newChannelTF = new GuiTextField(parent.getFontRenderer(), 7, 12, 103, 16);
|
||||
addButton = new IconButtonEIO(parent, ADD_BUTTON_ID, 137, 12, IconEIO.PLUS);
|
||||
|
||||
@@ -33,10 +33,10 @@ public class FilterTab implements ITabPanel {
|
||||
|
||||
FilterTab(GuiTransceiver parent) {
|
||||
this.parent = parent;
|
||||
container = parent.container;
|
||||
sendGui = new BasicItemFilterGui(parent, new FilterContainer(parent.entity, true), false, container.getFilterOffset().x,
|
||||
container = parent.getContainer();
|
||||
sendGui = new BasicItemFilterGui(parent, new FilterContainer(parent.getTransciever(), true), false, container.getFilterOffset().x,
|
||||
container.getFilterOffset().y, 0);
|
||||
recGui = new BasicItemFilterGui(parent, new FilterContainer(parent.entity, true), false, container.getFilterOffset().x,
|
||||
recGui = new BasicItemFilterGui(parent, new FilterContainer(parent.getTransciever(), true), false, container.getFilterOffset().x,
|
||||
container.getFilterOffset().y, 20);
|
||||
|
||||
sendRecB = new IconButtonEIO(parent, 8888, container.getFilterOffset().x + 79, container.getFilterOffset().y - 20, IconEIO.RIGHT_ARROW);
|
||||
@@ -45,7 +45,7 @@ public class FilterTab implements ITabPanel {
|
||||
|
||||
@Override
|
||||
public void onGuiInit(int x, int y, int width, int height) {
|
||||
parent.container.setPlayerInventoryVisible(true);
|
||||
parent.getContainer().setPlayerInventoryVisible(true);
|
||||
sendRecB.onGuiInit();
|
||||
updateSendRecieve();
|
||||
|
||||
@@ -53,13 +53,13 @@ public class FilterTab implements ITabPanel {
|
||||
|
||||
protected void updateSendRecieve() {
|
||||
if(showSend) {
|
||||
parent.container.setSendFilterSlotsVisible(true);
|
||||
parent.container.setReceiveFilterSlotsVisible(false);
|
||||
parent.getContainer().setSendFilterSlotsVisible(true);
|
||||
parent.getContainer().setReceiveFilterSlotsVisible(false);
|
||||
sendGui.updateButtons();
|
||||
recGui.deactivate();
|
||||
} else {
|
||||
parent.container.setSendFilterSlotsVisible(false);
|
||||
parent.container.setReceiveFilterSlotsVisible(true);
|
||||
parent.getContainer().setSendFilterSlotsVisible(false);
|
||||
parent.getContainer().setReceiveFilterSlotsVisible(true);
|
||||
sendGui.deactivate();
|
||||
recGui.updateButtons();
|
||||
}
|
||||
@@ -67,9 +67,9 @@ public class FilterTab implements ITabPanel {
|
||||
|
||||
@Override
|
||||
public void deactivate() {
|
||||
parent.container.setPlayerInventoryVisible(false);
|
||||
parent.container.setSendFilterSlotsVisible(false);
|
||||
parent.container.setReceiveFilterSlotsVisible(false);
|
||||
parent.getContainer().setPlayerInventoryVisible(false);
|
||||
parent.getContainer().setSendFilterSlotsVisible(false);
|
||||
parent.getContainer().setReceiveFilterSlotsVisible(false);
|
||||
sendGui.deactivate();
|
||||
recGui.deactivate();
|
||||
sendRecB.detach();
|
||||
|
||||
@@ -32,14 +32,14 @@ public class GeneralTab implements ITabPanel {
|
||||
|
||||
public GeneralTab(GuiTransceiver guiTransceiver) {
|
||||
parent = guiTransceiver;
|
||||
container = parent.container;
|
||||
container = parent.getContainer();
|
||||
|
||||
int x = parent.getXSize() - 5 - 16;
|
||||
int y = 43;
|
||||
bufferSizeB = new ToggleButtonEIO(parent, 4327, x, y, IconEIO.ITEM_SINGLE, IconEIO.ITEM_STACK);
|
||||
bufferSizeB.setSelectedToolTip("Buffering item stacks");
|
||||
bufferSizeB.setUnselectedToolTip("Buffering single items");
|
||||
bufferSizeB.setSelected(parent.transceiver.isBufferStacks());
|
||||
bufferSizeB.setSelected(parent.getTransciever().isBufferStacks());
|
||||
|
||||
sendPowerBarTT = new GuiToolTip(new Rectangle(parent.getPowerX() + SEND_BAR_OFFSET, parent.getPowerY(), parent.getPowerWidth(), parent.getPowerHeight()), "") {
|
||||
@Override
|
||||
@@ -111,7 +111,7 @@ public class GeneralTab implements ITabPanel {
|
||||
parent.drawTexturedModalRect(x, y, 233, 196, 12, maxHeight + 2);
|
||||
parent.drawTexturedModalRect(x + SEND_BAR_OFFSET, y, 233, 196, 12, maxHeight + 2);
|
||||
|
||||
int totalPixelHeight = parent.transceiver.getEnergyStoredScaled(maxHeight * 2);
|
||||
int totalPixelHeight = parent.getTransciever().getEnergyStoredScaled(maxHeight * 2);
|
||||
int fillHeight = Math.min(totalPixelHeight,maxHeight);
|
||||
|
||||
int fillY = y + 1 + parent.getPowerHeight() - fillHeight;
|
||||
@@ -127,16 +127,16 @@ public class GeneralTab implements ITabPanel {
|
||||
public void updatePowerBarTooltip(List<String> text) {
|
||||
text.add("Local Buffer");
|
||||
text.add("Upkeep: " + PowerDisplayUtil.formatPowerPerTick(parent.getPowerOutputValue()));
|
||||
int maxEnergy = parent.transceiver.getCapacitor().getMaxEnergyStored()/2;
|
||||
int energyStored = Math.min(parent.transceiver.getEnergyStored(), maxEnergy);
|
||||
int maxEnergy = parent.getTransciever().getCapacitor().getMaxEnergyStored()/2;
|
||||
int energyStored = Math.min(parent.getTransciever().getEnergyStored(), maxEnergy);
|
||||
text.add(PowerDisplayUtil.formatStoredPower(energyStored, maxEnergy));
|
||||
}
|
||||
|
||||
private void updateSendPowerBarTooltip(List<String> text) {
|
||||
text.add("Send/Recieve Buffer");
|
||||
text.add("Max IO: " + PowerDisplayUtil.formatPowerPerTick(Config.transceiverMaxIoRF));
|
||||
int maxEnergy = parent.transceiver.getCapacitor().getMaxEnergyStored()/2;
|
||||
int energyStored = Math.max(0, parent.transceiver.getEnergyStored() - maxEnergy);
|
||||
int maxEnergy = parent.getTransciever().getCapacitor().getMaxEnergyStored()/2;
|
||||
int energyStored = Math.max(0, parent.getTransciever().getEnergyStored() - maxEnergy);
|
||||
text.add(PowerDisplayUtil.formatStoredPower(energyStored, maxEnergy));
|
||||
}
|
||||
|
||||
@@ -144,8 +144,8 @@ public class GeneralTab implements ITabPanel {
|
||||
@Override
|
||||
public void actionPerformed(GuiButton guiButton) {
|
||||
if(guiButton == bufferSizeB) {
|
||||
parent.entity.setBufferStacks(bufferSizeB.isSelected());
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemBuffer(parent.entity));
|
||||
parent.getTransciever().setBufferStacks(bufferSizeB.isSelected());
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketItemBuffer(parent.getTransciever()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,26 +18,17 @@ import crazypants.enderio.machine.transceiver.ChannelType;
|
||||
import crazypants.enderio.machine.transceiver.TileTransceiver;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class GuiTransceiver extends GuiPoweredMachineBase {
|
||||
public class GuiTransceiver extends GuiPoweredMachineBase<TileTransceiver> {
|
||||
|
||||
private static final int TAB_HEIGHT = 24;
|
||||
|
||||
TileTransceiver entity;
|
||||
|
||||
private int activeTab = 0;
|
||||
private final List<ITabPanel> tabs = new ArrayList<ITabPanel>();
|
||||
private int tabYOffset = 4;
|
||||
|
||||
ContainerTransceiver container;
|
||||
TileTransceiver transceiver;
|
||||
|
||||
GeneralTab generalTab;
|
||||
|
||||
public GuiTransceiver(InventoryPlayer par1InventoryPlayer, TileTransceiver te) {
|
||||
super(te, new ContainerTransceiver(par1InventoryPlayer, te));
|
||||
entity = te;
|
||||
container = (ContainerTransceiver) inventorySlots;
|
||||
transceiver = te;
|
||||
|
||||
generalTab = new GeneralTab(this);
|
||||
tabs.add(generalTab);
|
||||
@@ -234,5 +225,12 @@ public class GuiTransceiver extends GuiPoweredMachineBase {
|
||||
tes.draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public TileTransceiver getTransciever() {
|
||||
return getTileEntity();
|
||||
}
|
||||
|
||||
public ContainerTransceiver getContainer() {
|
||||
return (ContainerTransceiver) inventorySlots;
|
||||
}
|
||||
}
|
||||
@@ -14,26 +14,22 @@ import org.lwjgl.opengl.GL11;
|
||||
import crazypants.enderio.fluid.Fluids;
|
||||
import crazypants.enderio.gui.IconButtonEIO;
|
||||
import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.enderio.machine.IMachineRecipe.ResultStack;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.enderio.machine.IoMode;
|
||||
import crazypants.enderio.machine.gui.GuiPoweredMachineBase;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.gui.GuiToolTip;
|
||||
import crazypants.render.ColorUtil;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class GuiVat extends GuiPoweredMachineBase {
|
||||
public class GuiVat extends GuiPoweredMachineBase<TileVat> {
|
||||
|
||||
private static final String GUI_TEXTURE = "enderio:textures/gui/vat.png";
|
||||
|
||||
private final TileVat vat;
|
||||
|
||||
private IconButtonEIO dump1, dump2;
|
||||
|
||||
public GuiVat(InventoryPlayer inventory, TileVat te) {
|
||||
super(te, new ContainerVat(inventory, te));
|
||||
vat = te;
|
||||
|
||||
addToolTip(new GuiToolTip(new Rectangle(30, 12, 15, 47), "") {
|
||||
|
||||
@@ -41,11 +37,11 @@ public class GuiVat extends GuiPoweredMachineBase {
|
||||
protected void updateText() {
|
||||
text.clear();
|
||||
String heading = Lang.localize("vat.inputTank");
|
||||
if(vat.inputTank.getFluid() != null) {
|
||||
heading += ": " + vat.inputTank.getFluid().getFluid().getLocalizedName();
|
||||
if(getTileEntity().inputTank.getFluid() != null) {
|
||||
heading += ": " + getTileEntity().inputTank.getFluid().getLocalizedName();
|
||||
}
|
||||
text.add(heading);
|
||||
text.add(Fluids.toCapactityString(vat.inputTank));
|
||||
text.add(Fluids.toCapactityString(getTileEntity().inputTank));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -56,11 +52,11 @@ public class GuiVat extends GuiPoweredMachineBase {
|
||||
protected void updateText() {
|
||||
text.clear();
|
||||
String heading = Lang.localize("vat.outputTank");
|
||||
if(vat.outputTank.getFluid() != null) {
|
||||
heading += ": " + vat.outputTank.getFluid().getFluid().getLocalizedName();
|
||||
if(getTileEntity().outputTank.getFluid() != null) {
|
||||
heading += ": " + getTileEntity().outputTank.getFluid().getLocalizedName();
|
||||
}
|
||||
text.add(heading);
|
||||
text.add(Fluids.toCapactityString(vat.outputTank));
|
||||
text.add(Fluids.toCapactityString(getTileEntity().outputTank));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -104,7 +100,8 @@ public class GuiVat extends GuiPoweredMachineBase {
|
||||
int guiLeft = (width - xSize) / 2;
|
||||
int guiTop = (height - ySize) / 2;
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
TileVat vat = getTileEntity();
|
||||
|
||||
if(vat.getProgress() < 1 && vat.getProgress() > 0) {
|
||||
int scaled = vat.getProgressScaled(14) + 1;
|
||||
drawTexturedModalRect(guiLeft + 81, guiTop + 77 - scaled, 176, 14 - scaled, 14, scaled);
|
||||
@@ -192,7 +189,7 @@ public class GuiVat extends GuiPoweredMachineBase {
|
||||
}
|
||||
|
||||
private void dump(int i) {
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketDumpTank(vat, i));
|
||||
PacketHandler.INSTANCE.sendToServer(new PacketDumpTank(getTileEntity(), i));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,86 +16,80 @@ import crazypants.enderio.xp.PacketDrainPlayerXP;
|
||||
import crazypants.enderio.xp.PacketGivePlayerXP;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
public class GuiExperianceObelisk extends GuiMachineBase {
|
||||
|
||||
private TileExperienceOblisk te;
|
||||
public class GuiExperianceObelisk extends GuiMachineBase<TileExperienceOblisk> {
|
||||
|
||||
private IconButtonEIO p;
|
||||
private IconButtonEIO pp;
|
||||
private IconButtonEIO ppp;
|
||||
|
||||
|
||||
private IconButtonEIO m;
|
||||
private IconButtonEIO mm;
|
||||
private IconButtonEIO mmm;
|
||||
|
||||
|
||||
public GuiExperianceObelisk(InventoryPlayer par1InventoryPlayer, TileExperienceOblisk te) {
|
||||
super(te, new ContainerExperianceObelisk());
|
||||
ySize = 115;
|
||||
this.te = te;
|
||||
|
||||
|
||||
int spacing = 5;
|
||||
int bw = 20;
|
||||
int startX = xSize/2 - bw/2 - spacing - bw;
|
||||
|
||||
int startX = xSize / 2 - bw / 2 - spacing - bw;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
||||
|
||||
x = startX;
|
||||
y = 20;
|
||||
p = new IconButtonEIO(this, 800, x, y, IconEIO.SINGLE_PLUS);
|
||||
p.setSize(bw, bw);
|
||||
p.setIconMargin(2, 2);
|
||||
p.setToolTip("Store 1", "level of player XP");
|
||||
|
||||
x+= spacing + bw;
|
||||
|
||||
x += spacing + bw;
|
||||
pp = new IconButtonEIO(this, 801, x, y, IconEIO.DOUBLE_PLUS);
|
||||
pp.setSize(bw, bw);
|
||||
pp.setIconMargin(2, 2);
|
||||
pp.setToolTip("Store 10", "levels of player XP");
|
||||
|
||||
x+= spacing + bw;
|
||||
|
||||
x += spacing + bw;
|
||||
ppp = new IconButtonEIO(this, 802, x, y, IconEIO.TRIPLE_PLUS);
|
||||
ppp.setSize(bw, bw);
|
||||
ppp.setIconMargin(2, 2);
|
||||
ppp.setToolTip("Store all", "player XP");
|
||||
|
||||
|
||||
x = startX;
|
||||
y = 75;
|
||||
m = new IconButtonEIO(this, 803, x, y, IconEIO.SINGLE_MINUS);
|
||||
m.setSize(bw, bw);
|
||||
m.setIconMargin(2, 2);
|
||||
m.setToolTip("Retrieve 1", "player XP level");
|
||||
|
||||
x+= spacing + bw;
|
||||
|
||||
x += spacing + bw;
|
||||
mm = new IconButtonEIO(this, 804, x, y, IconEIO.DOUBLE_MINUS);
|
||||
mm.setSize(bw, bw);
|
||||
mm.setIconMargin(2, 2);
|
||||
mm.setToolTip("Retrieve 10", "player XP levels");
|
||||
|
||||
x+= spacing + bw;
|
||||
|
||||
x += spacing + bw;
|
||||
mmm = new IconButtonEIO(this, 805, x, y, IconEIO.TRIPLE_MINUS);
|
||||
mmm.setSize(bw, bw);
|
||||
mmm.setIconMargin(2, 2);
|
||||
mmm.setToolTip("Retrieve all");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
p.onGuiInit();
|
||||
pp.onGuiInit();
|
||||
ppp.onGuiInit();
|
||||
|
||||
|
||||
m.onGuiInit();
|
||||
mm.onGuiInit();
|
||||
mmm.onGuiInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
protected void actionPerformed(GuiButton b) {
|
||||
super.actionPerformed(b);
|
||||
int levels = 0;
|
||||
if(b == p) {
|
||||
@@ -115,23 +109,21 @@ public class GuiExperianceObelisk extends GuiMachineBase {
|
||||
}
|
||||
|
||||
if(levels < 0) {
|
||||
|
||||
|
||||
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
int currLevel = player.experienceLevel;
|
||||
int currLevel = player.experienceLevel;
|
||||
int targetLevel = Math.max(0, currLevel + levels);
|
||||
|
||||
PacketDrainPlayerXP packet = new PacketDrainPlayerXP(te, targetLevel, false);
|
||||
|
||||
PacketDrainPlayerXP packet = new PacketDrainPlayerXP(getTileEntity(), targetLevel, false);
|
||||
PacketHandler.INSTANCE.sendToServer(packet);
|
||||
} else {
|
||||
|
||||
PacketGivePlayerXP packet = new PacketGivePlayerXP(te, levels);
|
||||
|
||||
PacketGivePlayerXP packet = new PacketGivePlayerXP(getTileEntity(), levels);
|
||||
PacketHandler.INSTANCE.sendToServer(packet);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
@@ -140,16 +132,16 @@ public class GuiExperianceObelisk extends GuiMachineBase {
|
||||
int sy = (height - ySize) / 2;
|
||||
|
||||
drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
|
||||
|
||||
|
||||
int width = 110;
|
||||
ExperienceBarRenderer.render(this, getGuiLeft() + xSize/2 - width/2, getGuiTop() + 55, width, te.getContainer());
|
||||
|
||||
ExperienceBarRenderer.render(this, getGuiLeft() + xSize / 2 - width / 2, getGuiTop() + 55, width, getTileEntity().getContainer());
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showRecipeButton() {
|
||||
protected boolean showRecipeButton() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler {
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 100, 52, 0x808080, false);
|
||||
|
||||
IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true);
|
||||
IconEIO.RECIPE_BUTTON.renderIcon(149, 32, 16, 16, 0, true);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
|
||||
@@ -127,7 +127,7 @@ public class EnchanterRecipeHandler extends TemplateRecipeHandler {
|
||||
GuiDraw.drawStringC(s, 83, 46, 0x80FF20);
|
||||
}
|
||||
|
||||
IconEIO.RECIPE.renderIcon(149, -3, 16, 16, 0, true);
|
||||
IconEIO.RECIPE_BUTTON.renderIcon(149, -3, 16, 16, 0, true);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
|
||||
@@ -116,7 +116,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler {
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 96, 33, 0x808080, false);
|
||||
|
||||
IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true);
|
||||
IconEIO.RECIPE_BUTTON.renderIcon(149, 32, 16, 16, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SliceAndSpliceRecipeHandler extends TemplateRecipeHandler {
|
||||
String energyString = PowerDisplayUtil.formatPower(recipe.getEnergy()) + " " + PowerDisplayUtil.abrevation();
|
||||
GuiDraw.drawString(energyString, 100, 57, 0x808080, false);
|
||||
|
||||
IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true);
|
||||
IconEIO.RECIPE_BUTTON.renderIcon(149, 32, 16, 16, 0, true);
|
||||
}
|
||||
|
||||
public List<ItemStack> getInputs(RecipeInput input) {
|
||||
|
||||
@@ -133,7 +133,7 @@ public class SoulBinderRecipeHandler extends TemplateRecipeHandler {
|
||||
GuiDraw.drawStringC(s, 83, 55, 0x80FF20);
|
||||
}
|
||||
|
||||
IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true);
|
||||
IconEIO.RECIPE_BUTTON.renderIcon(149, 32, 16, 16, 0, true);
|
||||
}
|
||||
|
||||
private static final ArrayList<PositionedStack> EMPTY_VIAL_OUTPUT = new ArrayList<PositionedStack>();
|
||||
|
||||
@@ -168,7 +168,7 @@ public class VatRecipeHandler extends TemplateRecipeHandler {
|
||||
GuiDraw.drawStringC(str, ps.relx + 8, ps.rely + 19, 0x808080, false);
|
||||
}
|
||||
|
||||
IconEIO.RECIPE.renderIcon(149, 32, 16, 16, 0, true);
|
||||
IconEIO.RECIPE_BUTTON.renderIcon(149, 32, 16, 16, 0, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.ListIterator;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.machine.AbstractMachineEntity;
|
||||
import crazypants.util.BlockCoord;
|
||||
|
||||
public class PowerDistributor {
|
||||
@@ -65,11 +66,14 @@ public class PowerDistributor {
|
||||
}
|
||||
receptors.clear();
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
BlockCoord checkLoc = bc.getLocation(dir);
|
||||
TileEntity te = worldObj.getTileEntity(checkLoc.x, checkLoc.y, checkLoc.z);
|
||||
IPowerInterface pi = PowerHandlerUtil.create(te);
|
||||
if(pi != null && pi.canConduitConnect(dir.getOpposite())) {
|
||||
receptors.add(new Receptor(pi, dir));
|
||||
TileEntity transmitter = worldObj.getTileEntity(bc.x, bc.y, bc.z);
|
||||
if(!(transmitter instanceof AbstractMachineEntity) || ((AbstractMachineEntity) transmitter).getIoMode(dir).canOutput()) {
|
||||
BlockCoord checkLoc = bc.getLocation(dir);
|
||||
TileEntity te = worldObj.getTileEntity(checkLoc.x, checkLoc.y, checkLoc.z);
|
||||
IPowerInterface pi = PowerHandlerUtil.create(te);
|
||||
if(pi != null && pi.canConduitConnect(dir.getOpposite())) {
|
||||
receptors.add(new Receptor(pi, dir));
|
||||
}
|
||||
}
|
||||
}
|
||||
receptorIterator = receptors.listIterator();
|
||||
|
||||
@@ -79,7 +79,6 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
protected boolean func_146978_c(int p_146978_1_, int p_146978_2_, int p_146978_3_, int p_146978_4_, int p_146978_5_, int p_146978_6_) {
|
||||
int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
||||
int b = Mouse.getEventButton();
|
||||
for(IGuiOverlay overlay : overlays) {
|
||||
if(overlay != null && overlay.isVisible() && overlay.isMouseInBounds(x, y)) {
|
||||
return false;
|
||||
@@ -148,6 +147,7 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void drawHoveringText(List par1List, int par2, int par3, FontRenderer font) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
@@ -159,7 +159,7 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
|
||||
//This is a copy of the super class method due to 'Method not found' errors
|
||||
// reported with some mods installed.
|
||||
protected void copyOfdrawHoveringText(List par1List, int par2, int par3, FontRenderer font) {
|
||||
protected void copyOfdrawHoveringText(List<String> par1List, int par2, int par3, FontRenderer font) {
|
||||
if(!par1List.isEmpty())
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
@@ -167,7 +167,7 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
int k = 0;
|
||||
Iterator iterator = par1List.iterator();
|
||||
Iterator<String> iterator = par1List.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
@@ -261,6 +261,7 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
return Minecraft.getMinecraft().fontRenderer;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void addButton(GuiButton button) {
|
||||
if(!buttonList.contains(button)) {
|
||||
|
||||
Reference in new issue
Block a user