Fixed unamed MultiPart wires

This commit is contained in:
Calclavia 2013-10-02 20:38:46 +08:00
parent 3b35287c2c
commit e44027bcf5
8 changed files with 80 additions and 69 deletions

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

View file

@ -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);
@ -39,7 +41,11 @@ 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,7 +72,7 @@ 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
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
@SideOnly(Side.CLIENT)
public int getSpriteNumber()
{
return 0;
}
}

View file

@ -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));
@ -130,7 +131,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
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()
@ -210,12 +211,13 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
{
Set<IndexedCuboid6> subParts = new HashSet<IndexedCuboid6>();
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]);
@ -235,7 +237,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
{
List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add(pickItem(null));
if(isInsulated)
if (isInsulated)
drops.add(new ItemStack(Block.cloth, 1, BlockColored.getBlockFromDye(dyeID)));
return drops;
}
@ -259,14 +261,14 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
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
@ -277,7 +279,8 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
this.isInsulated = packet.readBoolean();
this.currentWireConnections = packet.readByte();
this.currentAcceptorConnections = packet.readByte();
if (tile() != null) tile().markRender();
if (tile() != null)
tile().markRender();
}
@Override
@ -342,7 +345,8 @@ 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;
}
@ -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()
@ -426,17 +430,17 @@ 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 addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer)
{
IconHitEffects.addHitEffects(this, hit, effectRenderer);
}
@Override
public void addDestroyEffects(EffectRenderer effectRenderer)
{
IconHitEffects.addDestroyEffects(this, effectRenderer, false);
}
@Override
public void addDestroyEffects(EffectRenderer effectRenderer)
{
IconHitEffects.addDestroyEffects(this, effectRenderer, false);
}
@Override
public boolean isBlockedOnSide(ForgeDirection side)
@ -454,5 +458,4 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
refresh();
}
}