From e44027bcf50895122c8387d4d0c8afa42a354b85 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Wed, 2 Oct 2013 20:38:46 +0800 Subject: [PATCH] Fixed unamed MultiPart wires --- ...ltiwire.aluminum.png => wire.aluminum.png} | Bin .../{multiwire.copper.png => wire.copper.png} | Bin .../{multiwire.iron.png => wire.iron.png} | Bin .../{multiwire.silver.png => wire.silver.png} | Bin ...rconductor.png => wire.superconductor.png} | Bin .../items/{multiwire.tin.png => wire.tin.png} | Bin .../wire/multipart/ItemPartWire.java | 44 +++++--- .../wire/multipart/PartWire.java | 105 +++++++++--------- 8 files changed, 80 insertions(+), 69 deletions(-) rename resources/assets/resonantinduction/textures/items/{multiwire.aluminum.png => wire.aluminum.png} (100%) rename resources/assets/resonantinduction/textures/items/{multiwire.copper.png => wire.copper.png} (100%) rename resources/assets/resonantinduction/textures/items/{multiwire.iron.png => wire.iron.png} (100%) rename resources/assets/resonantinduction/textures/items/{multiwire.silver.png => wire.silver.png} (100%) rename resources/assets/resonantinduction/textures/items/{multiwire.superconductor.png => wire.superconductor.png} (100%) rename resources/assets/resonantinduction/textures/items/{multiwire.tin.png => wire.tin.png} (100%) diff --git a/resources/assets/resonantinduction/textures/items/multiwire.aluminum.png b/resources/assets/resonantinduction/textures/items/wire.aluminum.png similarity index 100% rename from resources/assets/resonantinduction/textures/items/multiwire.aluminum.png rename to resources/assets/resonantinduction/textures/items/wire.aluminum.png diff --git a/resources/assets/resonantinduction/textures/items/multiwire.copper.png b/resources/assets/resonantinduction/textures/items/wire.copper.png similarity index 100% rename from resources/assets/resonantinduction/textures/items/multiwire.copper.png rename to resources/assets/resonantinduction/textures/items/wire.copper.png diff --git a/resources/assets/resonantinduction/textures/items/multiwire.iron.png b/resources/assets/resonantinduction/textures/items/wire.iron.png similarity index 100% rename from resources/assets/resonantinduction/textures/items/multiwire.iron.png rename to resources/assets/resonantinduction/textures/items/wire.iron.png diff --git a/resources/assets/resonantinduction/textures/items/multiwire.silver.png b/resources/assets/resonantinduction/textures/items/wire.silver.png similarity index 100% rename from resources/assets/resonantinduction/textures/items/multiwire.silver.png rename to resources/assets/resonantinduction/textures/items/wire.silver.png diff --git a/resources/assets/resonantinduction/textures/items/multiwire.superconductor.png b/resources/assets/resonantinduction/textures/items/wire.superconductor.png similarity index 100% rename from resources/assets/resonantinduction/textures/items/multiwire.superconductor.png rename to resources/assets/resonantinduction/textures/items/wire.superconductor.png diff --git a/resources/assets/resonantinduction/textures/items/multiwire.tin.png b/resources/assets/resonantinduction/textures/items/wire.tin.png similarity index 100% rename from resources/assets/resonantinduction/textures/items/multiwire.tin.png rename to resources/assets/resonantinduction/textures/items/wire.tin.png diff --git a/src/resonantinduction/wire/multipart/ItemPartWire.java b/src/resonantinduction/wire/multipart/ItemPartWire.java index 26652113..fe4865e2 100644 --- a/src/resonantinduction/wire/multipart/ItemPartWire.java +++ b/src/resonantinduction/wire/multipart/ItemPartWire.java @@ -24,10 +24,12 @@ import cpw.mods.fml.relauncher.SideOnly; public class ItemPartWire extends JItemMultiPart { + private Icon[] icons = new Icon[EnumWireMaterial.values().length]; + public ItemPartWire(int id) { super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "wireMultipart", id).getInt(id)); - this.setUnlocalizedName(ResonantInduction.PREFIX + "multiwire"); + this.setUnlocalizedName(ResonantInduction.PREFIX + "wire"); this.setCreativeTab(TabRI.INSTANCE); this.setHasSubtypes(true); this.setMaxDamage(0); @@ -38,8 +40,12 @@ public class ItemPartWire extends JItemMultiPart { return new PartWire(this.getDamage(arg0)); } - - private Icon[] icons = new Icon[EnumWireMaterial.values().length]; + + @Override + public String getUnlocalizedName() + { + return super.getUnlocalizedName().replace("item", "tile"); + } @Override public int getMetadata(int damage) @@ -66,9 +72,9 @@ public class ItemPartWire extends JItemMultiPart { for (int i = 0; i < EnumWireMaterial.values().length; i++) { - this.icons[i] = iconRegister.registerIcon(this.getUnlocalizedName(new ItemStack(this.itemID, 1, i)).replaceAll("item.", "").replaceAll("multi","")); + this.icons[i] = iconRegister.registerIcon(this.getUnlocalizedName(new ItemStack(this.itemID, 1, i)).replaceAll("tile.", "")); } - + RenderPartWire.registerIcons(iconRegister); } @@ -79,18 +85,20 @@ public class ItemPartWire extends JItemMultiPart return this.icons[meta]; } - @Override - public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) { - for (EnumWireMaterial mat : EnumWireMaterial.values()) { - listToAddTo.add(new ItemStack(itemID, 1, mat.ordinal())); - } - } - - @Override - @SideOnly(Side.CLIENT) - public int getSpriteNumber() - { - return 0; - } + @Override + public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) + { + for (EnumWireMaterial mat : EnumWireMaterial.values()) + { + listToAddTo.add(new ItemStack(itemID, 1, mat.ordinal())); + } + } + + @Override + @SideOnly(Side.CLIENT) + public int getSpriteNumber() + { + return 0; + } } diff --git a/src/resonantinduction/wire/multipart/PartWire.java b/src/resonantinduction/wire/multipart/PartWire.java index 9e5db5a3..c33f5da9 100644 --- a/src/resonantinduction/wire/multipart/PartWire.java +++ b/src/resonantinduction/wire/multipart/PartWire.java @@ -68,7 +68,8 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN /** Client Side Connection Check */ private ForgeDirection testingSide; - static { + static + { sides[0] = new IndexedCuboid6(0, new Cuboid6(0.36, 0.000, 0.36, 0.64, 0.36, 0.64)); sides[1] = new IndexedCuboid6(1, new Cuboid6(0.36, 0.64, 0.36, 0.64, 1.000, 0.64)); sides[2] = new IndexedCuboid6(2, new Cuboid6(0.36, 0.36, 0.000, 0.64, 0.64, 0.36)); @@ -84,23 +85,23 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN insulatedSides[5] = new IndexedCuboid6(5, new Cuboid6(0.7, 0.3, 0.3, 1.0, 0.7, 0.7)); insulatedSides[6] = new IndexedCuboid6(6, new Cuboid6(0.3, 0.3, 0.3, 0.7, 0.7, 0.7)); } - + public PartWire(int typeID) { this(EnumWireMaterial.values()[typeID]); } - + public PartWire(EnumWireMaterial type) { super(); this.material = type; } - + public PartWire() { super(); } - + @Override public boolean canConnect(ForgeDirection direction) { @@ -111,13 +112,13 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN return super.canConnect(direction); } - + public boolean connectionPrevented(TileEntity tile, ForgeDirection side) { if (tile instanceof IWireMaterial) { IWireMaterial wireTile = (IWireMaterial) tile; - + if (wireTile.getMaterial() != this.getMaterial()) return true; } @@ -129,10 +130,10 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN if ((insulatedTile.isInsulated() && insulatedTile.getInsulationColor() != this.getInsulationColor() && this.getInsulationColor() != DEFAULT_COLOR && insulatedTile.getInsulationColor() != DEFAULT_COLOR)) return true; } - - return (this.isBlockedOnSide(side) || tile instanceof IBlockableConnection && ((IBlockableConnection)tile).isBlockedOnSide(side.getOpposite())); + + return (this.isBlockedOnSide(side) || tile instanceof IBlockableConnection && ((IBlockableConnection) tile).isBlockedOnSide(side.getOpposite())); } - + public byte getPossibleWireConnections() { if (this.world().isBlockIndirectlyGettingPowered(this.x(), this.y(), this.z())) @@ -167,7 +168,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN { return material; } - + public int getTypeID() { return material.ordinal(); @@ -179,7 +180,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN this.refresh(); this.world().markBlockForUpdate(this.x(), this.y(), this.z()); } - + public void setMaterialFromID(int id) { this.material = EnumWireMaterial.values()[id]; @@ -192,13 +193,13 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN this.powerHandler.configure(0, this.buildcraftBuffer, this.buildcraftBuffer, this.buildcraftBuffer * 2); super.doWork(workProvider); } - + @Override public String getType() { return "resonant_induction_wire"; } - + @Override public boolean occlusionTest(TMultiPart other) { @@ -210,18 +211,19 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN { Set subParts = new HashSet(); IndexedCuboid6[] currentSides = this.isInsulated() ? insulatedSides : sides; - if(tile() != null) + if (tile() != null) { - for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) + for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { int ord = side.ordinal(); - if(connectionMapContainsSide(getAllCurrentConnections(), side) || side == this.testingSide) subParts.add(currentSides[ord]); + if (connectionMapContainsSide(getAllCurrentConnections(), side) || side == this.testingSide) + subParts.add(currentSides[ord]); } } subParts.add(currentSides[6]); return subParts; } - + @Override public Iterable getCollisionBoxes() { @@ -235,17 +237,17 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN { List drops = new ArrayList(); drops.add(pickItem(null)); - if(isInsulated) + if (isInsulated) drops.add(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(dyeID))); return drops; } - + @Override public float getStrength(MovingObjectPosition hit, EntityPlayer player) { return 10F; } - + @Override @SideOnly(Side.CLIENT) public void renderStatic(codechicken.lib.vec.Vector3 pos, LazyLightMatrix olm, int pass) @@ -253,33 +255,34 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN if (pass == 0) renderer.renderStatic(this); } - + @Override @SideOnly(Side.CLIENT) public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass) { if (ResonantInduction.SHINY_SILVER && this.getMaterial() == EnumWireMaterial.SILVER) - renderer.renderShine(this, pos.x, pos.y, pos.z, frame); + renderer.renderShine(this, pos.x, pos.y, pos.z, frame); } @Override public void drawBreaking(RenderBlocks renderBlocks) { - CCRenderState.reset(); - RenderUtils.renderBlock(sides[6], 0, new Translation(x(), y(), z()), new IconTransformation(renderBlocks.overrideBlockTexture), null); + CCRenderState.reset(); + RenderUtils.renderBlock(sides[6], 0, new Translation(x(), y(), z()), new IconTransformation(renderBlocks.overrideBlockTexture), null); } @Override - public void readDesc(MCDataInput packet) + public void readDesc(MCDataInput packet) { this.setMaterialFromID(packet.readInt()); this.dyeID = packet.readInt(); this.isInsulated = packet.readBoolean(); this.currentWireConnections = packet.readByte(); this.currentAcceptorConnections = packet.readByte(); - if (tile() != null) tile().markRender(); + if (tile() != null) + tile().markRender(); } - + @Override public void writeDesc(MCDataOutput packet) { @@ -289,7 +292,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN packet.writeByte(this.currentWireConnections); packet.writeByte(this.currentAcceptorConnections); } - + @Override public void save(NBTTagCompound nbt) { @@ -298,7 +301,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN nbt.setInteger("dyeID", this.dyeID); nbt.setBoolean("isInsulated", this.isInsulated); } - + @Override public void load(NBTTagCompound nbt) { @@ -307,13 +310,13 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN this.dyeID = nbt.getInteger("dyeID"); this.isInsulated = nbt.getBoolean("isInsulated"); } - + @Override public ItemStack pickItem(MovingObjectPosition hit) { return new ItemStack(ResonantInduction.itemPartWire, 1, this.getTypeID()); } - + @Override public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item) { @@ -342,16 +345,17 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN return true; } } - if (!world().isRemote)player.addChatMessage(getNetwork().toString()); + if (!world().isRemote) + player.addChatMessage(getNetwork().toString()); return false; } - + @Override public Iterable getOcclusionBoxes() { return getCollisionBoxes(); } - + @Override public int getSlotMask() { @@ -391,7 +395,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN this.dyeID = DEFAULT_COLOR; this.refresh(); this.world().markBlockForUpdate(this.x(), this.y(), this.z()); - ((TileMultipart)this.tile()).notifyPartChange(this); + ((TileMultipart) this.tile()).notifyPartChange(this); } public void setInsulated(int dyeColour) @@ -400,7 +404,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN this.dyeID = dyeColour; this.refresh(); this.world().markBlockForUpdate(this.x(), this.y(), this.z()); - ((TileMultipart)this.tile()).notifyPartChange(this); + ((TileMultipart) this.tile()).notifyPartChange(this); } public void setInsulated() @@ -425,18 +429,18 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN { return RenderPartWire.breakIcon; } - - @Override - public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer) - { - IconHitEffects.addHitEffects(this, hit, effectRenderer); - } - - @Override - public void addDestroyEffects(EffectRenderer effectRenderer) - { - IconHitEffects.addDestroyEffects(this, effectRenderer, false); - } + + @Override + public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer) + { + IconHitEffects.addHitEffects(this, hit, effectRenderer); + } + + @Override + public void addDestroyEffects(EffectRenderer effectRenderer) + { + IconHitEffects.addDestroyEffects(this, effectRenderer, false); + } @Override public boolean isBlockedOnSide(ForgeDirection side) @@ -447,12 +451,11 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN this.testingSide = null; return !expandable; } - + @Override public void onPartChanged(TMultiPart part) { refresh(); } - }