and more...

This commit is contained in:
cp committed 2014-03-01 01:18:03 +08:00
1 parent a1921a3944
commit 869cf0eb31
9 files changed
+142 -149

No files matched your search

@@ -15,6 +15,9 @@ import crazypants.enderio.enderface.EnderIoRenderer;
import crazypants.enderio.enderface.TileEnderIO;
import crazypants.enderio.machine.light.BlockElectricLight;
import crazypants.enderio.machine.light.ElectricLightRenderer;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.power.CapBankRenderer2;
import crazypants.enderio.machine.power.CapacitorBankRenderer;
import crazypants.enderio.machine.reservoir.ReservoirRenderer;
import crazypants.enderio.machine.reservoir.TileReservoir;
import crazypants.enderio.material.BlockFusedQuartz;
@@ -89,13 +92,13 @@ public class ClientProxy extends CommonProxy {
BlockElectricLight.renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new ElectricLightRenderer());
//
// CapacitorBankRenderer capr = new CapacitorBankRenderer();
// MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCapacitorBank), capr);
//
// BlockCapacitorBank.renderId = RenderingRegistry.getNextAvailableRenderId();
// CapBankRenderer2 cbr2 = new CapBankRenderer2();
// RenderingRegistry.registerBlockHandler(cbr2);
CapacitorBankRenderer capr = new CapacitorBankRenderer();
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCapacitorBank), capr);
BlockCapacitorBank.renderId = RenderingRegistry.getNextAvailableRenderId();
CapBankRenderer2 cbr2 = new CapBankRenderer2();
RenderingRegistry.registerBlockHandler(cbr2);
//
FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer();
MinecraftForgeClient.registerItemRenderer(EnderIO.itemFusedQuartzFrame, fqfr);
@@ -26,6 +26,7 @@ import crazypants.enderio.machine.light.BlockElectricLight;
import crazypants.enderio.machine.light.BlockLightNode;
import crazypants.enderio.machine.monitor.BlockPowerMonitor;
import crazypants.enderio.machine.monitor.ItemMJReader;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.reservoir.BlockReservoir;
import crazypants.enderio.machine.solar.BlockSolarPanel;
import crazypants.enderio.material.Alloy;
@@ -97,7 +98,7 @@ public class EnderIO {
public static BlockSolarPanel blockSolarPanel;
public static BlockReservoir blockReservoir;
public static BlockAlloySmelter blockAlloySmelter;
// public static BlockCapacitorBank blockCapacitorBank;
public static BlockCapacitorBank blockCapacitorBank;
public static BlockCrusher blockCrusher;
// public static BlockHyperCube blockHyperCube;
public static BlockPowerMonitor blockPowerMonitor;
@@ -153,7 +154,7 @@ public class EnderIO {
blockSolarPanel = BlockSolarPanel.create();
blockReservoir = BlockReservoir.create();
blockAlloySmelter = BlockAlloySmelter.create();
// blockCapacitorBank = BlockCapacitorBank.create();
blockCapacitorBank = BlockCapacitorBank.create();
blockCrusher = BlockCrusher.create();
blockPowerMonitor = BlockPowerMonitor.create();
//
@@ -1,16 +1,16 @@
package crazypants.enderio.machine.power;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
@@ -18,24 +18,20 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.EnderIOTab;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.PacketHandler;
import crazypants.enderio.conduit.ConduitUtil;
import crazypants.enderio.enderface.BlockEio;
import crazypants.enderio.machine.power.TileCapacitorBank.FaceConnectionMode;
import crazypants.enderio.power.PowerHandlerUtil;
import crazypants.util.BlockCoord;
import crazypants.util.Util;
import crazypants.vecmath.Vector3d;
public class BlockCapacitorBank extends Block implements ITileEntityProvider, IGuiHandler {
public class BlockCapacitorBank extends BlockEio implements IGuiHandler {
public static int renderId = -1;
@@ -43,8 +39,9 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
BlockCapacitorBank res = new BlockCapacitorBank();
res.init();
CapacitorBankPacketHandler pp = new CapacitorBankPacketHandler();
PacketHandler.instance.addPacketProcessor(pp);
//TODO:1.7
//CapacitorBankPacketHandler pp = new CapacitorBankPacketHandler();
//PacketHandler.instance.addPacketProcessor(pp);
return res;
}
@@ -57,35 +54,43 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
private IIcon blockIconLocked;
protected BlockCapacitorBank() {
super(ModObject.blockCapacitorBank.actualId, new Material(MapColor.ironColor));
super(ModObject.blockCapacitorBank.unlocalisedName, TileCapacitorBank.class);
setHardness(2.0F);
setStepSound(soundMetalFootstep);
setUnlocalizedName("enderio." + ModObject.blockCapacitorBank.name());
setCreativeTab(EnderIOTab.tabEnderIO);
}
@Override
protected void init() {
GameRegistry.registerBlock(this, BlockItemCapacitorBank.class, ModObject.blockCapacitorBank.unlocalisedName);
GameRegistry.registerTileEntity(TileCapacitorBank.class, ModObject.blockCapacitorBank.unlocalisedName + "TileEntity");
super.init();
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_CAPACITOR_BANK, this);
lightOpacity[ModObject.blockCapacitorBank.actualId] = 255;
setLightOpacity(255);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List list) {
ItemStack is = BlockItemCapacitorBank.createItemStackWithPower(0);
list.add(is);
is = BlockItemCapacitorBank.createItemStackWithPower(TileCapacitorBank.BASE_CAP.getMaxEnergyStored());
list.add(is);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float par7, float par8, float par9) {
if(ConduitUtil.isToolEquipped(entityPlayer) && entityPlayer.isSneaking()) {
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof IToolWrench) {
IToolWrench wrench = (IToolWrench) entityPlayer.getCurrentEquippedItem().getItem();
if(wrench.canWrench(entityPlayer, x, y, z)) {
removeBlockByPlayer(world, entityPlayer, x, y, z);
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof IToolWrench) {
((IToolWrench) entityPlayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityPlayer, x, y, z);
}
return true;
}
}
}
//TODO:1.7
// if(ConduitUtil.isToolEquipped(entityPlayer) && entityPlayer.isSneaking()) {
// if(entityPlayer.getCurrentEquippedItem().getItem() instanceof IToolWrench) {
// IToolWrench wrench = (IToolWrench) entityPlayer.getCurrentEquippedItem().getItem();
// if(wrench.canWrench(entityPlayer, x, y, z)) {
// removeBlockByPlayer(world, entityPlayer, x, y, z);
// if(entityPlayer.getCurrentEquippedItem().getItem() instanceof IToolWrench) {
// ((IToolWrench) entityPlayer.getCurrentEquippedItem().getItem()).wrenchUsed(entityPlayer, x, y, z);
// }
// return true;
// }
// }
// }
if(entityPlayer.isSneaking()) {
return false;
@@ -94,20 +99,21 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
if(!(te instanceof TileCapacitorBank)) {
return false;
}
if(ConduitUtil.isToolEquipped(entityPlayer)) {
ForgeDirection faceHit = ForgeDirection.getOrientation(side);
TileCapacitorBank tcb = (TileCapacitorBank) te;
tcb.toggleModeForFace(faceHit);
if(world.isRemote) {
world.markBlockForRenderUpdate(x, y, z);
} else {
world.notifyBlocksOfNeighborChange(x, y, z, ModObject.blockCapacitorBank.actualId);
world.markBlockForUpdate(x, y, z);
}
return true;
}
//TODO:1.7
// if(ConduitUtil.isToolEquipped(entityPlayer)) {
//
// ForgeDirection faceHit = ForgeDirection.getOrientation(side);
// TileCapacitorBank tcb = (TileCapacitorBank) te;
// tcb.toggleModeForFace(faceHit);
// if(world.isRemote) {
// world.markBlockForRenderUpdate(x, y, z);
// } else {
// world.notifyBlocksOfNeighborChange(x, y, z, ModObject.blockCapacitorBank.actualId);
// world.markBlockForUpdate(x, y, z);
// }
//
// return true;
// }
entityPlayer.openGui(EnderIO.instance, GuiHandler.GUI_ID_CAPACITOR_BANK, world, x, y, z);
return true;
@@ -133,7 +139,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
@SideOnly(Side.CLIENT)
@Override
public void registerIcons(IIconRegister IIconRegister) {
public void registerBlockIcons(IIconRegister IIconRegister) {
blockIcon = IIconRegister.registerIcon("enderio:capacitorBank");
blockIconInput = IIconRegister.registerIcon("enderio:capacitorBankInput");
blockIconOutput = IIconRegister.registerIcon("enderio:capacitorBankOutput");
@@ -148,7 +154,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
}
@Override
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
return true;
}
@@ -162,25 +168,15 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
return false;
}
@Override
public TileEntity createNewTileEntity(World world) {
return null;
}
@Override
public TileEntity createTileEntity(World world, int metadata) {
return new TileCapacitorBank();
}
@Override
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
int i1 = par1IBlockAccess.getBlockId(par2, par3, par4);
return i1 == this.blockID ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
Block i1 = par1IBlockAccess.getBlock(par2, par3, par4);
return i1 == this ? false : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getBlockTexture(IBlockAccess ba, int x, int y, int z, int side) {
public IIcon getIcon(IBlockAccess ba, int x, int y, int z, int side) {
TileEntity te = ba.getTileEntity(x, y, z);
if(!(te instanceof TileCapacitorBank)) {
return blockIcon;
@@ -209,7 +205,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int blockId) {
public void onNeighborBlockChange(World world, int x, int y, int z, Block blockId) {
if(world.isRemote) {
return;
}
@@ -218,7 +214,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
}
@Override
public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) {
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);
@@ -235,7 +231,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
}
@Override
public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z) {
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
if(!world.isRemote && (!player.capabilities.isCreativeMode || "true".equalsIgnoreCase(System.getProperty("blockCapBankAllwaysDrop")))) {
TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TileCapacitorBank) {
@@ -253,7 +249,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
world.spawnEntityInWorld(entityitem);
}
}
return super.removeBlockByPlayer(world, player, x, y, z);
return super.removedByPlayer(world, player, x, y, z);
}
@Override
@@ -269,18 +265,13 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
world.markBlockForUpdate(x, y, z);
}
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return 0;
}
@Override
public int quantityDropped(Random r) {
return 0;
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
public void breakBlock(World world, int x, int y, int z, Block par5, int par6) {
if(!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {
TileEntity te = world.getTileEntity(x, y, z);
if(!(te instanceof TileCapacitorBank)) {
@@ -290,7 +281,7 @@ public class BlockCapacitorBank extends Block implements ITileEntityProvider, IG
TileCapacitorBank cb = (TileCapacitorBank) te;
Util.dropItems(world, cb, x, y, z, true);
}
world.removeBlockTileEntity(x, y, z);
world.removeTileEntity(x, y, z);
}
@Override
@@ -4,6 +4,7 @@ import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
@@ -20,8 +21,8 @@ public class BlockItemCapacitorBank extends ItemBlock {
return res;
}
public BlockItemCapacitorBank(int id) {
super(id);
public BlockItemCapacitorBank() {
super(EnderIO.blockCapacitorBank);
setHasSubtypes(true);
}
@@ -40,7 +41,7 @@ public class BlockItemCapacitorBank extends ItemBlock {
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List) {
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
ItemStack stack = createItemStackWithPower(0);
stack.setItemDamage(0);
par3List.add(stack);
@@ -64,7 +64,7 @@ public class CapBankRenderer2 implements ISimpleBlockRenderingHandler {
}
@Override
public boolean shouldRender3DInInventory() {
public boolean shouldRender3DInInventory(int modelId) {
return true;
}
@@ -89,7 +89,7 @@ public class CapacitorBankRenderer extends TileEntitySpecialRenderer implements
if(te != null) {
brightness = new float[6];
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
brightness[dir.ordinal()] = RenderUtil.claculateTotalBrightnessForLocation(te.worldObj, te.xCoord + dir.offsetX, te.yCoord + dir.offsetY, te.zCoord
brightness[dir.ordinal()] = RenderUtil.claculateTotalBrightnessForLocation(te.getWorld(), te.xCoord + dir.offsetX, te.yCoord + dir.offsetY, te.zCoord
+ dir.offsetZ);
maxBrightness = Math.max(brightness[dir.ordinal()], maxBrightness);
}
@@ -115,7 +115,7 @@ public class CapacitorBankRenderer extends TileEntitySpecialRenderer implements
tes.setColorRGBA_F(maxBrightness, maxBrightness, maxBrightness, 1);
if(te != null) {
//RenderUtil.setTesselatorBrightness(te.worldObj, te.xCoord, te.yCoord, te.zCoord);
renderBorder(te.worldObj, te.xCoord, te.yCoord, te.zCoord);
renderBorder(te.getWorld(), te.xCoord, te.yCoord, te.zCoord);
} else {
renderBorder(null, 0, 0, 0);
}
@@ -3,19 +3,17 @@ package crazypants.enderio.machine.power;
import java.awt.Rectangle;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.network.packet.Packet;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.network.PacketDispatcher;
import crazypants.enderio.machine.AbstractMachineBlock;
import crazypants.enderio.machine.GuiMachineBase;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.machine.RedstoneModePacketProcessor;
import crazypants.gui.GuiContainerBase;
import crazypants.gui.GuiToolTip;
import crazypants.gui.IconButton;
@@ -110,8 +108,9 @@ public class GuiCapacitorBank extends GuiContainerBase {
}
capBank.setInputControlMode(RedstoneControlMode.values()[ordinal]);
inputRedstoneButton.setIcon(AbstractMachineBlock.getRedstoneControlIcon(capBank.getInputControlMode()));
Packet pkt = RedstoneModePacketProcessor.getRedstoneControlPacket(capBank);
PacketDispatcher.sendPacketToServer(pkt);
//TODO:1.7
// Packet pkt = RedstoneModePacketProcessor.getRedstoneControlPacket(capBank);
// PacketDispatcher.sendPacketToServer(pkt);
} else if(par1GuiButton.id == OUTPUT_BUTTON_ID) {
int ordinal = capBank.getOutputControlMode().ordinal();
ordinal++;
@@ -120,8 +119,9 @@ public class GuiCapacitorBank extends GuiContainerBase {
}
capBank.setOutputControlMode(RedstoneControlMode.values()[ordinal]);
outputRedstoneButton.setIcon(AbstractMachineBlock.getRedstoneControlIcon(capBank.getOutputControlMode()));
Packet pkt = RedstoneModePacketProcessor.getRedstoneControlPacket(capBank);
PacketDispatcher.sendPacketToServer(pkt);
//TODO:1.7
// Packet pkt = RedstoneModePacketProcessor.getRedstoneControlPacket(capBank);
// PacketDispatcher.sendPacketToServer(pkt);
}
}
@@ -137,6 +137,7 @@ public class GuiCapacitorBank extends GuiContainerBase {
//int y = guiTop + 5;
int y = guiTop + inputY;
FontRenderer fontRenderer = getFontRenderer();
inputRedstoneButton = new IconButton(fontRenderer, INPUT_BUTTON_ID, x, y, AbstractMachineBlock.getRedstoneControlIcon(capBank.getInputControlMode()),
RenderUtil.BLOCK_TEX);
inputRedstoneButton.setSize(GuiMachineBase.BUTTON_SIZE, GuiMachineBase.BUTTON_SIZE);
@@ -196,8 +197,9 @@ public class GuiCapacitorBank extends GuiContainerBase {
if(output != capBank.getMaxOutput()) {
maxOutputTF.setText(PowerDisplayUtil.formatPower(capBank.getMaxOutput()));
}
Packet pkt = CapacitorBankPacketHandler.createMaxInputOutputPacket(capBank);
PacketDispatcher.sendPacketToServer(pkt);
//TODO:1.7
// Packet pkt = CapacitorBankPacketHandler.createMaxInputOutputPacket(capBank);
// PacketDispatcher.sendPacketToServer(pkt);
}
private void setMaxInput(int input) {
@@ -205,8 +207,9 @@ public class GuiCapacitorBank extends GuiContainerBase {
if(input != capBank.getMaxInput()) {
maxInputTF.setText(PowerDisplayUtil.formatPower(capBank.getMaxInput()));
}
Packet pkt = CapacitorBankPacketHandler.createMaxInputOutputPacket(capBank);
PacketDispatcher.sendPacketToServer(pkt);
//TODO:1.7
// Packet pkt = CapacitorBankPacketHandler.createMaxInputOutputPacket(capBank);
// PacketDispatcher.sendPacketToServer(pkt);
}
private int parsePower(GuiTextField tf) {
@@ -260,6 +263,7 @@ public class GuiCapacitorBank extends GuiContainerBase {
String str = Lang.localize("gui.capBank.maxIo") + " " + PowerDisplayUtil.formatPower(capBank.getMaxIO()) +
" " + PowerDisplayUtil.abrevation() + PowerDisplayUtil.perTickStr();
FontRenderer fontRenderer = getFontRenderer();
int swid = fontRenderer.getStringWidth(str);
int x = midX - swid / 2;
int y = guiTop + 5;
@@ -306,7 +310,7 @@ public class GuiCapacitorBank extends GuiContainerBase {
@Override
public FontRenderer getFontRenderer() {
return fontRenderer;
return Minecraft.getMinecraft().fontRenderer;
}
}
@@ -7,12 +7,12 @@ import java.util.ListIterator;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -22,11 +22,7 @@ import buildcraft.api.power.PowerHandler.PowerReceiver;
import buildcraft.api.power.PowerHandler.Type;
import cofh.api.energy.IEnergyContainerItem;
import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.PacketHandler;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.TileEntityEio;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.power.BasicCapacitor;
import crazypants.enderio.power.IInternalPowerReceptor;
@@ -36,7 +32,7 @@ import crazypants.util.BlockCoord;
import crazypants.util.Util;
import crazypants.vecmath.VecmathUtil;
public class TileCapacitorBank extends TileEntity implements IInternalPowerReceptor, IInventory {
public class TileCapacitorBank extends TileEntityEio implements IInternalPowerReceptor, IInventory {
static enum FaceConnectionMode {
INPUT,
@@ -120,10 +116,11 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
return FaceConnectionMode.LOCKED;
}
if(curMode == FaceConnectionMode.LOCKED) {
if(rec == null || rec.getDelegate() instanceof IConduitBundle) {
setFaceMode(faceHit, FaceConnectionMode.NONE, true);
return FaceConnectionMode.NONE;
}
//TODO:1.7
// if(rec == null || rec.getDelegate() instanceof IConduitBundle) {
// setFaceMode(faceHit, FaceConnectionMode.NONE, true);
// return FaceConnectionMode.NONE;
// }
}
setFaceMode(faceHit, FaceConnectionMode.INPUT, true);
return FaceConnectionMode.INPUT;
@@ -170,7 +167,7 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
}
if(worldObj.isRemote) {
if(render) {
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
render = false;
}
return;
@@ -219,7 +216,7 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
if(requiresClientSync) {
lastSyncPowerStored = storedEnergy;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
onInventoryChanged();
markDirty();
}
}
@@ -324,18 +321,19 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
&& mode != FaceConnectionMode.INPUT && mode != FaceConnectionMode.LOCKED
&& powerInterface.getMinEnergyReceived(receptor.fromDir.getOpposite()) <= canTransmit) {
float used;
if(receptor.receptor.getDelegate() instanceof IConduitBundle) {
//All other power transfer is handled by the conduit network
IConduitBundle bundle = (IConduitBundle) receptor.receptor.getDelegate();
IPowerConduit conduit = bundle.getConduit(IPowerConduit.class);
if(conduit != null && conduit.getConectionMode(receptor.fromDir.getOpposite()) == ConnectionMode.INPUT) {
used = powerInterface.recieveEnergy(receptor.fromDir.getOpposite(), canTransmit);
} else {
used = 0;
}
} else {
used = powerInterface.recieveEnergy(receptor.fromDir.getOpposite(), canTransmit);
}
//TODO:1.7
// if(receptor.receptor.getDelegate() instanceof IConduitBundle) {
// //All other power transfer is handled by the conduit network
// IConduitBundle bundle = (IConduitBundle) receptor.receptor.getDelegate();
// IPowerConduit conduit = bundle.getConduit(IPowerConduit.class);
// if(conduit != null && conduit.getConectionMode(receptor.fromDir.getOpposite()) == ConnectionMode.INPUT) {
// used = powerInterface.recieveEnergy(receptor.fromDir.getOpposite(), canTransmit);
// } else {
// used = 0;
// }
// } else {
used = powerInterface.recieveEnergy(receptor.fromDir.getOpposite(), canTransmit);
// }
transmitted += used;
canTransmit -= used;
@@ -690,8 +688,8 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
multiblockDirty = true;
}
public void onNeighborBlockChange(int blockId) {
if(blockId != ModObject.blockCapacitorBank.actualId) {
public void onNeighborBlockChange(Block block) {
if(block != EnderIO.blockCapacitorBank) {
receptorsDirty = true;
getController().masterReceptorsDirty = true;
}
@@ -940,15 +938,10 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
}
@Override
public String getInvName() {
public String getInventoryName() {
return EnderIO.blockCapacitorBank.getUnlocalizedName() + ".name";
}
@Override
public boolean isInvNameLocalized() {
return false;
}
@Override
public int getInventoryStackLimit() {
return 1;
@@ -960,11 +953,11 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
}
@Override
public void openChest() {
public void openInventory() {
}
@Override
public void closeChest() {
public void closeInventory() {
}
@Override
@@ -976,8 +969,7 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
}
@Override
public void readFromNBT(NBTTagCompound nbtRoot) {
super.readFromNBT(nbtRoot);
public void readCustomNBT(NBTTagCompound nbtRoot) {
float oldEnergy = storedEnergy;
storedEnergy = nbtRoot.getFloat("storedEnergy");
@@ -1025,9 +1017,9 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
inventory[i] = null;
}
NBTTagList itemList = nbtRoot.getTagList("Items");
NBTTagList itemList = (NBTTagList) nbtRoot.getTag("Items");
for (int i = 0; i < itemList.tagCount(); i++) {
NBTTagCompound itemStack = (NBTTagCompound) itemList.tagAt(i);
NBTTagCompound itemStack = itemList.getCompoundTagAt(i);
byte slot = itemStack.getByte("Slot");
if(slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(itemStack);
@@ -1045,8 +1037,7 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
}
@Override
public void writeToNBT(NBTTagCompound nbtRoot) {
super.writeToNBT(nbtRoot);
public void writeCustomNBT(NBTTagCompound nbtRoot) {
nbtRoot.setFloat("storedEnergy", storedEnergy);
nbtRoot.setInteger("maxStoredEnergy", maxStoredEnergy);
@@ -1094,11 +1085,6 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
}
}
@Override
public Packet getDescriptionPacket() {
return PacketHandler.getPacket(this);
}
static class Receptor {
IPowerInterface receptor;
ForgeDirection fromDir;
@@ -1117,4 +1103,10 @@ public class TileCapacitorBank extends TileEntity implements IInternalPowerRecep
}
@Override
public boolean hasCustomInventoryName() {
// TODO Auto-generated method stub
return false;
}
}
@@ -139,6 +139,7 @@ public class ConnectedTextureRenderer implements IRenderFace {
}
Vertex vertex = new Vertex();
vertex.xyz.set(corner);
vertex.xyz.add(ForgeDirectionOffsets.offsetScaled(face, 0.001));
vertex.uv = new Vector2f(uv);
applyLighting(vertex, corner, refVertices);
finalVerts.add(vertex);
@@ -154,11 +155,11 @@ public class ConnectedTextureRenderer implements IRenderFace {
v.uv = new Vector2f();
v.xyz.set(ForgeDirectionOffsets.forDir(dir));
v.xyz.add(ForgeDirectionOffsets.forDir(dir2));
//TODO: dodgy hack to just move the corner forward a bit
v.xyz.add(ForgeDirectionOffsets.offsetScaled(face, 0.001f));
v.xyz.x = Math.max(-0.001, v.xyz.x);
v.xyz.y = Math.max(-0.001, v.xyz.y);
v.xyz.z = Math.max(-0.001, v.xyz.z);
//TODO: dodgy hack to just move the corner forward a bit
v.xyz.add(ForgeDirectionOffsets.offsetScaled(face, 0.002f));
v.xyz.x = Math.max(-0.002, v.xyz.x);
v.xyz.y = Math.max(-0.002, v.xyz.y);
v.xyz.z = Math.max(-0.002, v.xyz.z);
if(ForgeDirectionOffsets.isPositiveOffset(face)) {
v.xyz.add(ForgeDirectionOffsets.forDir(face));