Fixed EMLevitator

This commit is contained in:
Calclavia 2014-01-11 11:04:30 +08:00
parent 0f2ab328f9
commit eab51b61cc
18 changed files with 62 additions and 58 deletions

View file

@ -59,6 +59,11 @@ artifacts {
archives apiZip
}
compileJava {
sourceCompatability = "1.7"
targetCompatability = "1.7"
}
jar {
dependsOn copyBuildXml
classifier = ''

View file

@ -8,6 +8,8 @@ import resonantinduction.electrical.battery.RenderBattery;
import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.generator.solar.RenderSolarPanel;
import resonantinduction.electrical.generator.solar.TileSolarPanel;
import resonantinduction.electrical.levitator.RenderLevitator;
import resonantinduction.electrical.levitator.TileEMLevitator;
import resonantinduction.electrical.multimeter.GuiMultimeter;
import resonantinduction.electrical.multimeter.PartMultimeter;
import resonantinduction.electrical.render.ElectricalBlockRenderingHandler;
@ -15,8 +17,6 @@ import resonantinduction.electrical.render.FXElectricBolt;
import resonantinduction.electrical.tesla.RenderTesla;
import resonantinduction.electrical.tesla.TileTesla;
import resonantinduction.old.core.render.RenderRIItem;
import resonantinduction.old.transport.levitator.RenderLevitator;
import resonantinduction.old.transport.levitator.TileEMLevitator;
import universalelectricity.api.vector.Vector3;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart;

View file

@ -1,5 +1,7 @@
package resonantinduction.electrical;
import java.awt.Color;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -7,7 +9,6 @@ import resonantinduction.core.prefab.ProxyBase;
import resonantinduction.electrical.multimeter.ContainerMultimeter;
import resonantinduction.electrical.multimeter.PartMultimeter;
import universalelectricity.api.vector.Vector3;
import codechicken.lib.colour.ColourRGBA;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart;
@ -40,14 +41,14 @@ public class CommonProxy extends ProxyBase
this.renderElectricShock(world, start, target, r, g, b, true);
}
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color)
public void renderElectricShock(World world, Vector3 start, Vector3 target, Color color)
{
this.renderElectricShock(world, start, target, color.r / 255f, color.g / 255f, color.b / 255f);
this.renderElectricShock(world, start, target, color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f);
}
public void renderElectricShock(World world, Vector3 start, Vector3 target, ColourRGBA color, boolean split)
public void renderElectricShock(World world, Vector3 start, Vector3 target, Color color, boolean split)
{
this.renderElectricShock(world, start, target, color.r / 255f, color.g / 255f, color.b / 255f, split);
this.renderElectricShock(world, start, target, color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, split);
}
public void renderElectricShock(World world, Vector3 start, Vector3 target)

View file

@ -21,6 +21,9 @@ import resonantinduction.electrical.battery.ItemBlockBattery;
import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.generator.solar.BlockSolarPanel;
import resonantinduction.electrical.generator.solar.TileSolarPanel;
import resonantinduction.electrical.levitator.BlockLevitator;
import resonantinduction.electrical.levitator.ItemBlockContractor;
import resonantinduction.electrical.levitator.TileEMLevitator;
import resonantinduction.electrical.multimeter.ItemMultimeter;
import resonantinduction.electrical.tesla.BlockTesla;
import resonantinduction.electrical.tesla.TileTesla;
@ -33,9 +36,6 @@ import resonantinduction.mechanical.grinder.TilePurifier;
import resonantinduction.old.mechanics.furnace.BlockAdvancedFurnace;
import resonantinduction.old.mechanics.furnace.TileAdvancedFurnace;
import resonantinduction.old.mechanics.purifier.BlockPurifier;
import resonantinduction.old.transport.levitator.BlockLevitator;
import resonantinduction.old.transport.levitator.ItemBlockContractor;
import resonantinduction.old.transport.levitator.TileEMLevitator;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.recipe.UniversalRecipe;
import cpw.mods.fml.common.Loader;

View file

@ -74,6 +74,7 @@ public class TileBattery extends TileElectrical implements IConnector<BatteryStr
}
this.energy.setMaxTransfer(DEFAULT_WATTAGE * this.getNetwork().get().size());
this.getNetwork().redistribute();
}
}
@ -95,10 +96,7 @@ public class TileBattery extends TileElectrical implements IConnector<BatteryStr
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
{
long returnValue = super.onReceiveEnergy(from, receive, doReceive);
if (doReceive)
this.getNetwork().redistribute();
return returnValue;
}
@ -106,10 +104,7 @@ public class TileBattery extends TileElectrical implements IConnector<BatteryStr
public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract)
{
long returnValue = super.onExtractEnergy(from, extract, doExtract);
if (doExtract)
this.getNetwork().redistribute();
return returnValue;
}

View file

@ -1,4 +1,4 @@
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import resonantinduction.core.prefab.block.BlockRotatableBase;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;

View file

@ -1,7 +1,7 @@
/**
*
*/
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import java.util.HashSet;
import java.util.Set;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;

View file

@ -1,7 +1,7 @@
/**
*
*/
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import universalelectricity.api.vector.Vector3;

View file

@ -1,4 +1,4 @@
package resonantinduction.old.transport.levitator;
package resonantinduction.electrical.levitator;
import java.util.ArrayList;
import java.util.HashSet;
@ -24,12 +24,14 @@ import net.minecraftforge.fluids.IFluidBlock;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.Settings;
import resonantinduction.core.handler.ILinkable;
import resonantinduction.electrical.Electrical;
import resonantinduction.electrical.tesla.TileTesla;
import universalelectricity.api.vector.Vector3;
import universalelectricity.api.vector.VectorWorld;
import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender;
import calclavia.lib.prefab.tile.TileAdvanced;
import calclavia.lib.render.EnumColor;
import calclavia.lib.utility.InventoryUtility;
import com.google.common.io.ByteArrayDataInput;
@ -152,7 +154,7 @@ public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IP
{
if (renderBeam)
{
ResonantInduction.proxy.renderElectricShock(worldObj, new Vector3(this).translate(0.5), new Vector3(this).translate(new Vector3(getDirection())).translate(0.5), ResonantInduction.DYE_COLORS[dyeID], false);
Electrical.proxy.renderElectricShock(worldObj, new Vector3(this).translate(0.5), new Vector3(this).translate(new Vector3(getDirection())).translate(0.5), EnumColor.DYES[dyeID].toColor(), false);
}
// Push entity along path.
@ -174,7 +176,7 @@ public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IP
if (renderBeam)
{
ResonantInduction.proxy.renderElectricShock(worldObj, prevResult.clone().translate(0.5), result.clone().translate(0.5), ResonantInduction.DYE_COLORS[dyeID], false);
Electrical.proxy.renderElectricShock(worldObj, prevResult.clone().translate(0.5), result.clone().translate(0.5), EnumColor.DYES[dyeID].toColor(), false);
}
AxisAlignedBB bounds = AxisAlignedBB.getAABBPool().getAABB(result.x, result.y, result.z, result.x + 1, result.y + 1, result.z + 1);
@ -203,7 +205,7 @@ public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IP
{
if (renderBeam)
{
ResonantInduction.proxy.renderElectricShock(worldObj, new Vector3(this).translate(0.5), new Vector3(this).translate(new Vector3(getDirection())).translate(0.5), ResonantInduction.DYE_COLORS[dyeID], false);
Electrical.proxy.renderElectricShock(worldObj, new Vector3(this).translate(0.5), new Vector3(this).translate(new Vector3(getDirection())).translate(0.5), EnumColor.DYES[dyeID].toColor(), false);
}
pathfinder = null;
@ -217,7 +219,7 @@ public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IP
{
if (renderBeam)
{
ResonantInduction.proxy.renderElectricShock(worldObj, new Vector3(this).translate(0.5), new Vector3(entityItem), ResonantInduction.DYE_COLORS[dyeID], false);
Electrical.proxy.renderElectricShock(worldObj, new Vector3(this).translate(0.5), new Vector3(entityItem), EnumColor.DYES[dyeID].toColor(), false);
}
moveEntity(entityItem, getDirection(), new Vector3(this));
@ -577,7 +579,7 @@ public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IP
Vector3 start = new Vector3(this).modifyPositionFromSide(getDirection());
Vector3 target = new Vector3(linked).modifyPositionFromSide(linked.getDirection());
if (start.distance(target) < ResonantInduction.MAX_CONTRACTOR_DISTANCE)
if (start.distance(target) < Settings.MAX_CONTRACTOR_DISTANCE)
{
if (TileEMLevitator.canBePath(worldObj, start) && TileEMLevitator.canBePath(worldObj, target))
{

View file

@ -19,10 +19,10 @@ import resonantinduction.electrical.battery.BlockBattery;
import resonantinduction.electrical.battery.RenderBattery;
import resonantinduction.electrical.generator.solar.BlockSolarPanel;
import resonantinduction.electrical.generator.solar.RenderSolarPanel;
import resonantinduction.electrical.levitator.BlockLevitator;
import resonantinduction.electrical.levitator.RenderLevitator;
import resonantinduction.electrical.tesla.BlockTesla;
import resonantinduction.electrical.tesla.RenderTesla;
import resonantinduction.old.transport.levitator.BlockLevitator;
import resonantinduction.old.transport.levitator.RenderLevitator;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;

View file

@ -222,7 +222,7 @@ public class TileTesla extends TileElectrical implements ITesla, IPacketSender,
double distance = topTeslaVector.distance(targetVector);
// TODO: Fix color.
Electrical.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), new ColourRGBA(EnumColor.DYES[this.dyeID].toColor().getRGB()));
Electrical.proxy.renderElectricShock(this.worldObj, new Vector3(topTesla).translate(new Vector3(0.5)), targetVector.translate(new Vector3(0.5)), EnumColor.DYES[this.dyeID].toColor());
this.transfer(tesla, Math.min(transferEnergy, TRANSFER_CAP));

View file

@ -18,7 +18,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.prefab.block.BlockMachine;
import resonantinduction.mechanical.belt.TileEntityConveyorBelt.SlantType;
import resonantinduction.mechanical.belt.TileConveyorBelt.SlantType;
import resonantinduction.old.client.render.BlockRenderingHandler;
import resonantinduction.old.client.render.RenderConveyorBelt;
@ -42,9 +42,9 @@ public class BlockConveyorBelt extends BlockMachine implements IExtraBlockInfo
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
{
if (world.getBlockTileEntity(x, y, z) instanceof TileEntityConveyorBelt)
if (world.getBlockTileEntity(x, y, z) instanceof TileConveyorBelt)
{
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z);
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
{
@ -66,9 +66,9 @@ public class BlockConveyorBelt extends BlockMachine implements IExtraBlockInfo
{
TileEntity t = world.getBlockTileEntity(x, y, z);
if (t != null && t instanceof TileEntityConveyorBelt)
if (t != null && t instanceof TileConveyorBelt)
{
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
TileConveyorBelt tileEntity = (TileConveyorBelt) t;
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
{
@ -89,9 +89,9 @@ public class BlockConveyorBelt extends BlockMachine implements IExtraBlockInfo
TileEntity t = world.getBlockTileEntity(x, y, z);
if (t != null && t instanceof TileEntityConveyorBelt)
if (t != null && t instanceof TileConveyorBelt)
{
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) t;
TileConveyorBelt tileEntity = (TileConveyorBelt) t;
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
{
@ -229,7 +229,7 @@ public class BlockConveyorBelt extends BlockMachine implements IExtraBlockInfo
@Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z);
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
int slantOrdinal = tileEntity.getSlant().ordinal() + 1;
@ -247,7 +247,7 @@ public class BlockConveyorBelt extends BlockMachine implements IExtraBlockInfo
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
TileEntityConveyorBelt tileEntity = (TileEntityConveyorBelt) world.getBlockTileEntity(x, y, z);
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
if (tileEntity.IgnoreList.contains(entity))
{
return;
@ -334,20 +334,20 @@ public class BlockConveyorBelt extends BlockMachine implements IExtraBlockInfo
@SideOnly(Side.CLIENT)
public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list)
{
list.add(new Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>(TileEntityConveyorBelt.class, new RenderConveyorBelt()));
list.add(new Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>(TileConveyorBelt.class, new RenderConveyorBelt()));
}
@Override
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{
list.add(new Pair<String, Class<? extends TileEntity>>("ALConveyorBelt", TileEntityConveyorBelt.class));
list.add(new Pair<String, Class<? extends TileEntity>>("ALConveyorBelt", TileConveyorBelt.class));
}
/** Returns the TileEntity used by this block. */
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEntityConveyorBelt();
return new TileConveyorBelt();
}
@SideOnly(Side.CLIENT)

View file

@ -10,6 +10,7 @@ import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.ResonantInduction;
import resonantinduction.old.api.IBelt;
import resonantinduction.old.core.recipe.RecipeLoader;
import resonantinduction.old.transport.TileEntityAssembly;
@ -26,7 +27,7 @@ import cpw.mods.fml.common.network.Player;
*
* @author DarkGuardsman
*/
public class TileEntityConveyorBelt extends TileEntityAssembly implements IBelt, IRotatable
public class TileConveyorBelt extends TileEntityAssembly implements IBelt, IRotatable
{
public enum SlantType
@ -50,7 +51,7 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IBelt,
/** Entities that are ignored allowing for other tiles to interact with them */
public List<Entity> IgnoreList = new ArrayList<Entity>();
public TileEntityConveyorBelt()
public TileConveyorBelt()
{
super(1);
}
@ -110,7 +111,7 @@ public class TileEntityConveyorBelt extends TileEntityAssembly implements IBelt,
{
if (this.slantType != SlantType.NONE)
{
return PacketHandler.instance().getTilePacket(this.getChannel(), slantPacketID, this, this.isFunctioning(), this.slantType.ordinal());
return ResonantInduction.PACKET_TILE.getPacket(this, slantPacketID, this.isFunctioning(), this.slantType.ordinal());
}
return super.getDescriptionPacket();
}

View file

@ -7,8 +7,8 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
import resonantinduction.mechanical.belt.TileEntityConveyorBelt;
import resonantinduction.mechanical.belt.TileEntityConveyorBelt.SlantType;
import resonantinduction.mechanical.belt.TileConveyorBelt;
import resonantinduction.mechanical.belt.TileConveyorBelt.SlantType;
import resonantinduction.old.client.model.ModelAngledBelt;
import resonantinduction.old.client.model.ModelConveyorBelt;
import cpw.mods.fml.relauncher.Side;
@ -20,7 +20,7 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
public static final ModelConveyorBelt MODEL = new ModelConveyorBelt();
public static final ModelAngledBelt MODEL2 = new ModelAngledBelt();
private void renderAModelAt(TileEntityConveyorBelt tileEntity, double x, double y, double z, float f)
private void renderAModelAt(TileConveyorBelt tileEntity, double x, double y, double z, float f)
{
SlantType slantType = tileEntity.getSlant();
int face = tileEntity.getDirection().ordinal();
@ -60,9 +60,9 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
TileEntity test = tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord + tileEntity.getDirection().offsetX, tileEntity.yCoord, tileEntity.zCoord + tileEntity.getDirection().offsetZ);
if (test != null)
{
if (test instanceof TileEntityConveyorBelt)
if (test instanceof TileConveyorBelt)
{
if (((TileEntityConveyorBelt) test).getSlant() == SlantType.TOP)
if (((TileConveyorBelt) test).getSlant() == SlantType.TOP)
{
GL11.glRotatef(10f, 1f, 0f, 0f);
slantAdjust = true;
@ -80,9 +80,9 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
TileEntity test = tileEntity.worldObj.getBlockTileEntity(tileEntity.xCoord - tileEntity.getDirection().offsetX, tileEntity.yCoord, tileEntity.zCoord - tileEntity.getDirection().offsetZ);
if (test != null)
{
if (test instanceof TileEntityConveyorBelt)
if (test instanceof TileConveyorBelt)
{
if (((TileEntityConveyorBelt) test).getSlant() == SlantType.TOP)
if (((TileConveyorBelt) test).getSlant() == SlantType.TOP)
{
GL11.glRotatef(-10f, 1f, 0f, 0f);
GL11.glTranslatef(0f, 0.25f, 0f);
@ -133,7 +133,7 @@ public class RenderConveyorBelt extends TileEntitySpecialRenderer
@Override
public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)
{
this.renderAModelAt((TileEntityConveyorBelt) tileEntity, var2, var4, var6, var8);
this.renderAModelAt((TileConveyorBelt) tileEntity, var2, var4, var6, var8);
}
}