Added recipes for multipart wires
This commit is contained in:
parent
e44027bcf5
commit
883c0458da
17 changed files with 293 additions and 225 deletions
|
@ -15,6 +15,7 @@ public class BlockAdvancedFurnace extends BlockFurnace
|
|||
super(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World par1World)
|
||||
{
|
||||
return new TileEntityAdvancedFurnace();
|
||||
|
|
|
@ -16,10 +16,10 @@ public class MultipartRI implements IPartFactory
|
|||
return new PartWire(EnumWireMaterial.COPPER.ordinal());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void init()
|
||||
{
|
||||
MultiPartRegistry.registerParts(this, new String[]{"resonant_induction_wire"});
|
||||
MultiPartRegistry.registerParts(this, new String[] { "resonant_induction_wire" });
|
||||
MultipartGenerator.registerPassThroughInterface("universalelectricity.core.block.IConductor");
|
||||
MultipartGenerator.registerPassThroughInterface("buildcraft.api.power.IPowerReceptor");
|
||||
MultipartGenerator.registerPassThroughInterface("resonantinduction.wire.IInsulatedMaterial");
|
||||
|
|
|
@ -145,14 +145,16 @@ public class ResonantInduction
|
|||
public static Item itemCapacitor;
|
||||
public static Item itemInfiniteCapacitor;
|
||||
public static Item itemLinker;
|
||||
public static Item itemPartWire;
|
||||
/** With Forge Multipart; Use EnumWireMaterial reference. **/
|
||||
private static Item itemPartWire;
|
||||
|
||||
// Blocks
|
||||
public static Block blockTesla;
|
||||
public static Block blockMultimeter;
|
||||
public static Block blockEMContractor;
|
||||
public static Block blockBattery;
|
||||
public static Block blockWire;
|
||||
/** Without Forge Multipart **/
|
||||
private static Block blockWire;
|
||||
|
||||
public static Block blockAdvancedFurnaceIdle, blockAdvancedFurnaceBurning;
|
||||
|
||||
|
@ -185,14 +187,22 @@ public class ResonantInduction
|
|||
itemLinker = new ItemLinker(getNextItemID());
|
||||
itemInfiniteCapacitor = new ItemInfiniteCapacitor(getNextItemID());
|
||||
|
||||
itemPartWire = new ItemPartWire(getNextItemID());
|
||||
if (Loader.isModLoaded("ForgeMultipart"))
|
||||
{
|
||||
itemPartWire = new ItemPartWire(getNextItemID());
|
||||
}
|
||||
|
||||
// Blocks
|
||||
blockTesla = new BlockTesla(getNextBlockID());
|
||||
blockMultimeter = new BlockMultimeter(getNextBlockID());
|
||||
blockEMContractor = new BlockEMContractor(getNextBlockID());
|
||||
blockBattery = new BlockBattery(getNextBlockID());
|
||||
blockWire = new BlockWire(getNextBlockID());
|
||||
|
||||
if (itemPartWire == null)
|
||||
{
|
||||
blockWire = new BlockWire(getNextBlockID());
|
||||
}
|
||||
|
||||
blockAdvancedFurnaceIdle = new BlockAdvancedFurnace(getNextBlockID(), false);
|
||||
blockAdvancedFurnaceBurning = new BlockAdvancedFurnace(getNextBlockID(), true);
|
||||
|
||||
|
@ -207,22 +217,48 @@ public class ResonantInduction
|
|||
GameRegistry.registerBlock(blockMultimeter, ItemBlockMultimeter.class, blockMultimeter.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockEMContractor, ItemBlockContractor.class, blockEMContractor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockBattery, blockBattery.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(blockWire, ItemBlockWire.class, blockWire.getUnlocalizedName());
|
||||
|
||||
if (blockWire != null)
|
||||
{
|
||||
GameRegistry.registerBlock(blockWire, ItemBlockWire.class, blockWire.getUnlocalizedName());
|
||||
}
|
||||
|
||||
// Tiles
|
||||
GameRegistry.registerTileEntity(TileEntityTesla.class, blockTesla.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEntityMultimeter.class, blockMultimeter.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEntityEMContractor.class, blockEMContractor.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEntityBattery.class, blockBattery.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEntityWire.class, blockWire.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEntityTickWire.class, blockWire.getUnlocalizedName() + "2");
|
||||
|
||||
if (blockWire != null)
|
||||
{
|
||||
GameRegistry.registerTileEntity(TileEntityWire.class, blockWire.getUnlocalizedName());
|
||||
GameRegistry.registerTileEntity(TileEntityTickWire.class, blockWire.getUnlocalizedName() + "2");
|
||||
}
|
||||
|
||||
ResonantInduction.proxy.registerRenderers();
|
||||
|
||||
/**
|
||||
* Set reference itemstacks
|
||||
*/
|
||||
TabRI.ITEMSTACK = new ItemStack(blockBattery);
|
||||
OreDictionary.registerOre("copperWire", new ItemStack(blockWire));
|
||||
|
||||
if (itemPartWire != null)
|
||||
{
|
||||
for (EnumWireMaterial material : EnumWireMaterial.values())
|
||||
{
|
||||
material.setWire(itemPartWire);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (EnumWireMaterial material : EnumWireMaterial.values())
|
||||
{
|
||||
material.setWire(blockWire);
|
||||
}
|
||||
}
|
||||
|
||||
// Basic Components
|
||||
BasicRegistry.register("itemIngotCopper");
|
||||
BasicRegistry.register("itemIngotSteel");
|
||||
BasicRegistry.register("itemPlateSteel");
|
||||
BasicRegistry.register("itemIngotBronze");
|
||||
|
@ -244,7 +280,7 @@ public class ResonantInduction
|
|||
metadata.autogenerated = false;
|
||||
|
||||
new MultipartRI().init();
|
||||
|
||||
|
||||
Compatibility.initiate();
|
||||
}
|
||||
|
||||
|
@ -257,7 +293,7 @@ public class ResonantInduction
|
|||
ItemStack emptyCapacitor = new ItemStack(itemCapacitor);
|
||||
((IItemElectric) itemCapacitor).setElectricity(emptyCapacitor, 0);
|
||||
|
||||
final ItemStack defaultWire = new ItemStack(blockWire, 1, EnumWireMaterial.IRON.ordinal());
|
||||
final ItemStack defaultWire = EnumWireMaterial.IRON.getWire();
|
||||
|
||||
/** Capacitor **/
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(emptyCapacitor, "RRR", "RIR", "RRR", 'R', Item.redstone, 'I', UniversalRecipes.PRIMARY_METAL));
|
||||
|
@ -281,25 +317,26 @@ public class ResonantInduction
|
|||
GameRegistry.addRecipe(new ShapedOreRecipe(blockEMContractor, " I ", "GCG", "WWW", 'W', UniversalRecipes.PRIMARY_METAL, 'C', emptyCapacitor, 'G', UniversalRecipes.SECONDARY_METAL, 'I', UniversalRecipes.PRIMARY_METAL));
|
||||
|
||||
/** Wires **/
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWire, 3, EnumWireMaterial.COPPER.ordinal()), "MMM", 'M', "ingotCopper"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWire, 3, EnumWireMaterial.TIN.ordinal()), "MMM", 'M', "ingotTin"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWire, 3, EnumWireMaterial.IRON.ordinal()), "MMM", 'M', Item.ingotIron));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWire, 3, EnumWireMaterial.ALUMINUM.ordinal()), "MMM", 'M', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWire, 3, EnumWireMaterial.SILVER.ordinal()), "MMM", 'M', "ingotSilver"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockWire, 3, EnumWireMaterial.SUPERCONDUCTOR.ordinal()), "MMM", 'M', "ingotSuperconductor"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.COPPER.getWire(3), "MMM", 'M', "ingotCopper"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.TIN.getWire(3), "MMM", 'M', "ingotTin"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.IRON.getWire(3), "MMM", 'M', Item.ingotIron));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.ALUMINUM.getWire(3), "MMM", 'M', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SILVER.getWire(), "MMM", 'M', "ingotSilver"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", 'M', "ingotSuperconductor"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(3), "MMM", "MEM", "MMM", 'M', Item.ingotGold, "E", Item.eyeOfEnder));
|
||||
|
||||
/** Wire Compatiblity **/
|
||||
if (Loader.isModLoaded("IC2"))
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockWire, 1, EnumWireMaterial.COPPER.ordinal()), Items.getItem("copperCableItem")));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockWire, 1, EnumWireMaterial.TIN.ordinal()), Items.getItem("tinCableItem")));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockWire, 1, EnumWireMaterial.IRON.ordinal()), Items.getItem("ironCableItem")));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockWire, 2, EnumWireMaterial.SUPERCONDUCTOR.ordinal()), Items.getItem("glassFiberCableItem")));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire(), Items.getItem("copperCableItem")));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.TIN.getWire(), Items.getItem("tinCableItem")));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.IRON.getWire(), Items.getItem("ironCableItem")));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.SUPERCONDUCTOR.getWire(), Items.getItem("glassFiberCableItem")));
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("Mekanism"))
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(blockWire, 1, EnumWireMaterial.COPPER.ordinal()), "universalCable"));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(EnumWireMaterial.COPPER.getWire(), "universalCable"));
|
||||
}
|
||||
|
||||
/** Inject new furnace tile class */
|
||||
|
|
|
@ -10,9 +10,10 @@ import net.minecraft.tileentity.TileEntityFurnace;
|
|||
*/
|
||||
public class TileEntityAdvancedFurnace extends TileEntityFurnace
|
||||
{
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
System.out.println("WOR");
|
||||
}
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
System.out.println("WOR");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TileEntityBattery extends TileEntityUniversalElectrical implements
|
|||
{
|
||||
PacketDispatcher.sendPacketToPlayer(PacketHandler.getTileEntityPacket(this, this.getNetworkedData(new ArrayList()).toArray()), (Player) player);
|
||||
}
|
||||
|
||||
|
||||
this.produce();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,11 +75,11 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
{
|
||||
if (block instanceof BlockBattery)
|
||||
{
|
||||
// FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderBattery.TEXTURE);
|
||||
|
||||
// FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderBattery.TEXTURE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,22 +5,22 @@ import codechicken.lib.vec.Transformation;
|
|||
import codechicken.lib.vec.VariableTransformation;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
|
||||
public class InvertX extends VariableTransformation {
|
||||
public InvertX() {
|
||||
super(new Matrix4(
|
||||
-1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1));
|
||||
}
|
||||
public class InvertX extends VariableTransformation
|
||||
{
|
||||
public InvertX()
|
||||
{
|
||||
super(new Matrix4(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(Vector3 vec) {
|
||||
this.mat.apply(vec);
|
||||
}
|
||||
@Override
|
||||
public void apply(Vector3 vec)
|
||||
{
|
||||
this.mat.apply(vec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transformation inverse() {
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Transformation inverse()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -11,6 +11,10 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.wire.multipart.PartConductor;
|
||||
import resonantinduction.wire.multipart.PartWire;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import codechicken.lib.colour.Colour;
|
||||
import codechicken.lib.colour.ColourRGBA;
|
||||
import codechicken.lib.lighting.LightModel;
|
||||
|
@ -21,9 +25,6 @@ import codechicken.lib.render.IconTransformation;
|
|||
import codechicken.lib.render.TextureUtils;
|
||||
import codechicken.lib.vec.Rotation;
|
||||
import codechicken.lib.vec.Translation;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.wire.multipart.PartWire;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -46,46 +47,48 @@ public class RenderPartWire
|
|||
public static FloatBuffer zero = BufferUtils.createFloatBuffer(4);
|
||||
public static FloatBuffer defaultAmbient = BufferUtils.createFloatBuffer(4);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
shinyModels = CCModel.parseObjModels(new ResourceLocation("resonantinduction", "models/wireShine.obj"), 7, new InvertX());
|
||||
for (CCModel c : shinyModels.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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
shinyModels = CCModel.parseObjModels(new ResourceLocation("resonantinduction", "models/wireShine.obj"), 7, new InvertX());
|
||||
for (CCModel c : shinyModels.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 static void loadBuffer(FloatBuffer buffer, float... src)
|
||||
{
|
||||
buffer.clear();
|
||||
buffer.put(src);
|
||||
buffer.flip();
|
||||
}
|
||||
public static void loadBuffer(FloatBuffer buffer, float... src)
|
||||
{
|
||||
buffer.clear();
|
||||
buffer.put(src);
|
||||
buffer.flip();
|
||||
}
|
||||
|
||||
public void renderShine(PartWire wire, double x, double y, double z, float f)
|
||||
public void renderShine(PartWire wire, double x, double y, double z, float f)
|
||||
{
|
||||
if (wire != null)
|
||||
{
|
||||
|
@ -97,7 +100,7 @@ public class RenderPartWire
|
|||
GL11.glDisable(GL11.GL_LIGHT1);
|
||||
GL11.glEnable(GL11.GL_LIGHT3);
|
||||
GL11.glLight(GL11.GL_LIGHT3, GL11.GL_POSITION, location);
|
||||
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, zero);
|
||||
|
||||
|
@ -109,7 +112,7 @@ public class RenderPartWire
|
|||
byte renderSides = wire.getAllCurrentConnections();
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (PartWire.connectionMapContainsSide(renderSides, side))
|
||||
if (PartConductor.connectionMapContainsSide(renderSides, side))
|
||||
renderSideShine(side, wire);
|
||||
}
|
||||
CCRenderState.draw();
|
||||
|
@ -119,21 +122,21 @@ public class RenderPartWire
|
|||
GL11.glEnable(GL11.GL_LIGHT1);
|
||||
GL11.glDisable(GL11.GL_LIGHT3);
|
||||
|
||||
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, defaultAmbient);
|
||||
GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, defaultAmbient);
|
||||
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void registerIcons(IconRegister iconReg)
|
||||
{
|
||||
wireIcon = iconReg.registerIcon("resonantinduction:models/wire");
|
||||
insulationIcon = iconReg.registerIcon("resonantinduction:models/insulation" + (ResonantInduction.LO_FI_INSULATION ? "tiny" : ""));
|
||||
breakIcon = iconReg.registerIcon("resonantinduction:wire");
|
||||
}
|
||||
|
||||
|
||||
public void renderStatic(PartWire wire)
|
||||
{
|
||||
TextureUtils.bindAtlas(0);
|
||||
|
@ -144,11 +147,11 @@ public class RenderPartWire
|
|||
byte renderSides = wire.getAllCurrentConnections();
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (PartWire.connectionMapContainsSide(renderSides, side))
|
||||
renderSide(side, wire);
|
||||
if (PartConductor.connectionMapContainsSide(renderSides, side))
|
||||
renderSide(side, wire);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void renderSide(ForgeDirection side, PartWire wire)
|
||||
{
|
||||
String name = side.name().toLowerCase();
|
||||
|
@ -158,12 +161,12 @@ public class RenderPartWire
|
|||
renderPart(wireIcon, models.get(name), wire.x(), wire.y(), wire.z(), colour);
|
||||
if (wire.isInsulated())
|
||||
{
|
||||
Vector3 vecColour = ResonantInduction.DYE_COLORS[wire.dyeID];
|
||||
Vector3 vecColour = ResonantInduction.DYE_COLORS[wire.dyeID];
|
||||
Colour insulationColour = new ColourRGBA(vecColour.x, vecColour.y, vecColour.z, 1);
|
||||
renderPart(insulationIcon, models.get(name+"Insulation"), wire.x(), wire.y(), wire.z(), insulationColour);
|
||||
renderPart(insulationIcon, models.get(name + "Insulation"), wire.x(), wire.y(), wire.z(), insulationColour);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void renderSideShine(ForgeDirection side, PartWire wire)
|
||||
{
|
||||
String name = side.name().toLowerCase();
|
||||
|
@ -171,14 +174,14 @@ public class RenderPartWire
|
|||
Vector3 materialColour = wire.getMaterial().color;
|
||||
renderPartShine(shinyModels.get(name));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public void renderPartShine(CCModel cc) {
|
||||
cc.render(null, 0, 0);
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
public void renderPartShine(CCModel cc)
|
||||
{
|
||||
cc.render(null, 0, 0);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
package resonantinduction.wire;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
/**
|
||||
|
@ -12,8 +16,7 @@ import universalelectricity.core.vector.Vector3;
|
|||
|
||||
public enum EnumWireMaterial
|
||||
{
|
||||
COPPER(12.5f, 3, 2, new Vector3(184, 115, 51)),
|
||||
TIN(13, 2, 0.5f, new Vector3(132, 132, 130)),
|
||||
COPPER(12.5f, 3, 2, new Vector3(184, 115, 51)), TIN(13, 2, 0.5f, new Vector3(132, 132, 130)),
|
||||
IRON(0.1f, 2, 4, new Vector3(97, 102, 105)),
|
||||
ALUMINUM(0.025f, 6, 0.15f, new Vector3(215, 205, 181)),
|
||||
SILVER(0.005f, 1, 2, new Vector3(192, 192, 192)),
|
||||
|
@ -23,12 +26,44 @@ public enum EnumWireMaterial
|
|||
public final float damage;
|
||||
public final float maxAmps;
|
||||
public final Vector3 color;
|
||||
private ItemStack wire;
|
||||
|
||||
EnumWireMaterial(float resistance, float electrocutionDamage, float maxAmps, Vector3 color)
|
||||
{
|
||||
this.resistance = resistance;
|
||||
this.damage = electrocutionDamage;
|
||||
this.maxAmps = maxAmps;
|
||||
this.color = color.scale(1D/255D);
|
||||
this.color = color.scale(1D / 255D);
|
||||
}
|
||||
|
||||
public ItemStack getWire()
|
||||
{
|
||||
return this.getWire(1);
|
||||
}
|
||||
|
||||
public ItemStack getWire(int amount)
|
||||
{
|
||||
ItemStack returnStack = this.wire.copy();
|
||||
returnStack.stackSize = amount;
|
||||
return returnStack;
|
||||
}
|
||||
|
||||
public void setWire(ItemStack item)
|
||||
{
|
||||
if (this.wire == null)
|
||||
{
|
||||
this.wire = item;
|
||||
OreDictionary.registerOre(this.name().toLowerCase() + "Wire", this.wire);
|
||||
}
|
||||
}
|
||||
|
||||
public void setWire(Item item)
|
||||
{
|
||||
this.setWire(new ItemStack(item, 1, this.ordinal()));
|
||||
}
|
||||
|
||||
public void setWire(Block block)
|
||||
{
|
||||
this.setWire(new ItemStack(block, 1, this.ordinal()));
|
||||
}
|
||||
}
|
|
@ -3,8 +3,10 @@ package resonantinduction.wire;
|
|||
public interface IInsulation
|
||||
{
|
||||
public boolean isInsulated();
|
||||
|
||||
public void setInsulated(boolean insulated);
|
||||
|
||||
|
||||
public int getInsulationColor();
|
||||
|
||||
public void setInsulationColor(int dyeID);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TileEntityWire extends TileEntityUniversalConductor implements IPac
|
|||
if (connectTile instanceof IWireMaterial)
|
||||
{
|
||||
IWireMaterial wireTile = (IWireMaterial) connectTile;
|
||||
|
||||
|
||||
if (wireTile.getMaterial() != this.getMaterial())
|
||||
{
|
||||
return false;
|
||||
|
@ -75,7 +75,7 @@ public class TileEntityWire extends TileEntityUniversalConductor implements IPac
|
|||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (/*tileEntity.getClass().isInstance(this) && */tileEntity instanceof INetworkProvider)
|
||||
if (/* tileEntity.getClass().isInstance(this) && */tileEntity instanceof INetworkProvider)
|
||||
{
|
||||
this.getNetwork().merge(((INetworkProvider) tileEntity).getNetwork());
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ public class TileEntityWire extends TileEntityUniversalConductor implements IPac
|
|||
return getMaterial().maxAmps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumWireMaterial getMaterial()
|
||||
{
|
||||
return EnumWireMaterial.values()[this.getTypeID()];
|
||||
|
@ -218,7 +219,7 @@ public class TileEntityWire extends TileEntityUniversalConductor implements IPac
|
|||
{
|
||||
if (insulated && !isInsulated())
|
||||
setInsulated();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -230,6 +231,6 @@ public class TileEntityWire extends TileEntityUniversalConductor implements IPac
|
|||
@Override
|
||||
public void setInsulationColor(int dyeID)
|
||||
{
|
||||
setDye(dyeID);
|
||||
setDye(dyeID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,6 @@ package resonantinduction.wire.multipart;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.TabRI;
|
||||
import resonantinduction.render.RenderPartWire;
|
||||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -15,6 +9,12 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.TabRI;
|
||||
import resonantinduction.render.RenderPartWire;
|
||||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||
import codechicken.lib.vec.BlockCoord;
|
||||
import codechicken.lib.vec.Vector3;
|
||||
import codechicken.multipart.JItemMultiPart;
|
||||
|
|
|
@ -5,7 +5,7 @@ import codechicken.multipart.TMultiPart;
|
|||
import codechicken.multipart.handler.MultipartProxy;
|
||||
|
||||
public abstract class PartAdvanced extends TMultiPart
|
||||
{
|
||||
{
|
||||
protected long ticks = 0;
|
||||
|
||||
@Override
|
||||
|
@ -23,11 +23,11 @@ public abstract class PartAdvanced extends TMultiPart
|
|||
|
||||
this.ticks++;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAdded()
|
||||
{
|
||||
world().notifyBlocksOfNeighborChange(x(), y(), z(), ((Block)MultipartProxy.block()).blockID);
|
||||
world().notifyBlocksOfNeighborChange(x(), y(), z(), ((Block) MultipartProxy.block()).blockID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package resonantinduction.wire.multipart;
|
||||
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import universalelectricity.core.block.IConnector;
|
||||
|
@ -13,6 +9,7 @@ import universalelectricity.core.electricity.NetworkLoader;
|
|||
import universalelectricity.core.grid.IElectricityNetwork;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
public abstract class PartConductor extends PartAdvanced implements IConductor
|
||||
{
|
||||
|
@ -21,7 +18,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
public TileEntity[] adjacentConnections = null;
|
||||
public byte currentWireConnections = 0x00;
|
||||
public byte currentAcceptorConnections = 0x00;
|
||||
|
||||
|
||||
public byte getAllCurrentConnections()
|
||||
{
|
||||
return (byte) (currentWireConnections | currentAcceptorConnections);
|
||||
|
@ -32,7 +29,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
byte tester = (byte) (1 << side.ordinal());
|
||||
return ((connections & tester) > 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void bind(TileMultipart t)
|
||||
{
|
||||
|
@ -53,7 +50,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
{
|
||||
if (!this.world().isRemote && this.tile() instanceof IConductor)
|
||||
{
|
||||
this.getNetwork().split((IConductor)this.tile());
|
||||
this.getNetwork().split((IConductor) this.tile());
|
||||
}
|
||||
|
||||
super.preRemove();
|
||||
|
@ -70,19 +67,19 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
{
|
||||
if (this.network == null && this.tile() instanceof IConductor)
|
||||
{
|
||||
this.setNetwork(NetworkLoader.getNewNetwork((IConductor)this.tile()));
|
||||
this.setNetwork(NetworkLoader.getNewNetwork((IConductor) this.tile()));
|
||||
}
|
||||
|
||||
return this.network;
|
||||
}
|
||||
|
||||
|
||||
public boolean canConnectBothSides(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
boolean notPrevented = !connectionPrevented(tile, side);
|
||||
|
||||
|
||||
if (tile instanceof IConnector)
|
||||
{
|
||||
notPrevented &= ((IConnector)tile).canConnect(side.getOpposite());
|
||||
notPrevented &= ((IConnector) tile).canConnect(side.getOpposite());
|
||||
}
|
||||
return notPrevented;
|
||||
}
|
||||
|
@ -95,9 +92,10 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
|
||||
/**
|
||||
* Override if there are ways of preventing a connection
|
||||
*
|
||||
* @param tile The TileEntity on the given side
|
||||
* @param side The side we're checking
|
||||
* @return Whether we're preventing connections on given side or to given tileEntity
|
||||
* @return Whether we're preventing connections on given side or to given tileEntity
|
||||
*/
|
||||
public boolean connectionPrevented(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
|
@ -107,7 +105,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
public byte getPossibleWireConnections()
|
||||
{
|
||||
byte connections = 0x00;
|
||||
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(this.world(), new Vector3(tile()), side);
|
||||
|
@ -116,11 +114,11 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
}
|
||||
return connections;
|
||||
}
|
||||
|
||||
|
||||
public byte getPossibleAcceptorConnections()
|
||||
{
|
||||
byte connections = 0x00;
|
||||
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(this.world(), new Vector3(tile()), side);
|
||||
|
@ -129,7 +127,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
}
|
||||
return connections;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Override if there are different kinds of acceptor possible
|
||||
*/
|
||||
|
@ -146,16 +144,16 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
this.adjacentConnections = null;
|
||||
byte possibleWireConnections = getPossibleWireConnections();
|
||||
byte possibleAcceptorConnections = getPossibleAcceptorConnections();
|
||||
|
||||
|
||||
if (possibleWireConnections != currentWireConnections)
|
||||
{
|
||||
byte or = (byte) (possibleWireConnections | currentWireConnections);
|
||||
if (or != possibleWireConnections) //Connections have been removed
|
||||
if (or != possibleWireConnections) // Connections have been removed
|
||||
{
|
||||
this.getNetwork().split((IConductor) tile());
|
||||
this.setNetwork(null);
|
||||
}
|
||||
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (connectionMapContainsSide(possibleWireConnections, side))
|
||||
|
@ -169,20 +167,19 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
}
|
||||
}
|
||||
|
||||
currentWireConnections = possibleWireConnections;
|
||||
currentWireConnections = possibleWireConnections;
|
||||
}
|
||||
|
||||
|
||||
currentAcceptorConnections = possibleAcceptorConnections;
|
||||
this.getNetwork().refresh();
|
||||
this.sendDescUpdate();
|
||||
this.getNetwork().refresh();
|
||||
this.sendDescUpdate();
|
||||
}
|
||||
tile().markRender();
|
||||
}
|
||||
|
||||
/**
|
||||
* Should include connections that are in the current connection maps
|
||||
* even if those connections aren't allowed any more. This is so that
|
||||
* networks split correctly.
|
||||
* Should include connections that are in the current connection maps even if those connections
|
||||
* aren't allowed any more. This is so that networks split correctly.
|
||||
*/
|
||||
@Override
|
||||
public TileEntity[] getAdjacentConnections()
|
||||
|
@ -190,12 +187,12 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
if (this.adjacentConnections == null)
|
||||
{
|
||||
this.adjacentConnections = new TileEntity[6];
|
||||
|
||||
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
ForgeDirection side = ForgeDirection.getOrientation(i);
|
||||
TileEntity tileEntity = VectorHelper.getTileEntityFromSide(this.world(), new Vector3(tile()), side);
|
||||
|
||||
|
||||
if (isCurrentlyConnected(side))
|
||||
{
|
||||
adjacentConnections[i] = tileEntity;
|
||||
|
@ -204,7 +201,7 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
}
|
||||
return this.adjacentConnections;
|
||||
}
|
||||
|
||||
|
||||
public boolean isCurrentlyConnected(ForgeDirection side)
|
||||
{
|
||||
return connectionMapContainsSide(this.getAllCurrentConnections(), side);
|
||||
|
@ -220,21 +217,21 @@ public abstract class PartConductor extends PartAdvanced implements IConductor
|
|||
TileEntity connectTile = connectPos.getTileEntity(this.world());
|
||||
return !connectionPrevented(connectTile, direction);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAdded()
|
||||
{
|
||||
super.onAdded();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onChunkLoad()
|
||||
{
|
||||
super.onChunkLoad();
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
|
|
|
@ -1,24 +1,21 @@
|
|||
package resonantinduction.wire.multipart;
|
||||
|
||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import universalelectricity.compatibility.Compatibility;
|
||||
import universalelectricity.core.block.IConnector;
|
||||
import universalelectricity.core.block.INetworkProvider;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergyAcceptor;
|
||||
import ic2.api.energy.tile.IEnergyEmitter;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
import universalelectricity.compatibility.Compatibility;
|
||||
import universalelectricity.core.electricity.ElectricityPack;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
|
@ -37,7 +34,7 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
|
|||
this.powerHandler.configure(0, this.buildcraftBuffer, this.buildcraftBuffer, this.buildcraftBuffer * 2);
|
||||
this.powerHandler.configurePowerPerdition(0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isValidAcceptor(TileEntity tile)
|
||||
{
|
||||
|
@ -48,14 +45,10 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
|
|||
else if (Compatibility.isBuildcraftLoaded() && tile instanceof IPowerReceptor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.isValidAcceptor(tile);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public boolean canUpdate() { return !this.isAddedToEnergyNet; }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onWorldJoin()
|
||||
{
|
||||
|
@ -108,9 +101,11 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
|
|||
this.unloadTileIC2();
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRemoved() {}
|
||||
public void onRemoved()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRemove()
|
||||
|
@ -197,7 +192,7 @@ public abstract class PartUniversalConductor extends PartConductor implements IE
|
|||
ElectricityPack pack = ElectricityPack.getFromWatts(workProvider.useEnergy(0, this.getNetwork().getRequest(tile()).getWatts() * Compatibility.TO_BC_RATIO, true) * Compatibility.BC3_RATIO, 120);
|
||||
this.getNetwork().produce(pack, ignoreTiles.toArray(new TileEntity[0]));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public World getWorld()
|
||||
{
|
||||
|
|
|
@ -7,12 +7,6 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.render.RenderPartWire;
|
||||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import resonantinduction.wire.IInsulatedMaterial;
|
||||
import resonantinduction.wire.IInsulation;
|
||||
import resonantinduction.wire.IWireMaterial;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
|
@ -23,16 +17,16 @@ import net.minecraft.item.ItemShears;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.render.RenderPartWire;
|
||||
import resonantinduction.wire.EnumWireMaterial;
|
||||
import resonantinduction.wire.IInsulatedMaterial;
|
||||
import resonantinduction.wire.IInsulation;
|
||||
import resonantinduction.wire.IWireMaterial;
|
||||
import universalelectricity.compatibility.Compatibility;
|
||||
import universalelectricity.core.block.IConductor;
|
||||
import universalelectricity.core.block.INetworkProvider;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.core.vector.VectorHelper;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
|
@ -113,6 +107,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
|
|||
return super.canConnect(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean connectionPrevented(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
if (tile instanceof IWireMaterial)
|
||||
|
@ -134,6 +129,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
|
|||
return (this.isBlockedOnSide(side) || tile instanceof IBlockableConnection && ((IBlockableConnection) tile).isBlockedOnSide(side.getOpposite()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getPossibleWireConnections()
|
||||
{
|
||||
if (this.world().isBlockIndirectlyGettingPowered(this.x(), this.y(), this.z()))
|
||||
|
@ -143,6 +139,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
|
|||
return super.getPossibleWireConnections();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getPossibleAcceptorConnections()
|
||||
{
|
||||
if (this.world().isBlockIndirectlyGettingPowered(this.x(), this.y(), this.z()))
|
||||
|
@ -164,6 +161,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
|
|||
return getMaterial().maxAmps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumWireMaterial getMaterial()
|
||||
{
|
||||
return material;
|
||||
|
@ -314,7 +312,7 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
|
|||
@Override
|
||||
public ItemStack pickItem(MovingObjectPosition hit)
|
||||
{
|
||||
return new ItemStack(ResonantInduction.itemPartWire, 1, this.getTypeID());
|
||||
return EnumWireMaterial.values()[this.getTypeID()].getWire();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -345,8 +343,6 @@ public class PartWire extends PartUniversalConductor implements TSlottedPart, JN
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if (!world().isRemote)
|
||||
player.addChatMessage(getNetwork().toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -395,7 +391,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);
|
||||
this.tile().notifyPartChange(this);
|
||||
}
|
||||
|
||||
public void setInsulated(int dyeColour)
|
||||
|
@ -404,7 +400,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);
|
||||
this.tile().notifyPartChange(this);
|
||||
}
|
||||
|
||||
public void setInsulated()
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package resonantinduction.wire.multipart.javatraits;
|
||||
|
||||
import java.util.Set;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
|
@ -14,41 +15,40 @@ public class TEnergySink extends TileMultipart implements IEnergySink
|
|||
public Set<IEnergySink> ic2Sinks = new HashSet<IEnergySink>();
|
||||
|
||||
@Override
|
||||
public void copyFrom(TileMultipart that)
|
||||
{
|
||||
super.copyFrom(that);
|
||||
if(that instanceof TEnergySink)
|
||||
ic2Sinks = ((TEnergySink)that).ic2Sinks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindPart(TMultiPart part)
|
||||
{
|
||||
super.bindPart(part);
|
||||
if(part instanceof IEnergySink)
|
||||
ic2Sinks.add((IEnergySink)part);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partRemoved(TMultiPart part, int p)
|
||||
{
|
||||
super.partRemoved(part, p);
|
||||
if(part instanceof IEnergySink)
|
||||
ic2Sinks.remove((IEnergySink)part);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearParts()
|
||||
{
|
||||
super.clearParts();
|
||||
ic2Sinks.clear();
|
||||
}
|
||||
|
||||
public void copyFrom(TileMultipart that)
|
||||
{
|
||||
super.copyFrom(that);
|
||||
if (that instanceof TEnergySink)
|
||||
ic2Sinks = ((TEnergySink) that).ic2Sinks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindPart(TMultiPart part)
|
||||
{
|
||||
super.bindPart(part);
|
||||
if (part instanceof IEnergySink)
|
||||
ic2Sinks.add((IEnergySink) part);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void partRemoved(TMultiPart part, int p)
|
||||
{
|
||||
super.partRemoved(part, p);
|
||||
if (part instanceof IEnergySink)
|
||||
ic2Sinks.remove(part);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearParts()
|
||||
{
|
||||
super.clearParts();
|
||||
ic2Sinks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
|
||||
{
|
||||
for (IEnergySink sink: this.ic2Sinks)
|
||||
for (IEnergySink sink : this.ic2Sinks)
|
||||
{
|
||||
if (sink.acceptsEnergyFrom(emitter, direction))
|
||||
return true;
|
||||
|
@ -61,7 +61,7 @@ public class TEnergySink extends TileMultipart implements IEnergySink
|
|||
{
|
||||
double demanded = 0;
|
||||
|
||||
for (IEnergySink sink: this.ic2Sinks)
|
||||
for (IEnergySink sink : this.ic2Sinks)
|
||||
{
|
||||
demanded += sink.demandedEnergyUnits();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class TEnergySink extends TileMultipart implements IEnergySink
|
|||
@Override
|
||||
public double injectEnergyUnits(ForgeDirection directionFrom, double amount)
|
||||
{
|
||||
for (IEnergySink sink: this.ic2Sinks)
|
||||
for (IEnergySink sink : this.ic2Sinks)
|
||||
{
|
||||
amount = sink.injectEnergyUnits(directionFrom, Math.min(amount, sink.demandedEnergyUnits()));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class TEnergySink extends TileMultipart implements IEnergySink
|
|||
public int getMaxSafeInput()
|
||||
{
|
||||
int safe = 0;
|
||||
for (IEnergySink sink: this.ic2Sinks)
|
||||
for (IEnergySink sink : this.ic2Sinks)
|
||||
{
|
||||
safe += sink.getMaxSafeInput();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue