Minor clean up
This commit is contained in:
parent
2ee938dc33
commit
2eec7f95c8
27 changed files with 476 additions and 524 deletions
|
@ -1 +1 @@
|
|||
Subproject commit c56f08b7e4283d77f0dac6317b29f0c5b85f2190
|
||||
Subproject commit efbdc74c82b31b476f5ece15bb379dfa9f98200a
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<get src="http://files.minecraftforge.net/CodeChickenLib/CodeChickenLib-dev-1.6.4-1.0.0.49.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"/>
|
||||
|
||||
<copy todir="${dir.mcp}/src/minecraft">
|
||||
|
@ -71,12 +71,6 @@
|
|||
<exclude name="**/*.java"/>
|
||||
<exclude name="**/*.xml"/>
|
||||
</fileset>
|
||||
|
||||
<fileset dir="${dir.development}Calclavia-Core/src/main/resources/">
|
||||
<exclude name=".git/**"/>
|
||||
<exclude name="**/*.java"/>
|
||||
<exclude name="**/*.xml"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<copy todir="APIContents">
|
||||
|
|
|
@ -65,12 +65,12 @@ public class CommonProxy implements IGuiHandler
|
|||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -13,14 +13,8 @@ import codechicken.multipart.TMultiPart;
|
|||
public class MultipartRI implements IPartFactory
|
||||
{
|
||||
public static MultipartRI INSTANCE;
|
||||
|
||||
public static final String[] PART_TYPES = {
|
||||
"resonant_induction_wire",
|
||||
"resonant_induction_flat_wire",
|
||||
"resonant_induction_flat_switch_wire",
|
||||
"resonant_induction_multimeter",
|
||||
"resonant_induction_transformer"
|
||||
};
|
||||
|
||||
public static final String[] PART_TYPES = { "resonant_induction_wire", "resonant_induction_flat_wire", "resonant_induction_flat_switch_wire", "resonant_induction_multimeter", "resonant_induction_transformer" };
|
||||
|
||||
public MultipartRI()
|
||||
{
|
||||
|
@ -33,24 +27,24 @@ public class MultipartRI implements IPartFactory
|
|||
@Override
|
||||
public TMultiPart createPart(String name, boolean client)
|
||||
{
|
||||
switch(name)
|
||||
{
|
||||
case "resonant_induction_wire":
|
||||
return new PartWire();
|
||||
|
||||
case "resonant_induction_flat_wire":
|
||||
return new PartFlatWire();
|
||||
|
||||
case "resonant_induction_flat_switch_wire":
|
||||
return new PartFlatSwitchWire();
|
||||
|
||||
case "resonant_induction_multimeter":
|
||||
return new PartMultimeter();
|
||||
|
||||
case "resonant_induction_transformer":
|
||||
return new PartTransformer();
|
||||
}
|
||||
|
||||
switch (name)
|
||||
{
|
||||
case "resonant_induction_wire":
|
||||
return new PartWire();
|
||||
|
||||
case "resonant_induction_flat_wire":
|
||||
return new PartFlatWire();
|
||||
|
||||
case "resonant_induction_flat_switch_wire":
|
||||
return new PartFlatSwitchWire();
|
||||
|
||||
case "resonant_induction_multimeter":
|
||||
return new PartMultimeter();
|
||||
|
||||
case "resonant_induction_transformer":
|
||||
return new PartTransformer();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,36 +35,18 @@ public class Utility
|
|||
return true;
|
||||
return b.isBlockSolidOnSide(w, x, y, z, side);
|
||||
}
|
||||
|
||||
public static int isDye(ItemStack is)
|
||||
{
|
||||
String[] dyes =
|
||||
{
|
||||
"dyeBlack",
|
||||
"dyeRed",
|
||||
"dyeGreen",
|
||||
"dyeBrown",
|
||||
"dyeBlue",
|
||||
"dyePurple",
|
||||
"dyeCyan",
|
||||
"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;
|
||||
}
|
||||
|
||||
public static int isDye(ItemStack is)
|
||||
{
|
||||
String[] dyes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package resonantinduction.base;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.handler.MultipartProxy;
|
||||
|
||||
public abstract class PartAdvanced extends TMultiPart
|
||||
{
|
||||
|
|
|
@ -2,12 +2,10 @@ package resonantinduction.battery;
|
|||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
|
||||
public class BatteryStructure extends EnergyStorageHandler
|
||||
{
|
||||
|
@ -76,10 +74,10 @@ public class BatteryStructure extends EnergyStorageHandler
|
|||
public void merge(TileBattery tile)
|
||||
{
|
||||
// Merge structure.
|
||||
long energyToMerge = ((TileBattery) tile).structure.getEnergy();
|
||||
long capacityToMerge = ((TileBattery) tile).structure.getEnergyCapacity();
|
||||
this.battery.addAll(((TileBattery) tile).structure.battery);
|
||||
((TileBattery) tile).structure.battery.clear();
|
||||
long energyToMerge = tile.structure.getEnergy();
|
||||
long capacityToMerge = tile.structure.getEnergyCapacity();
|
||||
this.battery.addAll(tile.structure.battery);
|
||||
tile.structure.battery.clear();
|
||||
this.resetReferences();
|
||||
this.setCapacity(capacityToMerge);
|
||||
this.receiveEnergy(energyToMerge, true);
|
||||
|
|
|
@ -5,16 +5,12 @@ package resonantinduction.battery;
|
|||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.api.ICapacitor;
|
||||
import resonantinduction.base.BlockBase;
|
||||
import resonantinduction.base.ListUtil;
|
||||
import resonantinduction.render.BlockRenderingHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.model.ModelBattery;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
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 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
|
||||
{
|
||||
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");
|
||||
static IModelCustom advancedmodel = AdvancedModelLoader.loadModel(ResonantInduction.MODEL_DIRECTORY + "battery.obj");
|
||||
|
||||
public static void render()
|
||||
{
|
||||
/*
|
||||
advancedmodel.renderAll();
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderBattery.TEXTURE);*/
|
||||
* advancedmodel.renderAll();
|
||||
* FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderBattery.TEXTURE);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,6 @@ import calclavia.lib.prefab.tile.TileElectrical;
|
|||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
/**
|
||||
* A modular battery.
|
||||
|
@ -46,7 +45,7 @@ public class TileBattery extends TileElectrical implements IPacketSender, IPacke
|
|||
{
|
||||
this.energy = new EnergyStorageHandler(STORAGE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initiate()
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ public class BlockAdvancedFurnace extends BlockFurnace
|
|||
@Override
|
||||
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);
|
||||
|
||||
if (((TileAdvancedFurnace) tileEntity).isBurning())
|
||||
|
@ -92,36 +92,36 @@ public class BlockAdvancedFurnace extends BlockFurnace
|
|||
@Override
|
||||
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())
|
||||
{
|
||||
int l = world.getBlockMetadata(x, y, z);
|
||||
float f = (float) x + 0.5F;
|
||||
float f1 = (float) y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = (float) z + 0.5F;
|
||||
float f = x + 0.5F;
|
||||
float f1 = y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F;
|
||||
float f2 = z + 0.5F;
|
||||
float f3 = 0.52F;
|
||||
float f4 = par5Random.nextFloat() * 0.6F - 0.3F;
|
||||
|
||||
if (l == 4)
|
||||
{
|
||||
world.spawnParticle("smoke", (double) (f - f3), (double) f1, (double) (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("smoke", f - f3, f1, 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)
|
||||
{
|
||||
world.spawnParticle("smoke", (double) (f + f3), (double) f1, (double) (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("smoke", f + f3, f1, 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)
|
||||
{
|
||||
world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (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("smoke", f + f4, f1, 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)
|
||||
{
|
||||
world.spawnParticle("smoke", (double) (f + f4), (double) f1, (double) (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("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,6 @@ package resonantinduction.furnace;
|
|||
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
|
@ -20,6 +16,10 @@ import universalelectricity.api.energy.EnergyStorageHandler;
|
|||
import universalelectricity.api.energy.IEnergyContainer;
|
||||
import universalelectricity.api.energy.IEnergyInterface;
|
||||
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.
|
||||
|
|
|
@ -73,14 +73,15 @@ public class GuiMultimeter extends GuiContainerBase
|
|||
}
|
||||
|
||||
@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");
|
||||
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.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.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.RED + this.multimeter.getMode().display, 35, 68, 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)
|
||||
{
|
||||
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
|
||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.base.ListUtil;
|
||||
import resonantinduction.tesla.TileTesla;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.network.IPacketReceiver;
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ItemMultimeter extends ItemMultipartBase
|
|||
{
|
||||
pos.offset(side ^ 1, -1);
|
||||
}
|
||||
|
||||
|
||||
PartMultimeter part = (PartMultimeter) MultiPartRegistry.createPart("resonant_induction_multimeter", false);
|
||||
|
||||
if (part != null)
|
||||
|
|
|
@ -254,7 +254,7 @@ public class PartMultimeter extends JCuboidPart implements TFacePart, JNormalOcc
|
|||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
super.save(nbt);
|
||||
nbt.setByte("side", (byte) this.side);
|
||||
nbt.setByte("side", this.side);
|
||||
nbt.setByte("detectMode", (byte) detectMode.ordinal());
|
||||
nbt.setLong("energyLimit", energyLimit);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class BlockRenderingHandler implements ISimpleBlockRenderingHandler
|
|||
RenderBattery.render();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,12 +6,10 @@ package resonantinduction.tesla;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
|
|
@ -141,6 +141,7 @@ public class ModelTransformer extends ModelBase
|
|||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
|
|
|
@ -9,11 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.ResonantInduction;
|
||||
import resonantinduction.multimeter.PartMultimeter.DetectMode;
|
||||
import universalelectricity.api.electricity.IElectricalNetwork;
|
||||
import universalelectricity.api.electricity.IVoltageInput;
|
||||
import universalelectricity.api.electricity.IVoltageOutput;
|
||||
|
@ -22,8 +18,6 @@ import universalelectricity.api.energy.IEnergyInterface;
|
|||
import universalelectricity.api.vector.VectorHelper;
|
||||
import codechicken.lib.data.MCDataInput;
|
||||
import codechicken.lib.data.MCDataOutput;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.TextureUtils;
|
||||
import codechicken.lib.vec.Cuboid6;
|
||||
import codechicken.lib.vec.Rotation;
|
||||
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 static Cuboid6[][] oBoxes = new Cuboid6[6][2];
|
||||
public static Cuboid6[][] oBoxes = new Cuboid6[6][2];
|
||||
|
||||
static
|
||||
{
|
||||
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);
|
||||
for (int s = 1; s < 6; s++)
|
||||
{
|
||||
Transformation t = Rotation.sideRotations[s].at(Vector3.center);
|
||||
oBoxes[s][0] = oBoxes[0][0].copy().apply(t);
|
||||
oBoxes[s][1] = oBoxes[0][1].copy().apply(t);
|
||||
}
|
||||
}
|
||||
/** Side of the block this is placed on */
|
||||
public int placementSide;
|
||||
/** Direction this block faces */
|
||||
public int face = 0;
|
||||
/** Step the voltage up */
|
||||
private boolean stepUp;
|
||||
/** Amount to mulitply the step by (up x2. down /2) */
|
||||
public int multiplier = 2;
|
||||
static
|
||||
{
|
||||
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);
|
||||
for (int s = 1; s < 6; s++)
|
||||
{
|
||||
Transformation t = Rotation.sideRotations[s].at(Vector3.center);
|
||||
oBoxes[s][0] = oBoxes[0][0].copy().apply(t);
|
||||
oBoxes[s][1] = oBoxes[0][1].copy().apply(t);
|
||||
}
|
||||
}
|
||||
/** Side of the block this is placed on */
|
||||
public int placementSide;
|
||||
/** Direction this block faces */
|
||||
public int face = 0;
|
||||
/** Step the voltage up */
|
||||
private boolean stepUp;
|
||||
/** Amount to mulitply the step by (up x2. down /2) */
|
||||
public int multiplier = 2;
|
||||
|
||||
public void preparePlacement(int side, int itemDamage)
|
||||
{
|
||||
this.placementSide = (byte) (side ^ 1);
|
||||
}
|
||||
public void preparePlacement(int side, int itemDamage)
|
||||
{
|
||||
this.placementSide = (byte) (side ^ 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readDesc(MCDataInput packet)
|
||||
{
|
||||
this.placementSide = packet.readByte();
|
||||
this.face = packet.readByte();
|
||||
}
|
||||
@Override
|
||||
public void readDesc(MCDataInput packet)
|
||||
{
|
||||
this.placementSide = packet.readByte();
|
||||
this.face = packet.readByte();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeDesc(MCDataOutput packet)
|
||||
{
|
||||
packet.writeByte(this.placementSide);
|
||||
packet.writeByte(this.face);
|
||||
}
|
||||
@Override
|
||||
public void writeDesc(MCDataOutput packet)
|
||||
{
|
||||
packet.writeByte(this.placementSide);
|
||||
packet.writeByte(this.face);
|
||||
}
|
||||
|
||||
public boolean stepUp()
|
||||
{
|
||||
return this.stepUp;
|
||||
}
|
||||
public boolean stepUp()
|
||||
{
|
||||
return this.stepUp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotMask()
|
||||
{
|
||||
return 1 << this.placementSide;
|
||||
}
|
||||
@Override
|
||||
public int getSlotMask()
|
||||
{
|
||||
return 1 << this.placementSide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cuboid6 getBounds()
|
||||
{
|
||||
return FaceMicroClass.aBounds()[0x10 | this.placementSide];
|
||||
}
|
||||
@Override
|
||||
public Cuboid6 getBounds()
|
||||
{
|
||||
return FaceMicroClass.aBounds()[0x10 | this.placementSide];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int redstoneConductionMap()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int redstoneConductionMap()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean solid(int arg0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean solid(int arg0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Cuboid6> getOcclusionBoxes()
|
||||
{
|
||||
return Arrays.asList(oBoxes[this.placementSide]);
|
||||
}
|
||||
@Override
|
||||
public Iterable<Cuboid6> getOcclusionBoxes()
|
||||
{
|
||||
return Arrays.asList(oBoxes[this.placementSide]);
|
||||
}
|
||||
|
||||
protected ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(ResonantInduction.itemTransformer);
|
||||
}
|
||||
protected ItemStack getItem()
|
||||
{
|
||||
return new ItemStack(ResonantInduction.itemTransformer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ItemStack> getDrops()
|
||||
{
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add(getItem());
|
||||
return drops;
|
||||
}
|
||||
@Override
|
||||
public Iterable<ItemStack> getDrops()
|
||||
{
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add(getItem());
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack pickItem(MovingObjectPosition hit)
|
||||
{
|
||||
return getItem();
|
||||
}
|
||||
@Override
|
||||
public ItemStack pickItem(MovingObjectPosition hit)
|
||||
{
|
||||
return getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderDynamic(Vector3 pos, float frame, int pass)
|
||||
{
|
||||
if (pass == 0)
|
||||
{
|
||||
RenderTransformer.render(this, pos.x, pos.y, pos.z);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderDynamic(Vector3 pos, float frame, int pass)
|
||||
{
|
||||
if (pass == 0)
|
||||
{
|
||||
RenderTransformer.render(this, pos.x, pos.y, pos.z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
this.placementSide = nbt.getByte("side");
|
||||
this.stepUp = nbt.getBoolean("stepUp");
|
||||
}
|
||||
@Override
|
||||
public void load(NBTTagCompound nbt)
|
||||
{
|
||||
super.load(nbt);
|
||||
this.placementSide = nbt.getByte("side");
|
||||
this.stepUp = nbt.getBoolean("stepUp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
super.save(nbt);
|
||||
nbt.setByte("side", (byte) this.placementSide);
|
||||
nbt.setBoolean("stepUp", this.stepUp);
|
||||
}
|
||||
@Override
|
||||
public void save(NBTTagCompound nbt)
|
||||
{
|
||||
super.save(nbt);
|
||||
nbt.setByte("side", (byte) this.placementSide);
|
||||
nbt.setBoolean("stepUp", this.stepUp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "resonant_induction_transformer";
|
||||
}
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "resonant_induction_transformer";
|
||||
}
|
||||
|
||||
protected ForgeDirection getFacing()
|
||||
{
|
||||
return ForgeDirection.NORTH;
|
||||
}
|
||||
protected ForgeDirection getFacing()
|
||||
{
|
||||
return ForgeDirection.NORTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
return direction == getFacing() || direction == getFacing().getOpposite();
|
||||
}
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
return direction == getFacing() || direction == getFacing().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
|
||||
{
|
||||
if (from == this.getFacing().getOpposite())
|
||||
{
|
||||
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 IVoltageInput)
|
||||
{
|
||||
long voltage = this.getVoltageOutput(from.getOpposite());
|
||||
if (voltage != ((IVoltageInput) entity).getVoltageInput(from))
|
||||
{
|
||||
((IVoltageInput) entity).onWrongVoltage(from, voltage);
|
||||
}
|
||||
}
|
||||
return ((IEnergyInterface) entity).onReceiveEnergy(from, receive, doReceive);
|
||||
}
|
||||
@Override
|
||||
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
|
||||
{
|
||||
if (from == this.getFacing().getOpposite())
|
||||
{
|
||||
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 IVoltageInput)
|
||||
{
|
||||
long voltage = this.getVoltageOutput(from.getOpposite());
|
||||
if (voltage != ((IVoltageInput) entity).getVoltageInput(from))
|
||||
{
|
||||
((IVoltageInput) entity).onWrongVoltage(from, voltage);
|
||||
}
|
||||
}
|
||||
return ((IEnergyInterface) entity).onReceiveEnergy(from, receive, doReceive);
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
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());
|
||||
if (entity instanceof IConductor && ((IConductor) entity).getNetwork() instanceof IElectricalNetwork)
|
||||
{
|
||||
long voltage = ((IElectricalNetwork) ((IConductor) entity).getNetwork()).getVoltage();
|
||||
if (this.stepUp())
|
||||
{
|
||||
return voltage * this.multiplier;
|
||||
}
|
||||
else if (voltage > 0)
|
||||
{
|
||||
return voltage / this.multiplier;
|
||||
}
|
||||
}
|
||||
else if (entity instanceof IVoltageOutput)
|
||||
{
|
||||
return ((IVoltageOutput) entity).getVoltageOutput(side);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
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());
|
||||
if (entity instanceof IConductor && ((IConductor) entity).getNetwork() instanceof IElectricalNetwork)
|
||||
{
|
||||
long voltage = ((IElectricalNetwork) ((IConductor) entity).getNetwork()).getVoltage();
|
||||
if (this.stepUp())
|
||||
{
|
||||
return voltage * this.multiplier;
|
||||
}
|
||||
else if (voltage > 0)
|
||||
{
|
||||
return voltage / this.multiplier;
|
||||
}
|
||||
}
|
||||
else if (entity instanceof IVoltageOutput)
|
||||
{
|
||||
return ((IVoltageOutput) entity).getVoltageOutput(side);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -1,12 +1,9 @@
|
|||
package resonantinduction.transformer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -59,7 +56,7 @@ public class RenderTransformer
|
|||
break;
|
||||
case 4:
|
||||
GL11.glRotatef(90, 0, 0, 1);
|
||||
GL11.glTranslatef(1, -1,0);
|
||||
GL11.glTranslatef(1, -1, 0);
|
||||
break;
|
||||
case 5:
|
||||
GL11.glRotatef(-90, 0, 0, 1);
|
||||
|
|
|
@ -35,112 +35,113 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
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)
|
||||
{
|
||||
super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "wire", id).getInt(id));
|
||||
this.setUnlocalizedName(ResonantInduction.PREFIX + "wire");
|
||||
this.setCreativeTab(TabRI.INSTANCE);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
public ItemWire(int id)
|
||||
{
|
||||
super(ResonantInduction.CONFIGURATION.get(Configuration.CATEGORY_ITEM, "wire", id).getInt(id));
|
||||
this.setUnlocalizedName(ResonantInduction.PREFIX + "wire");
|
||||
this.setCreativeTab(TabRI.INSTANCE);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit)
|
||||
{
|
||||
BlockCoord onPos = pos.copy().offset(side ^ 1);
|
||||
@Override
|
||||
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit)
|
||||
{
|
||||
BlockCoord onPos = pos.copy().offset(side ^ 1);
|
||||
|
||||
if (ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
PartWire wire = (PartWire) MultiPartRegistry.createPart("resonant_induction_wire", false);
|
||||
if (ControlKeyModifer.isControlDown(player))
|
||||
{
|
||||
PartWire wire = (PartWire) MultiPartRegistry.createPart("resonant_induction_wire", false);
|
||||
|
||||
if (wire != null)
|
||||
{
|
||||
wire.preparePlacement(itemStack.getItemDamage());
|
||||
}
|
||||
if (wire != null)
|
||||
{
|
||||
wire.preparePlacement(itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
return wire;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Utility.canPlaceWireOnSide(world, onPos.x, onPos.y, onPos.z, ForgeDirection.getOrientation(side), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return wire;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Utility.canPlaceWireOnSide(world, onPos.x, onPos.y, onPos.z, ForgeDirection.getOrientation(side), false))
|
||||
{
|
||||
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)
|
||||
{
|
||||
wire.preparePlacement(side, itemStack.getItemDamage());
|
||||
}
|
||||
if (wire != null)
|
||||
{
|
||||
wire.preparePlacement(side, itemStack.getItemDamage());
|
||||
}
|
||||
|
||||
return wire;
|
||||
}
|
||||
}
|
||||
return wire;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
@Override
|
||||
public int getMetadata(int damage)
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
return super.getUnlocalizedName(itemStack) + "." + EnumWireMaterial.values()[itemStack.getItemDamage()].getName().toLowerCase();
|
||||
}
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemStack)
|
||||
{
|
||||
return super.getUnlocalizedName(itemStack) + "." + EnumWireMaterial.values()[itemStack.getItemDamage()].getName().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more information");
|
||||
}
|
||||
else
|
||||
{
|
||||
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 + "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));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
list.add("Hold " + EnumColor.AQUA + "shift" + EnumColor.GREY + " for more information");
|
||||
}
|
||||
else
|
||||
{
|
||||
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 + "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));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister register)
|
||||
{
|
||||
for (EnumWireMaterial material : EnumWireMaterial.values())
|
||||
{
|
||||
icons[material.ordinal()] = register.registerIcon(ResonantInduction.PREFIX + "wire." + EnumWireMaterial.values()[material.ordinal()].getName().toLowerCase());
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister register)
|
||||
{
|
||||
for (EnumWireMaterial material : EnumWireMaterial.values())
|
||||
{
|
||||
icons[material.ordinal()] = register.registerIcon(ResonantInduction.PREFIX + "wire." + EnumWireMaterial.values()[material.ordinal()].getName().toLowerCase());
|
||||
}
|
||||
|
||||
RenderFlatWire.flatWireTexture = register.registerIcon(ResonantInduction.PREFIX + "models/flatWire");
|
||||
RenderPartWire.wireIcon = register.registerIcon(ResonantInduction.PREFIX + "models/wire");
|
||||
RenderPartWire.insulationIcon = register.registerIcon(ResonantInduction.PREFIX + "models/insulation" + (ResonantInduction.LO_FI_INSULATION ? "tiny" : ""));
|
||||
}
|
||||
RenderFlatWire.flatWireTexture = register.registerIcon(ResonantInduction.PREFIX + "models/flatWire");
|
||||
RenderPartWire.wireIcon = register.registerIcon(ResonantInduction.PREFIX + "models/wire");
|
||||
RenderPartWire.insulationIcon = register.registerIcon(ResonantInduction.PREFIX + "models/insulation" + (ResonantInduction.LO_FI_INSULATION ? "tiny" : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Icon getIconFromDamage(int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo)
|
||||
{
|
||||
for (EnumWireMaterial mat : EnumWireMaterial.values())
|
||||
{
|
||||
listToAddTo.add(new ItemStack(itemID, 1, mat.ordinal()));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void getSubItems(int itemID, CreativeTabs tab, List listToAddTo)
|
||||
{
|
||||
for (EnumWireMaterial mat : EnumWireMaterial.values())
|
||||
{
|
||||
listToAddTo.add(new ItemStack(itemID, 1, mat.ordinal()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,14 +178,14 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
{
|
||||
if (itemStack != null)
|
||||
{
|
||||
int dyeColor = Utility.isDye(itemStack);
|
||||
|
||||
int dyeColor = Utility.isDye(itemStack);
|
||||
|
||||
if (dyeColor != -1 && this.isInsulated())
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
}
|
||||
|
||||
this.setColor(dyeColor);
|
||||
return true;
|
||||
|
@ -206,10 +206,10 @@ public abstract class PartAdvancedWire extends PartConductor
|
|||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,76 +13,76 @@ import codechicken.multipart.MultiPartRegistry;
|
|||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
|
||||
public class PartFlatSwitchWire extends PartFlatWire
|
||||
public class PartFlatSwitchWire extends PartFlatWire
|
||||
{
|
||||
@Override
|
||||
public boolean canConnectTo(Object obj)
|
||||
{
|
||||
if (this.world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
||||
{
|
||||
return super.canConnectTo(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TMultiPart tp : tile().jPartList())
|
||||
{
|
||||
if (tp instanceof IRedstonePart)
|
||||
{
|
||||
IRedstonePart rp = (IRedstonePart)tp;
|
||||
if ((Math.max(rp.strongPowerLevel(this.side ^ 0x1), rp.weakPowerLevel(this.side ^ 0x1)) << 4) > 0)
|
||||
{
|
||||
return super.canConnectTo(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "resonant_induction_flat_switch_wire";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||
{
|
||||
TileMultipart tile = tile();
|
||||
World w = world();
|
||||
|
||||
if (item.getItem().itemID == Block.lever.blockID)
|
||||
{
|
||||
if (!w.isRemote)
|
||||
{
|
||||
PartFlatWire wire = (PartFlatWire) MultiPartRegistry.createPart("resonant_induction_flat_wire", false);
|
||||
wire.copyFrom(this);
|
||||
|
||||
if (tile.canReplacePart(this, wire))
|
||||
{
|
||||
tile.remPart(this);
|
||||
TileMultipart.addPart(w, new BlockCoord(tile), wire);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
tile.dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.activate(player, part, item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drop()
|
||||
{
|
||||
tile().dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
|
||||
super.drop();
|
||||
}
|
||||
@Override
|
||||
public boolean canConnectTo(Object obj)
|
||||
{
|
||||
if (this.world().isBlockIndirectlyGettingPowered(x(), y(), z()))
|
||||
{
|
||||
return super.canConnectTo(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (TMultiPart tp : tile().jPartList())
|
||||
{
|
||||
if (tp instanceof IRedstonePart)
|
||||
{
|
||||
IRedstonePart rp = (IRedstonePart) tp;
|
||||
if ((Math.max(rp.strongPowerLevel(this.side ^ 0x1), rp.weakPowerLevel(this.side ^ 0x1)) << 4) > 0)
|
||||
{
|
||||
return super.canConnectTo(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "resonant_induction_flat_switch_wire";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||
{
|
||||
TileMultipart tile = tile();
|
||||
World w = world();
|
||||
|
||||
if (item.getItem().itemID == Block.lever.blockID)
|
||||
{
|
||||
if (!w.isRemote)
|
||||
{
|
||||
PartFlatWire wire = (PartFlatWire) MultiPartRegistry.createPart("resonant_induction_flat_wire", false);
|
||||
wire.copyFrom(this);
|
||||
|
||||
if (tile.canReplacePart(this, wire))
|
||||
{
|
||||
tile.remPart(this);
|
||||
TileMultipart.addPart(w, new BlockCoord(tile), wire);
|
||||
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
tile.dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.activate(player, part, item);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drop()
|
||||
{
|
||||
tile().dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
|
||||
super.drop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -278,6 +278,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
super.onNeighborChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
|
||||
{
|
||||
if (!world().isRemote)
|
||||
|
@ -591,7 +592,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
{
|
||||
int absDir = Rotation.rotateSide(side, r);
|
||||
TMultiPart facePart = tile().partMap(absDir);
|
||||
if (facePart != null && (!(facePart instanceof PartFlatWire) || !canConnectTo((PartFlatWire) facePart)))
|
||||
if (facePart != null && (!(facePart instanceof PartFlatWire) || !canConnectTo(facePart)))
|
||||
return false;
|
||||
|
||||
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 true;
|
||||
}
|
||||
|
||||
|
@ -724,7 +725,7 @@ public class PartFlatWire extends PartAdvancedWire implements TFacePart, JNormal
|
|||
if (!(part instanceof PartFlatWire))
|
||||
return false;
|
||||
|
||||
PartFlatWire wire = (PartFlatWire) part;
|
||||
PartFlatWire wire = part;
|
||||
if (wire.getThickness() == getThickness())
|
||||
return side < wire.side;
|
||||
|
||||
|
|
|
@ -115,11 +115,11 @@ public class PartWire extends PartAdvancedWire implements TSlottedPart, JNormalO
|
|||
subParts.add(currentSides[6]);
|
||||
return subParts;
|
||||
}
|
||||
|
||||
public void preparePlacement(int meta)
|
||||
{
|
||||
this.setMaterial(meta);
|
||||
}
|
||||
|
||||
public void preparePlacement(int meta)
|
||||
{
|
||||
this.setMaterial(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Cuboid6> getCollisionBoxes()
|
||||
|
@ -277,8 +277,9 @@ public class PartWire extends PartAdvancedWire implements TSlottedPart, JNormalO
|
|||
*/
|
||||
public boolean isConnectionPrevented(TileEntity tile, ForgeDirection side)
|
||||
{
|
||||
return (tile instanceof IConductor ? this.canConnectTo((IConductor) tile) : false) || (isBlockedOnSide(side));
|
||||
// || tile instanceof IBlockableConnection && ((IBlockableConnection) tile).isBlockedOnSide(side.getOpposite()))*/;
|
||||
return (tile instanceof IConductor ? this.canConnectTo(tile) : false) || (isBlockedOnSide(side));
|
||||
// || tile instanceof IBlockableConnection && ((IBlockableConnection)
|
||||
// tile).isBlockedOnSide(side.getOpposite()))*/;
|
||||
}
|
||||
|
||||
public byte getPossibleWireConnections()
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import universalelectricity.api.UniversalClass;
|
||||
import universalelectricity.api.energy.IConductor;
|
||||
import universalelectricity.api.energy.IEnergyNetwork;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
|
|
Loading…
Reference in a new issue