Minor clean up

This commit is contained in:
Calclavia 2013-12-31 02:25:31 +08:00
parent 2ee938dc33
commit 2eec7f95c8
27 changed files with 476 additions and 524 deletions

@ -1 +1 @@
Subproject commit c56f08b7e4283d77f0dac6317b29f0c5b85f2190 Subproject commit efbdc74c82b31b476f5ece15bb379dfa9f98200a

View file

@ -16,7 +16,7 @@
<get src="http://files.minecraftforge.net/CodeChickenLib/CodeChickenLib-dev-1.6.4-1.0.0.49.jar" <get src="http://files.minecraftforge.net/CodeChickenLib/CodeChickenLib-dev-1.6.4-1.0.0.49.jar"
dest="${dir.mcp}/lib/CCL-dev.jar"/> dest="${dir.mcp}/lib/CCL-dev.jar"/>
<get src="http://files.minecraftforge.net/ForgeMultipart/ForgeMultipart-dev-1.6.4-1.0.0.227.jar" <get src="http://files.minecraftforge.net/ForgeMultipart/ForgeMultipart-dev-1.6.4-1.0.0.231.jar"
dest="${dir.mcp}/lib/FMP-dev.jar"/> dest="${dir.mcp}/lib/FMP-dev.jar"/>
<copy todir="${dir.mcp}/src/minecraft"> <copy todir="${dir.mcp}/src/minecraft">
@ -71,12 +71,6 @@
<exclude name="**/*.java"/> <exclude name="**/*.java"/>
<exclude name="**/*.xml"/> <exclude name="**/*.xml"/>
</fileset> </fileset>
<fileset dir="${dir.development}Calclavia-Core/src/main/resources/">
<exclude name=".git/**"/>
<exclude name="**/*.java"/>
<exclude name="**/*.xml"/>
</fileset>
</copy> </copy>
<copy todir="APIContents"> <copy todir="APIContents">

View file

@ -65,12 +65,12 @@ public class CommonProxy implements IGuiHandler
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color) public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color)
{ {
this.renderElectricShock(world, start, target, (float) color.r / 255f, (float) color.g / 255f, (float) color.b / 255f); this.renderElectricShock(world, start, target, color.r / 255f, color.g / 255f, color.b / 255f);
} }
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color, boolean split) public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color, boolean split)
{ {
this.renderElectricShock(world, start, target, (float) color.r / 255f, (float) color.g / 255f, (float) color.b / 255f, split); this.renderElectricShock(world, start, target, color.r / 255f, color.g / 255f, color.b / 255f, split);
} }
public void renderElectricShock(World world, Vector3 start, Vector3 target) public void renderElectricShock(World world, Vector3 start, Vector3 target)

View file

@ -13,14 +13,8 @@ import codechicken.multipart.TMultiPart;
public class MultipartRI implements IPartFactory public class MultipartRI implements IPartFactory
{ {
public static MultipartRI INSTANCE; public static MultipartRI INSTANCE;
public static final String[] PART_TYPES = { public static final String[] PART_TYPES = { "resonant_induction_wire", "resonant_induction_flat_wire", "resonant_induction_flat_switch_wire", "resonant_induction_multimeter", "resonant_induction_transformer" };
"resonant_induction_wire",
"resonant_induction_flat_wire",
"resonant_induction_flat_switch_wire",
"resonant_induction_multimeter",
"resonant_induction_transformer"
};
public MultipartRI() public MultipartRI()
{ {
@ -33,24 +27,24 @@ public class MultipartRI implements IPartFactory
@Override @Override
public TMultiPart createPart(String name, boolean client) public TMultiPart createPart(String name, boolean client)
{ {
switch(name) switch (name)
{ {
case "resonant_induction_wire": case "resonant_induction_wire":
return new PartWire(); return new PartWire();
case "resonant_induction_flat_wire": case "resonant_induction_flat_wire":
return new PartFlatWire(); return new PartFlatWire();
case "resonant_induction_flat_switch_wire": case "resonant_induction_flat_switch_wire":
return new PartFlatSwitchWire(); return new PartFlatSwitchWire();
case "resonant_induction_multimeter": case "resonant_induction_multimeter":
return new PartMultimeter(); return new PartMultimeter();
case "resonant_induction_transformer": case "resonant_induction_transformer":
return new PartTransformer(); return new PartTransformer();
} }
return null; return null;
} }
} }

View file

@ -35,36 +35,18 @@ public class Utility
return true; return true;
return b.isBlockSolidOnSide(w, x, y, z, side); return b.isBlockSolidOnSide(w, x, y, z, side);
} }
public static int isDye(ItemStack is) public static int isDye(ItemStack is)
{ {
String[] dyes = String[] dyes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" };
{
"dyeBlack", for (int i = 0; i < dyes.length; i++)
"dyeRed", {
"dyeGreen", if (OreDictionary.getOreID(is) != -1 && OreDictionary.getOreName(OreDictionary.getOreID(is)).equals(dyes[i]))
"dyeBrown", return i;
"dyeBlue", }
"dyePurple",
"dyeCyan", return -1;
"dyeLightGray", }
"dyeGray",
"dyePink",
"dyeLime",
"dyeYellow",
"dyeLightBlue",
"dyeMagenta",
"dyeOrange",
"dyeWhite"
};
for (int i = 0; i < dyes.length; i++)
{
if (OreDictionary.getOreID(is) != -1 && OreDictionary.getOreName(OreDictionary.getOreID(is)).equals(dyes[i]))
return i;
}
return -1;
}
} }

View file

@ -1,8 +1,6 @@
package resonantinduction.base; package resonantinduction.base;
import net.minecraft.block.Block;
import codechicken.multipart.TMultiPart; import codechicken.multipart.TMultiPart;
import codechicken.multipart.handler.MultipartProxy;
public abstract class PartAdvanced extends TMultiPart public abstract class PartAdvanced extends TMultiPart
{ {

View file

@ -2,12 +2,10 @@ package resonantinduction.battery;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import universalelectricity.api.energy.EnergyStorageHandler; import universalelectricity.api.energy.EnergyStorageHandler;
import universalelectricity.api.vector.Vector3;
public class BatteryStructure extends EnergyStorageHandler public class BatteryStructure extends EnergyStorageHandler
{ {
@ -76,10 +74,10 @@ public class BatteryStructure extends EnergyStorageHandler
public void merge(TileBattery tile) public void merge(TileBattery tile)
{ {
// Merge structure. // Merge structure.
long energyToMerge = ((TileBattery) tile).structure.getEnergy(); long energyToMerge = tile.structure.getEnergy();
long capacityToMerge = ((TileBattery) tile).structure.getEnergyCapacity(); long capacityToMerge = tile.structure.getEnergyCapacity();
this.battery.addAll(((TileBattery) tile).structure.battery); this.battery.addAll(tile.structure.battery);
((TileBattery) tile).structure.battery.clear(); tile.structure.battery.clear();
this.resetReferences(); this.resetReferences();
this.setCapacity(capacityToMerge); this.setCapacity(capacityToMerge);
this.receiveEnergy(energyToMerge, true); this.receiveEnergy(energyToMerge, true);

View file

@ -5,16 +5,12 @@ package resonantinduction.battery;
import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.ITileEntityProvider;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.ResonantInduction; import resonantinduction.ResonantInduction;
import resonantinduction.api.ICapacitor;
import resonantinduction.base.BlockBase; import resonantinduction.base.BlockBase;
import resonantinduction.base.ListUtil;
import resonantinduction.render.BlockRenderingHandler; import resonantinduction.render.BlockRenderingHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;

View file

@ -13,7 +13,6 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction; import resonantinduction.ResonantInduction;
import resonantinduction.model.ModelBattery; import resonantinduction.model.ModelBattery;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -29,68 +28,64 @@ public class RenderBattery extends TileEntitySpecialRenderer
public static final ModelBattery MODEL = new ModelBattery(); public static final ModelBattery MODEL = new ModelBattery();
/*public static final Map<String, CCModel> MODELS; /*
* public static final Map<String, CCModel> MODELS;
* static
* {
* MODELS = CCModel.parseObjModels(new ResourceLocation("resonantinduction", "models/wire.obj"),
* 7, new InvertX());
* for (CCModel c : MODELS.values())
* {
* c.apply(new Translation(.5, 0, .5));
* c.computeLighting(LightModel.standardLightModel);
* c.shrinkUVs(0.0005);
* }
* loadBuffer(location, 0, 0, 0, 1);
* loadBuffer(specular, 1, 1, 1, 1);
* loadBuffer(zero, 0, 0, 0, 0);
* loadBuffer(defaultAmbient, 0.4F, 0.4F, 0.4F, 1);
* GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, zero);
* GL11.glLight(GL11.GL_LIGHT3, GL11.GL_SPECULAR, specular);
* GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, specular);
* GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT, zero);
* GL11.glMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE, zero);
* GL11.glMaterialf(GL11.GL_FRONT, GL11.GL_SHININESS, 128f);
* }
* public void renderStatic(TileBattery battery)
* {
* TextureUtils.bindAtlas(0);
* CCRenderState.reset();
* CCRenderState.useModelColours(true);
* CCRenderState.setBrightness(battery.worldObj, battery.xCoord, battery.yCoord,
* battery.zCoord);
* renderPart(ForgeDirection.UNKNOWN, wire);
* byte renderSides = wire.getAllCurrentConnections();
* for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
* {
* if (PartWire.connectionMapContainsSide(renderSides, side))
* {
* renderSide(side, wire);
* }
* }
* }
* public void renderPart(Icon icon, CCModel cc, double x, double y, double z, Colour colour)
* {
* cc.render(0, cc.verts.length, Rotation.sideOrientation(0, Rotation.rotationTo(0,
* 2)).at(codechicken.lib.vec.Vector3.center).with(new Translation(x, y, z)), new
* IconTransformation(icon), new ColourMultiplier(colour));
* }
*/
static static IModelCustom advancedmodel = AdvancedModelLoader.loadModel(ResonantInduction.MODEL_DIRECTORY + "battery.obj");
{
MODELS = CCModel.parseObjModels(new ResourceLocation("resonantinduction", "models/wire.obj"), 7, new InvertX());
for (CCModel c : MODELS.values())
{
c.apply(new Translation(.5, 0, .5));
c.computeLighting(LightModel.standardLightModel);
c.shrinkUVs(0.0005);
}
loadBuffer(location, 0, 0, 0, 1);
loadBuffer(specular, 1, 1, 1, 1);
loadBuffer(zero, 0, 0, 0, 0);
loadBuffer(defaultAmbient, 0.4F, 0.4F, 0.4F, 1);
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, zero);
GL11.glLight(GL11.GL_LIGHT3, GL11.GL_SPECULAR, specular);
GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, specular);
GL11.glMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT, zero);
GL11.glMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE, zero);
GL11.glMaterialf(GL11.GL_FRONT, GL11.GL_SHININESS, 128f);
}
public void renderStatic(TileBattery battery)
{
TextureUtils.bindAtlas(0);
CCRenderState.reset();
CCRenderState.useModelColours(true);
CCRenderState.setBrightness(battery.worldObj, battery.xCoord, battery.yCoord, battery.zCoord);
renderPart(ForgeDirection.UNKNOWN, wire);
byte renderSides = wire.getAllCurrentConnections();
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if (PartWire.connectionMapContainsSide(renderSides, side))
{
renderSide(side, wire);
}
}
}
public void renderPart(Icon icon, CCModel cc, double x, double y, double z, Colour colour)
{
cc.render(0, cc.verts.length, Rotation.sideOrientation(0, Rotation.rotationTo(0, 2)).at(codechicken.lib.vec.Vector3.center).with(new Translation(x, y, z)), new IconTransformation(icon), new ColourMultiplier(colour));
}*/
static IModelCustom advancedmodel = AdvancedModelLoader.loadModel(ResonantInduction.MODEL_DIRECTORY+"battery.obj");
public static void render() public static void render()
{ {
/* /*
advancedmodel.renderAll(); * advancedmodel.renderAll();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderBattery.TEXTURE);*/ * FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderBattery.TEXTURE);
*/
} }
@Override @Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f) public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
{ {

View file

@ -22,7 +22,6 @@ import calclavia.lib.prefab.tile.TileElectrical;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.PacketDispatcher; import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
/** /**
* A modular battery. * A modular battery.
@ -46,7 +45,7 @@ public class TileBattery extends TileElectrical implements IPacketSender, IPacke
{ {
this.energy = new EnergyStorageHandler(STORAGE); this.energy = new EnergyStorageHandler(STORAGE);
} }
@Override @Override
public void initiate() public void initiate()
{ {

View file

@ -70,7 +70,7 @@ public class BlockAdvancedFurnace extends BlockFurnace
@Override @Override
public Icon getBlockTexture(IBlockAccess access, int x, int y, int z, int side) public Icon getBlockTexture(IBlockAccess access, int x, int y, int z, int side)
{ {
TileEntity tileEntity = (TileAdvancedFurnace) access.getBlockTileEntity(x, y, z); TileEntity tileEntity = access.getBlockTileEntity(x, y, z);
int meta = access.getBlockMetadata(x, y, z); int meta = access.getBlockMetadata(x, y, z);
if (((TileAdvancedFurnace) tileEntity).isBurning()) if (((TileAdvancedFurnace) tileEntity).isBurning())
@ -92,36 +92,36 @@ public class BlockAdvancedFurnace extends BlockFurnace
@Override @Override
public void randomDisplayTick(World world, int x, int y, int z, Random par5Random) public void randomDisplayTick(World world, int x, int y, int z, Random par5Random)
{ {
TileEntity tileEntity = (TileAdvancedFurnace) world.getBlockTileEntity(x, y, z); TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (((TileAdvancedFurnace) tileEntity).isBurning()) if (((TileAdvancedFurnace) tileEntity).isBurning())
{ {
int l = world.getBlockMetadata(x, y, z); int l = world.getBlockMetadata(x, y, z);
float f = (float) x + 0.5F; float f = x + 0.5F;
float f1 = (float) y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; float f1 = y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
float f2 = (float) z + 0.5F; float f2 = z + 0.5F;
float f3 = 0.52F; float f3 = 0.52F;
float f4 = par5Random.nextFloat() * 0.6F - 0.3F; float f4 = par5Random.nextFloat() * 0.6F - 0.3F;
if (l == 4) if (l == 4)
{ {
world.spawnParticle("smoke", (double) (f - f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D); world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double) (f - f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
} }
else if (l == 5) else if (l == 5)
{ {
world.spawnParticle("smoke", (double) (f + f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D); world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double) (f + f3), (double) f1, (double) (f2 + f4), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
} }
else if (l == 2) else if (l == 2)
{ {
world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (f2 - f3), 0.0D, 0.0D, 0.0D); world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double) (f + f4), (double) f1, (double) (f2 - f3), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D);
} }
else if (l == 3) else if (l == 3)
{ {
world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (f2 + f3), 0.0D, 0.0D, 0.0D); world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double) (f + f4), (double) f1, (double) (f2 + f3), 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
} }
} }
} }

View file

@ -2,10 +2,6 @@ package resonantinduction.furnace;
import java.util.ArrayList; import java.util.ArrayList;
import com.google.common.io.ByteArrayDataInput;
import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
@ -20,6 +16,10 @@ import universalelectricity.api.energy.EnergyStorageHandler;
import universalelectricity.api.energy.IEnergyContainer; import universalelectricity.api.energy.IEnergyContainer;
import universalelectricity.api.energy.IEnergyInterface; import universalelectricity.api.energy.IEnergyInterface;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender;
import com.google.common.io.ByteArrayDataInput;
/** /**
* Meant to replace the furnace class. * Meant to replace the furnace class.

View file

@ -73,14 +73,15 @@ public class GuiMultimeter extends GuiContainerBase
} }
@Override @Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
String s = TranslationHelper.getLocal("tile.resonantinduction:multimeter.name"); String s = TranslationHelper.getLocal("tile.resonantinduction:multimeter.name");
this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 15, 4210752); this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 15, 4210752);
this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Average Energy:", 35, 15, 4210752); this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Average Energy:", 35, 15, 4210752);
this.renderUniversalDisplay(35, 25, this.multimeter.getAverageDetectedEnergy(), par1, par2, Unit.JOULES); this.renderUniversalDisplay(35, 25, this.multimeter.getAverageDetectedEnergy(), mouseX, mouseY, Unit.JOULES);
this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Energy:", 35, 35, 4210752); this.fontRenderer.drawString(EnumColor.DARK_GREEN + "Energy:", 35, 35, 4210752);
this.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), par1, par2, Unit.JOULES); this.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), mouseX, mouseY, Unit.JOULES);
this.fontRenderer.drawString(EnumColor.ORANGE + "Output Redstone If... ", 35, 58, 4210752); this.fontRenderer.drawString(EnumColor.ORANGE + "Output Redstone If... ", 35, 58, 4210752);
this.fontRenderer.drawString(EnumColor.RED + this.multimeter.getMode().display, 35, 68, 4210752); this.fontRenderer.drawString(EnumColor.RED + this.multimeter.getMode().display, 35, 68, 4210752);
this.fontRenderer.drawString(Unit.JOULES.name + "(s)", 35, 100, 4210752); this.fontRenderer.drawString(Unit.JOULES.name + "(s)", 35, 100, 4210752);
@ -92,8 +93,12 @@ public class GuiMultimeter extends GuiContainerBase
protected void drawGuiContainerBackgroundLayer(float f, int x, int y) protected void drawGuiContainerBackgroundLayer(float f, int x, int y)
{ {
super.drawGuiContainerBackgroundLayer(f, x, y); super.drawGuiContainerBackgroundLayer(f, x, y);
/*int length = Math.min((int) (this.multimeter.getDetectedEnergy() / this.multimeter.getPeak()) * 115, 115); /*
this.drawTexturedModalRect(this.containerWidth + 14, this.containerHeight + 126 - length, 176, 115 - length, 6, length);*/ * int length = Math.min((int) (this.multimeter.getDetectedEnergy() /
* this.multimeter.getPeak()) * 115, 115);
* this.drawTexturedModalRect(this.containerWidth + 14, this.containerHeight + 126 - length,
* 176, 115 - length, 6, length);
*/
} }
@Override @Override

View file

@ -22,7 +22,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidBlock;
import resonantinduction.ResonantInduction; import resonantinduction.ResonantInduction;
import resonantinduction.base.ListUtil;
import resonantinduction.tesla.TileTesla; import resonantinduction.tesla.TileTesla;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.IPacketReceiver;

View file

@ -32,7 +32,7 @@ public class ItemMultimeter extends ItemMultipartBase
{ {
pos.offset(side ^ 1, -1); pos.offset(side ^ 1, -1);
} }
PartMultimeter part = (PartMultimeter) MultiPartRegistry.createPart("resonant_induction_multimeter", false); PartMultimeter part = (PartMultimeter) MultiPartRegistry.createPart("resonant_induction_multimeter", false);
if (part != null) if (part != null)

View file

@ -254,7 +254,7 @@ public class PartMultimeter extends JCuboidPart implements TFacePart, JNormalOcc
public void save(NBTTagCompound nbt) public void save(NBTTagCompound nbt)
{ {
super.save(nbt); super.save(nbt);
nbt.setByte("side", (byte) this.side); nbt.setByte("side", this.side);
nbt.setByte("detectMode", (byte) detectMode.ordinal()); nbt.setByte("detectMode", (byte) detectMode.ordinal());
nbt.setLong("energyLimit", energyLimit); nbt.setLong("energyLimit", energyLimit);
} }

View file

@ -71,7 +71,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
RenderBattery.render(); RenderBattery.render();
return true; return true;
} }
return false; return false;
} }

View file

@ -6,12 +6,10 @@ package resonantinduction.tesla;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import net.minecraft.block.BlockColored;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;

View file

@ -141,6 +141,7 @@ public class ModelTransformer extends ModelBase
model.rotateAngleZ = z; model.rotateAngleZ = z;
} }
@Override
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{ {
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

View file

@ -9,11 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction; import resonantinduction.ResonantInduction;
import resonantinduction.multimeter.PartMultimeter.DetectMode;
import universalelectricity.api.electricity.IElectricalNetwork; import universalelectricity.api.electricity.IElectricalNetwork;
import universalelectricity.api.electricity.IVoltageInput; import universalelectricity.api.electricity.IVoltageInput;
import universalelectricity.api.electricity.IVoltageOutput; import universalelectricity.api.electricity.IVoltageOutput;
@ -22,8 +18,6 @@ import universalelectricity.api.energy.IEnergyInterface;
import universalelectricity.api.vector.VectorHelper; import universalelectricity.api.vector.VectorHelper;
import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput; import codechicken.lib.data.MCDataOutput;
import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.TextureUtils;
import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Rotation; import codechicken.lib.vec.Rotation;
import codechicken.lib.vec.Transformation; import codechicken.lib.vec.Transformation;
@ -37,193 +31,193 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TFacePart, IVoltageOutput, IEnergyInterface public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TFacePart, IVoltageOutput, IEnergyInterface
{ {
public static Cuboid6[][] oBoxes = new Cuboid6[6][2]; public static Cuboid6[][] oBoxes = new Cuboid6[6][2];
static static
{ {
oBoxes[0][0] = new Cuboid6(1 / 8D, 0, 0, 7 / 8D, 1 / 8D, 1); oBoxes[0][0] = new Cuboid6(1 / 8D, 0, 0, 7 / 8D, 1 / 8D, 1);
oBoxes[0][1] = new Cuboid6(0, 0, 1 / 8D, 1, 1 / 8D, 7 / 8D); oBoxes[0][1] = new Cuboid6(0, 0, 1 / 8D, 1, 1 / 8D, 7 / 8D);
for (int s = 1; s < 6; s++) for (int s = 1; s < 6; s++)
{ {
Transformation t = Rotation.sideRotations[s].at(Vector3.center); Transformation t = Rotation.sideRotations[s].at(Vector3.center);
oBoxes[s][0] = oBoxes[0][0].copy().apply(t); oBoxes[s][0] = oBoxes[0][0].copy().apply(t);
oBoxes[s][1] = oBoxes[0][1].copy().apply(t); oBoxes[s][1] = oBoxes[0][1].copy().apply(t);
} }
} }
/** Side of the block this is placed on */ /** Side of the block this is placed on */
public int placementSide; public int placementSide;
/** Direction this block faces */ /** Direction this block faces */
public int face = 0; public int face = 0;
/** Step the voltage up */ /** Step the voltage up */
private boolean stepUp; private boolean stepUp;
/** Amount to mulitply the step by (up x2. down /2) */ /** Amount to mulitply the step by (up x2. down /2) */
public int multiplier = 2; public int multiplier = 2;
public void preparePlacement(int side, int itemDamage) public void preparePlacement(int side, int itemDamage)
{ {
this.placementSide = (byte) (side ^ 1); this.placementSide = (byte) (side ^ 1);
} }
@Override @Override
public void readDesc(MCDataInput packet) public void readDesc(MCDataInput packet)
{ {
this.placementSide = packet.readByte(); this.placementSide = packet.readByte();
this.face = packet.readByte(); this.face = packet.readByte();
} }
@Override @Override
public void writeDesc(MCDataOutput packet) public void writeDesc(MCDataOutput packet)
{ {
packet.writeByte(this.placementSide); packet.writeByte(this.placementSide);
packet.writeByte(this.face); packet.writeByte(this.face);
} }
public boolean stepUp() public boolean stepUp()
{ {
return this.stepUp; return this.stepUp;
} }
@Override @Override
public int getSlotMask() public int getSlotMask()
{ {
return 1 << this.placementSide; return 1 << this.placementSide;
} }
@Override @Override
public Cuboid6 getBounds() public Cuboid6 getBounds()
{ {
return FaceMicroClass.aBounds()[0x10 | this.placementSide]; return FaceMicroClass.aBounds()[0x10 | this.placementSide];
} }
@Override @Override
public int redstoneConductionMap() public int redstoneConductionMap()
{ {
return 0; return 0;
} }
@Override @Override
public boolean solid(int arg0) public boolean solid(int arg0)
{ {
return true; return true;
} }
@Override @Override
public Iterable<Cuboid6> getOcclusionBoxes() public Iterable<Cuboid6> getOcclusionBoxes()
{ {
return Arrays.asList(oBoxes[this.placementSide]); return Arrays.asList(oBoxes[this.placementSide]);
} }
protected ItemStack getItem() protected ItemStack getItem()
{ {
return new ItemStack(ResonantInduction.itemTransformer); return new ItemStack(ResonantInduction.itemTransformer);
} }
@Override @Override
public Iterable<ItemStack> getDrops() public Iterable<ItemStack> getDrops()
{ {
List<ItemStack> drops = new ArrayList<ItemStack>(); List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add(getItem()); drops.add(getItem());
return drops; return drops;
} }
@Override @Override
public ItemStack pickItem(MovingObjectPosition hit) public ItemStack pickItem(MovingObjectPosition hit)
{ {
return getItem(); return getItem();
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void renderDynamic(Vector3 pos, float frame, int pass) public void renderDynamic(Vector3 pos, float frame, int pass)
{ {
if (pass == 0) if (pass == 0)
{ {
RenderTransformer.render(this, pos.x, pos.y, pos.z); RenderTransformer.render(this, pos.x, pos.y, pos.z);
} }
} }
@Override @Override
public void load(NBTTagCompound nbt) public void load(NBTTagCompound nbt)
{ {
super.load(nbt); super.load(nbt);
this.placementSide = nbt.getByte("side"); this.placementSide = nbt.getByte("side");
this.stepUp = nbt.getBoolean("stepUp"); this.stepUp = nbt.getBoolean("stepUp");
} }
@Override @Override
public void save(NBTTagCompound nbt) public void save(NBTTagCompound nbt)
{ {
super.save(nbt); super.save(nbt);
nbt.setByte("side", (byte) this.placementSide); nbt.setByte("side", (byte) this.placementSide);
nbt.setBoolean("stepUp", this.stepUp); nbt.setBoolean("stepUp", this.stepUp);
} }
@Override @Override
public String getType() public String getType()
{ {
return "resonant_induction_transformer"; return "resonant_induction_transformer";
} }
protected ForgeDirection getFacing() protected ForgeDirection getFacing()
{ {
return ForgeDirection.NORTH; return ForgeDirection.NORTH;
} }
@Override @Override
public boolean canConnect(ForgeDirection direction) public boolean canConnect(ForgeDirection direction)
{ {
return direction == getFacing() || direction == getFacing().getOpposite(); return direction == getFacing() || direction == getFacing().getOpposite();
} }
@Override @Override
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive) public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
{ {
if (from == this.getFacing().getOpposite()) if (from == this.getFacing().getOpposite())
{ {
TileEntity entity = VectorHelper.getTileEntityFromSide(this.world(), new universalelectricity.api.vector.Vector3(this.x(), this.y(), this.z()), this.getFacing()); TileEntity entity = VectorHelper.getTileEntityFromSide(this.world(), new universalelectricity.api.vector.Vector3(this.x(), this.y(), this.z()), this.getFacing());
if (entity instanceof IEnergyInterface) if (entity instanceof IEnergyInterface)
{ {
if (entity instanceof IVoltageInput) if (entity instanceof IVoltageInput)
{ {
long voltage = this.getVoltageOutput(from.getOpposite()); long voltage = this.getVoltageOutput(from.getOpposite());
if (voltage != ((IVoltageInput) entity).getVoltageInput(from)) if (voltage != ((IVoltageInput) entity).getVoltageInput(from))
{ {
((IVoltageInput) entity).onWrongVoltage(from, voltage); ((IVoltageInput) entity).onWrongVoltage(from, voltage);
} }
} }
return ((IEnergyInterface) entity).onReceiveEnergy(from, receive, doReceive); return ((IEnergyInterface) entity).onReceiveEnergy(from, receive, doReceive);
} }
} }
return 0; return 0;
} }
@Override @Override
public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract) public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract)
{ {
return 0; return 0;
} }
@Override @Override
public long getVoltageOutput(ForgeDirection side) public long getVoltageOutput(ForgeDirection side)
{ {
TileEntity entity = VectorHelper.getTileEntityFromSide(this.world(), new universalelectricity.api.vector.Vector3(this.x(), this.y(), this.z()), this.getFacing().getOpposite()); TileEntity entity = VectorHelper.getTileEntityFromSide(this.world(), new universalelectricity.api.vector.Vector3(this.x(), this.y(), this.z()), this.getFacing().getOpposite());
if (entity instanceof IConductor && ((IConductor) entity).getNetwork() instanceof IElectricalNetwork) if (entity instanceof IConductor && ((IConductor) entity).getNetwork() instanceof IElectricalNetwork)
{ {
long voltage = ((IElectricalNetwork) ((IConductor) entity).getNetwork()).getVoltage(); long voltage = ((IElectricalNetwork) ((IConductor) entity).getNetwork()).getVoltage();
if (this.stepUp()) if (this.stepUp())
{ {
return voltage * this.multiplier; return voltage * this.multiplier;
} }
else if (voltage > 0) else if (voltage > 0)
{ {
return voltage / this.multiplier; return voltage / this.multiplier;
} }
} }
else if (entity instanceof IVoltageOutput) else if (entity instanceof IVoltageOutput)
{ {
return ((IVoltageOutput) entity).getVoltageOutput(side); return ((IVoltageOutput) entity).getVoltageOutput(side);
} }
return 0; return 0;
} }
} }

View file

@ -1,12 +1,9 @@
package resonantinduction.transformer; package resonantinduction.transformer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -59,7 +56,7 @@ public class RenderTransformer
break; break;
case 4: case 4:
GL11.glRotatef(90, 0, 0, 1); GL11.glRotatef(90, 0, 0, 1);
GL11.glTranslatef(1, -1,0); GL11.glTranslatef(1, -1, 0);
break; break;
case 5: case 5:
GL11.glRotatef(-90, 0, 0, 1); GL11.glRotatef(-90, 0, 0, 1);

View file

@ -35,112 +35,113 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemWire extends JItemMultiPart public class ItemWire extends JItemMultiPart
{ {
private Icon[] icons = new Icon[EnumWireMaterial.values().length]; private Icon[] icons = new Icon[EnumWireMaterial.values().length];
public ItemWire(int id) public ItemWire(int id)
{ {
super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "wire", id).getInt(id)); super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "wire", id).getInt(id));
this.setUnlocalizedName(ResonantInduction.PREFIX + "wire"); this.setUnlocalizedName(ResonantInduction.PREFIX + "wire");
this.setCreativeTab(TabRI.INSTANCE); this.setCreativeTab(TabRI.INSTANCE);
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Override @Override
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit) public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit)
{ {
BlockCoord onPos = pos.copy().offset(side ^ 1); BlockCoord onPos = pos.copy().offset(side ^ 1);
if (ControlKeyModifer.isControlDown(player)) if (ControlKeyModifer.isControlDown(player))
{ {
PartWire wire = (PartWire) MultiPartRegistry.createPart("resonant_induction_wire", false); PartWire wire = (PartWire) MultiPartRegistry.createPart("resonant_induction_wire", false);
if (wire != null) if (wire != null)
{ {
wire.preparePlacement(itemStack.getItemDamage()); wire.preparePlacement(itemStack.getItemDamage());
} }
return wire; return wire;
} }
else else
{ {
if (!Utility.canPlaceWireOnSide(world, onPos.x, onPos.y, onPos.z, ForgeDirection.getOrientation(side), false)) if (!Utility.canPlaceWireOnSide(world, onPos.x, onPos.y, onPos.z, ForgeDirection.getOrientation(side), false))
{ {
return null; return null;
} }
PartFlatWire wire = (PartFlatWire) MultiPartRegistry.createPart("resonant_induction_flat_wire", false); PartFlatWire wire = (PartFlatWire) MultiPartRegistry.createPart("resonant_induction_flat_wire", false);
if (wire != null) if (wire != null)
{ {
wire.preparePlacement(side, itemStack.getItemDamage()); wire.preparePlacement(side, itemStack.getItemDamage());
} }
return wire; return wire;
} }
} }
@Override @Override
public int getMetadata(int damage) public int getMetadata(int damage)
{ {
return damage; return damage;
} }
@Override @Override
public String getUnlocalizedName(ItemStack itemStack) public String getUnlocalizedName(ItemStack itemStack)
{ {
return super.getUnlocalizedName(itemStack) + "." + EnumWireMaterial.values()[itemStack.getItemDamage()].getName().toLowerCase(); return super.getUnlocalizedName(itemStack) + "." + EnumWireMaterial.values()[itemStack.getItemDamage()].getName().toLowerCase();
} }
@Override @Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
{ {
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{ {
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more information"); list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more information");
} }
else else
{ {
list.add(EnumColor.AQUA + "Resistance: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE)); list.add(EnumColor.AQUA + "Resistance: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE));
list.add(EnumColor.AQUA + "Current Capacity: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE)); list.add(EnumColor.AQUA + "Current Capacity: " + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE));
list.add(EnumColor.AQUA + "Shock Damage: " + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage); list.add(EnumColor.AQUA + "Shock Damage: " + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage);
list.addAll(Calclavia.splitStringPerWord("The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage.", 5)); list.addAll(Calclavia.splitStringPerWord("The energy transfer rate can be increased and the energy loss may be reduced by using a higher the voltage.", 5));
} }
} }
@SideOnly(Side.CLIENT) @Override
public int getSpriteNumber() @SideOnly(Side.CLIENT)
{ public int getSpriteNumber()
return 0; {
} return 0;
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register) public void registerIcons(IconRegister register)
{ {
for (EnumWireMaterial material : EnumWireMaterial.values()) for (EnumWireMaterial material : EnumWireMaterial.values())
{ {
icons[material.ordinal()] = register.registerIcon(ResonantInduction.PREFIX + "wire." + EnumWireMaterial.values()[material.ordinal()].getName().toLowerCase()); icons[material.ordinal()] = register.registerIcon(ResonantInduction.PREFIX + "wire." + EnumWireMaterial.values()[material.ordinal()].getName().toLowerCase());
} }
RenderFlatWire.flatWireTexture = register.registerIcon(ResonantInduction.PREFIX + "models/flatWire"); RenderFlatWire.flatWireTexture = register.registerIcon(ResonantInduction.PREFIX + "models/flatWire");
RenderPartWire.wireIcon = register.registerIcon(ResonantInduction.PREFIX + "models/wire"); RenderPartWire.wireIcon = register.registerIcon(ResonantInduction.PREFIX + "models/wire");
RenderPartWire.insulationIcon = register.registerIcon(ResonantInduction.PREFIX + "models/insulation" + (ResonantInduction.LO_FI_INSULATION ? "tiny" : "")); RenderPartWire.insulationIcon = register.registerIcon(ResonantInduction.PREFIX + "models/insulation" + (ResonantInduction.LO_FI_INSULATION ? "tiny" : ""));
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Icon getIconFromDamage(int meta) public Icon getIconFromDamage(int meta)
{ {
return icons[meta]; return icons[meta];
} }
@Override @Override
public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo) public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo)
{ {
for (EnumWireMaterial mat : EnumWireMaterial.values()) for (EnumWireMaterial mat : EnumWireMaterial.values())
{ {
listToAddTo.add(new ItemStack(itemID, 1, mat.ordinal())); listToAddTo.add(new ItemStack(itemID, 1, mat.ordinal()));
} }
} }
} }

View file

@ -178,14 +178,14 @@ public abstract class PartAdvancedWire extends PartConductor
{ {
if (itemStack != null) if (itemStack != null)
{ {
int dyeColor = Utility.isDye(itemStack); int dyeColor = Utility.isDye(itemStack);
if (dyeColor != -1 && this.isInsulated()) if (dyeColor != -1 && this.isInsulated())
{ {
if (!player.capabilities.isCreativeMode) if (!player.capabilities.isCreativeMode)
{ {
player.inventory.decrStackSize(player.inventory.currentItem, 1); player.inventory.decrStackSize(player.inventory.currentItem, 1);
} }
this.setColor(dyeColor); this.setColor(dyeColor);
return true; return true;
@ -206,10 +206,10 @@ public abstract class PartAdvancedWire extends PartConductor
{ {
if (!player.capabilities.isCreativeMode) if (!player.capabilities.isCreativeMode)
{ {
player.inventory.decrStackSize(player.inventory.currentItem, 1); player.inventory.decrStackSize(player.inventory.currentItem, 1);
} }
this.setInsulated(BlockColored.getDyeFromBlock(itemStack.getItemDamage())); this.setInsulated(BlockColored.getDyeFromBlock(itemStack.getItemDamage()));
return true; return true;
} }
} }

View file

@ -13,76 +13,76 @@ import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.TMultiPart; import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart; import codechicken.multipart.TileMultipart;
public class PartFlatSwitchWire extends PartFlatWire public class PartFlatSwitchWire extends PartFlatWire
{ {
@Override @Override
public boolean canConnectTo(Object obj) public boolean canConnectTo(Object obj)
{ {
if (this.world().isBlockIndirectlyGettingPowered(x(), y(), z())) if (this.world().isBlockIndirectlyGettingPowered(x(), y(), z()))
{ {
return super.canConnectTo(obj); return super.canConnectTo(obj);
} }
else else
{ {
for (TMultiPart tp : tile().jPartList()) for (TMultiPart tp : tile().jPartList())
{ {
if (tp instanceof IRedstonePart) if (tp instanceof IRedstonePart)
{ {
IRedstonePart rp = (IRedstonePart)tp; IRedstonePart rp = (IRedstonePart) tp;
if ((Math.max(rp.strongPowerLevel(this.side ^ 0x1), rp.weakPowerLevel(this.side ^ 0x1)) << 4) > 0) if ((Math.max(rp.strongPowerLevel(this.side ^ 0x1), rp.weakPowerLevel(this.side ^ 0x1)) << 4) > 0)
{ {
return super.canConnectTo(obj); return super.canConnectTo(obj);
} }
} }
} }
} }
return false; return false;
} }
@Override @Override
public String getType() public String getType()
{ {
return "resonant_induction_flat_switch_wire"; return "resonant_induction_flat_switch_wire";
} }
@Override @Override
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item) public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
{ {
TileMultipart tile = tile(); TileMultipart tile = tile();
World w = world(); World w = world();
if (item.getItem().itemID == Block.lever.blockID) if (item.getItem().itemID == Block.lever.blockID)
{ {
if (!w.isRemote) if (!w.isRemote)
{ {
PartFlatWire wire = (PartFlatWire) MultiPartRegistry.createPart("resonant_induction_flat_wire", false); PartFlatWire wire = (PartFlatWire) MultiPartRegistry.createPart("resonant_induction_flat_wire", false);
wire.copyFrom(this); wire.copyFrom(this);
if (tile.canReplacePart(this, wire)) if (tile.canReplacePart(this, wire))
{ {
tile.remPart(this); tile.remPart(this);
TileMultipart.addPart(w, new BlockCoord(tile), wire); TileMultipart.addPart(w, new BlockCoord(tile), wire);
if (!player.capabilities.isCreativeMode) if (!player.capabilities.isCreativeMode)
{ {
tile.dropItems(Collections.singletonList(new ItemStack(Block.lever, 1))); tile.dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
} }
} }
} }
return true; return true;
} }
else else
{ {
return super.activate(player, part, item); return super.activate(player, part, item);
} }
} }
@Override @Override
public void drop() public void drop()
{ {
tile().dropItems(Collections.singletonList(new ItemStack(Block.lever, 1))); tile().dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
super.drop(); super.drop();
} }
} }

View file

@ -278,6 +278,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
super.onNeighborChanged(); super.onNeighborChanged();
} }
@Override
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item) public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
{ {
if (!world().isRemote) if (!world().isRemote)
@ -591,7 +592,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
{ {
int absDir = Rotation.rotateSide(side, r); int absDir = Rotation.rotateSide(side, r);
TMultiPart facePart = tile().partMap(absDir); TMultiPart facePart = tile().partMap(absDir);
if (facePart != null && (!(facePart instanceof PartFlatWire) || !canConnectTo((PartFlatWire) facePart))) if (facePart != null && (!(facePart instanceof PartFlatWire) || !canConnectTo(facePart)))
return false; return false;
if (tile().partMap(PartMap.edgeBetween(side, absDir)) != null) if (tile().partMap(PartMap.edgeBetween(side, absDir)) != null)
@ -712,7 +713,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
{ {
return ((PartFlatWire) tp).connectInternal(this, side); return ((PartFlatWire) tp).connectInternal(this, side);
} }
return true; return true;
} }
@ -724,7 +725,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
if (!(part instanceof PartFlatWire)) if (!(part instanceof PartFlatWire))
return false; return false;
PartFlatWire wire = (PartFlatWire) part; PartFlatWire wire = part;
if (wire.getThickness() == getThickness()) if (wire.getThickness() == getThickness())
return side < wire.side; return side < wire.side;

View file

@ -115,11 +115,11 @@ public class PartWire extends PartAdvancedWire implements TSlottedPart, JNormalO
subParts.add(currentSides[6]); subParts.add(currentSides[6]);
return subParts; return subParts;
} }
public void preparePlacement(int meta) public void preparePlacement(int meta)
{ {
this.setMaterial(meta); this.setMaterial(meta);
} }
@Override @Override
public Iterable<Cuboid6> getCollisionBoxes() public Iterable<Cuboid6> getCollisionBoxes()
@ -277,8 +277,9 @@ public class PartWire extends PartAdvancedWire implements TSlottedPart, JNormalO
*/ */
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side) public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
{ {
return (tile instanceof IConductor ? this.canConnectTo((IConductor) tile) : false) || (isBlockedOnSide(side)); return (tile instanceof IConductor ? this.canConnectTo(tile) : false) || (isBlockedOnSide(side));
// || tile instanceof IBlockableConnection && ((IBlockableConnection) tile).isBlockedOnSide(side.getOpposite()))*/; // || tile instanceof IBlockableConnection && ((IBlockableConnection)
// tile).isBlockedOnSide(side.getOpposite()))*/;
} }
public byte getPossibleWireConnections() public byte getPossibleWireConnections()

View file

@ -4,7 +4,6 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import universalelectricity.api.UniversalClass;
import universalelectricity.api.energy.IConductor; import universalelectricity.api.energy.IConductor;
import universalelectricity.api.energy.IEnergyNetwork; import universalelectricity.api.energy.IEnergyNetwork;
import codechicken.multipart.TMultiPart; import codechicken.multipart.TMultiPart;