Minor clean up

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

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

View file

@ -16,7 +16,7 @@
<get src="http://files.minecraftforge.net/CodeChickenLib/CodeChickenLib-dev-1.6.4-1.0.0.49.jar"
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">

View file

@ -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)

View file

@ -14,13 +14,7 @@ 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()
{

View file

@ -38,25 +38,7 @@ public class Utility
public static int isDye(ItemStack is)
{
String[] dyes =
{
"dyeBlack",
"dyeRed",
"dyeGreen",
"dyeBrown",
"dyeBlue",
"dyePurple",
"dyeCyan",
"dyeLightGray",
"dyeGray",
"dyePink",
"dyeLime",
"dyeYellow",
"dyeLightBlue",
"dyeMagenta",
"dyeOrange",
"dyeWhite"
};
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++)
{

View file

@ -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
{

View file

@ -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);

View file

@ -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;

View file

@ -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,66 +28,62 @@ public class RenderBattery extends TileEntitySpecialRenderer
public static final ModelBattery MODEL = new ModelBattery();
/*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));
}*/
/*
* 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 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

View file

@ -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.

View file

@ -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);
}
}
}

View file

@ -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.

View file

@ -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

View file

@ -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;

View file

@ -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);
}

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -108,6 +108,7 @@ public class ItemWire extends JItemMultiPart
}
}
@Override
@SideOnly(Side.CLIENT)
public int getSpriteNumber()
{

View file

@ -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)
@ -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;

View file

@ -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()

View file

@ -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;