Stripped out ItemCharger, ItemRail, MiningLaserGun, and ItemLev to make modpacks more stable

This commit is contained in:
Robert S 2014-09-07 19:14:42 -04:00
parent 518f0474c1
commit b38bb654d7
20 changed files with 11 additions and 2148 deletions

View file

@ -3,13 +3,9 @@ package resonantinduction.electrical;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import resonant.lib.render.item.GlobalItemRenderer;
import resonantinduction.electrical.battery.RenderBattery;
import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.charger.RenderCharger;
import resonantinduction.electrical.laser.gun.RenderMiningLaserGun;
import resonantinduction.electrical.levitator.RenderLevitator;
import resonantinduction.electrical.multimeter.GuiMultimeter;
import resonantinduction.electrical.multimeter.PartMultimeter;
import resonantinduction.electrical.multimeter.RenderMultimeter;
@ -36,10 +32,10 @@ public class ClientProxy extends CommonProxy
GlobalItemRenderer.register(Electrical.blockBattery.blockID, RenderBattery.INSTANCE);
GlobalItemRenderer.register(Electrical.itemMultimeter.itemID, RenderMultimeter.INSTANCE);
GlobalItemRenderer.register(Electrical.itemTransformer.itemID, RenderTransformer.INSTANCE);
GlobalItemRenderer.register(Electrical.itemCharger.itemID, RenderCharger.INSTANCE);
GlobalItemRenderer.register(Electrical.itemLevitator.itemID, RenderLevitator.INSTANCE);
//GlobalItemRenderer.register(Electrical.itemCharger.itemID, RenderCharger.INSTANCE);
//GlobalItemRenderer.register(Electrical.itemLevitator.itemID, RenderLevitator.INSTANCE);
GlobalItemRenderer.register(Electrical.itemQuantumGlyph.itemID, RenderQuantumGlyph.INSTANCE);
MinecraftForgeClient.registerItemRenderer(Electrical.itemLaserGun.itemID, new RenderMiningLaserGun());
//MinecraftForgeClient.registerItemRenderer(Electrical.itemLaserGun.itemID, new RenderMiningLaserGun());
ClientRegistry.bindTileEntitySpecialRenderer(TileTesla.class, new RenderTesla());
ClientRegistry.bindTileEntitySpecialRenderer(TileBattery.class, new RenderBattery());
}

View file

@ -19,15 +19,11 @@ import resonantinduction.core.resource.ItemResourcePart;
import resonantinduction.electrical.battery.BlockBattery;
import resonantinduction.electrical.battery.ItemBlockBattery;
import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.charger.ItemCharger;
import resonantinduction.electrical.generator.BlockMotor;
import resonantinduction.electrical.generator.TileMotor;
import resonantinduction.electrical.generator.solar.TileSolarPanel;
import resonantinduction.electrical.generator.thermopile.BlockThermopile;
import resonantinduction.electrical.generator.thermopile.TileThermopile;
import resonantinduction.electrical.itemrailing.ItemItemRailing;
import resonantinduction.electrical.laser.gun.ItemMiningLaser;
import resonantinduction.electrical.levitator.ItemLevitator;
import resonantinduction.electrical.multimeter.ItemMultimeter;
import resonantinduction.electrical.tesla.BlockTesla;
import resonantinduction.electrical.tesla.TileTesla;
@ -74,13 +70,8 @@ public class Electrical
public static Item itemWire;
public static Item itemMultimeter;
public static Item itemTransformer;
public static Item itemCharger;
public static Block blockTesla;
public static Block blockBattery;
public static Block blockEncoder;
// Railings
public static Item itemRailing;
// Generators
public static Block blockSolarPanel;
@ -89,17 +80,12 @@ public class Electrical
// Transport
public static Item itemLevitator;
public static Block blockArmbot;
public static Item itemDisk;
public static Item itemInsulation;
// Quantum
public static Block blockQuantumGate;
public static Item itemQuantumGlyph;
// Tools
public static Item itemLaserGun;
public ProxyHandler modproxies;
@EventHandler
@ -113,14 +99,13 @@ public class Electrical
itemWire = contentRegistry.createItem(ItemWire.class);
itemMultimeter = contentRegistry.createItem(ItemMultimeter.class);
itemTransformer = contentRegistry.createItem(ItemTransformer.class);
itemCharger = contentRegistry.createItem(ItemCharger.class);
blockTesla = contentRegistry.createTile(BlockTesla.class, TileTesla.class);
blockBattery = contentRegistry.createBlock(BlockBattery.class, ItemBlockBattery.class, TileBattery.class);
// Transport
itemLevitator = contentRegistry.createItem(ItemLevitator.class);
//itemLevitator = contentRegistry.createItem(ItemLevitator.class);
itemInsulation = contentRegistry.createItem("insulation", ItemResourcePart.class);
itemLaserGun = contentRegistry.createItem("laserDrill", ItemMiningLaser.class);
//itemLaserGun = contentRegistry.createItem("laserDrill", ItemMiningLaser.class);
// Generator
blockSolarPanel = contentRegistry.newBlock(TileSolarPanel.class);
@ -195,22 +180,22 @@ public class Electrical
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));
GameRegistry.addRecipe(new ShapedOreRecipe(itemCharger, "WWW", "ICI", 'W', "wire", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'C', UniversalRecipe.CIRCUIT_T1.get()));
//GameRegistry.addRecipe(new ShapedOreRecipe(itemCharger, "WWW", "ICI", 'W', "wire", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'C', UniversalRecipe.CIRCUIT_T1.get()));
GameRegistry.addRecipe(new ShapedOreRecipe(itemTransformer, "WWW", "WWW", "III", 'W', "wire", 'I', UniversalRecipe.PRIMARY_METAL.get()));
//GameRegistry.addRecipe(new ShapedOreRecipe(itemLevitator, " G ", "SDS", "SWS", 'W', "wire", 'G', Block.glass, 'D', Block.blockDiamond, 'S', UniversalRecipe.PRIMARY_METAL.get()));
/** Quantum Gates */
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 0), " CT", "LBL", "TCT", 'B', Block.blockDiamond, 'L', itemLevitator, 'C', itemCharger, 'T', blockTesla));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 1), "TCT", "LBL", " CT", 'B', Block.blockDiamond, 'L', itemLevitator, 'C', itemCharger, 'T', blockTesla));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 2), "TC ", "LBL", "TCT", 'B', Block.blockDiamond, 'L', itemLevitator, 'C', itemCharger, 'T', blockTesla));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 3), "TCT", "LBL", "TC ", 'B', Block.blockDiamond, 'L', itemLevitator, 'C', itemCharger, 'T', blockTesla));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 0), " CT", "LBL", "TCT", 'B', Block.blockDiamond, 'L', UniversalRecipe.CIRCUIT_T3.get(), 'C', UniversalRecipe.CIRCUIT_T3.get(), 'T', blockTesla));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 1), "TCT", "LBL", " CT", 'B', Block.blockDiamond, 'L', UniversalRecipe.CIRCUIT_T3.get(), 'C', UniversalRecipe.CIRCUIT_T3.get(), 'T', blockTesla));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 2), "TC ", "LBL", "TCT", 'B', Block.blockDiamond, 'L', UniversalRecipe.CIRCUIT_T3.get(), 'C', UniversalRecipe.CIRCUIT_T3.get(), 'T', blockTesla));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemQuantumGlyph, 1, 3), "TCT", "LBL", "TC ", 'B', Block.blockDiamond, 'L', UniversalRecipe.CIRCUIT_T3.get(), 'C', UniversalRecipe.CIRCUIT_T3.get(), 'T', blockTesla));
/** Generators **/
GameRegistry.addRecipe(new ShapedOreRecipe(blockSolarPanel, "CCC", "WWW", "III", 'W', "wire", 'C', Item.coal, 'I', UniversalRecipe.PRIMARY_METAL.get()));
GameRegistry.addRecipe(new ShapedOreRecipe(blockMotor, "SRS", "SMS", "SWS", 'W', "wire", 'R', Item.redstone, 'M', Block.blockIron, 'S', UniversalRecipe.PRIMARY_METAL.get()));
GameRegistry.addRecipe(new ShapedOreRecipe(blockThermopile, "ORO", "OWO", "OOO", 'W', "wire", 'O', Block.obsidian, 'R', Item.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(itemLaserGun, "RDR", "RDR", "ICB", 'R', Item.redstone, 'D', Item.diamond, 'I', Item.ingotGold, 'C', UniversalRecipe.CIRCUIT_T2.get(), 'B', ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 0)));
//GameRegistry.addRecipe(new ShapedOreRecipe(itemLaserGun, "RDR", "RDR", "ICB", 'R', Item.redstone, 'D', Item.diamond, 'I', Item.ingotGold, 'C', UniversalRecipe.CIRCUIT_T2.get(), 'B', ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 0)));
/** Wire Compatiblity **/
if (Loader.isModLoaded("IC2"))

View file

@ -1,8 +1,5 @@
package resonantinduction.electrical;
import resonantinduction.electrical.charger.PartCharger;
import resonantinduction.electrical.itemrailing.PartRailing;
import resonantinduction.electrical.levitator.PartLevitator;
import resonantinduction.electrical.multimeter.PartMultimeter;
import resonantinduction.electrical.transformer.PartTransformer;
import resonantinduction.electrical.wire.flat.PartFlatSwitchWire;
@ -46,14 +43,8 @@ public class MultipartElectrical implements IPartFactory
return new PartMultimeter();
else if (name.equals("resonant_induction_transformer"))
return new PartTransformer();
else if (name.equals("resonant_induction_charger"))
return new PartCharger();
else if (name.equals("resonant_induction_levitator"))
return new PartLevitator();
else if (name.equals("resonant_induction_quantum_glyph"))
return new PartQuantumGlyph();
else if (name.equals("resonant_induction_itemrailing"))
return new PartRailing();
return null;
}

View file

@ -1,43 +0,0 @@
package resonantinduction.electrical.charger;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import resonantinduction.core.prefab.part.IHighlight;
import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import codechicken.microblock.FacePlacementGrid$;
import codechicken.multipart.JItemMultiPart;
import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.TMultiPart;
public class ItemCharger extends JItemMultiPart implements IHighlight
{
public ItemCharger(int id)
{
super(id);
}
@Override
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit)
{
side = FacePlacementGrid$.MODULE$.getHitSlot(hit, side);
PartCharger part = (PartCharger) MultiPartRegistry.createPart("resonant_induction_charger", false);
if (part != null)
{
int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
int facing = l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
part.preparePlacement(side, facing);
}
return part;
}
@Override
public int getHighlightType()
{
return 0;
}
}

View file

@ -1,149 +0,0 @@
package resonantinduction.electrical.charger;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.ForgeDirection;
import resonant.lib.utility.WrenchUtility;
import resonant.lib.utility.inventory.InventoryUtility;
import resonantinduction.core.prefab.part.PartInventoryPanel;
import resonantinduction.electrical.Electrical;
import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.UniversalClass;
import universalelectricity.api.energy.IEnergyInterface;
import codechicken.lib.vec.Vector3;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/** Micro part machine designed to charge all items contained inside of it. Doesn't contain its own
* battery and only acts as an inventory. Items are charged each time doReceive is called by an
* energy supplier.
*
* @author Darkguardsman, converted to Part by Calclavia */
@UniversalClass
public class PartCharger extends PartInventoryPanel implements IEnergyInterface
{
@Override
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack item)
{
if (WrenchUtility.isUsableWrench(player, player.inventory.getCurrentItem(), x(), y(), z()))
{
if (!world().isRemote)
{
WrenchUtility.damageWrench(player, player.inventory.getCurrentItem(), x(), y(), z());
facing = (byte) ((facing + 1) % 4);
sendDescUpdate();
tile().notifyPartChange(this);
}
return true;
}
if (item != null)
{
if (getStackInSlot(0) == null && item != null && CompatibilityModule.isHandler(item.getItem()))
{
setInventorySlotContents(0, item);
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
if (!world().isRemote)
sendDescUpdate();
return true;
}
}
if (getStackInSlot(0) != null)
{
InventoryUtility.dropItemStack(world(), new universalelectricity.api.vector.Vector3(player), getStackInSlot(0), 0);
setInventorySlotContents(0, null);
if (!world().isRemote)
sendDescUpdate();
}
return true;
}
@Override
public boolean canConnect(ForgeDirection direction, Object obj)
{
return obj instanceof IEnergyInterface && placementSide != direction.getOpposite();
}
@Override
public long onReceiveEnergy(ForgeDirection from, long receive, boolean doReceive)
{
if (receive > 0)
{
long energyUsed = 0;
for (int slot = 0; slot < this.getSizeInventory(); slot++)
{
energyUsed += CompatibilityModule.chargeItem(this.getStackInSlot(slot), receive - energyUsed, doReceive);
if (energyUsed >= receive)
break;
}
if (energyUsed > 0)
this.markedForUpdate = true;
return energyUsed;
}
return 0;
}
@Override
public long onExtractEnergy(ForgeDirection from, long extract, boolean doExtract)
{
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void renderDynamic(Vector3 pos, float frame, int pass)
{
if (pass == 0)
{
RenderCharger.INSTANCE.render(this, pos.x, pos.y, pos.z);
}
}
@Override
protected ItemStack getItem()
{
return new ItemStack(Electrical.itemCharger);
}
@Override
public String getType()
{
return "resonant_induction_charger";
}
@Override
public Iterable<ItemStack> getDrops()
{
List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add(getItem());
for (int i = 0; i < getSizeInventory(); i++)
if (getStackInSlot(i) != null)
drops.add(getStackInSlot(i));
return drops;
}
@Override
public boolean canStore(ItemStack stack, int slot, ForgeDirection side)
{
return slot < this.getSizeInventory() && stack != null && CompatibilityModule.isHandler(stack.getItem());
}
@Override
public String toString()
{
return "[PartCharger]" + x() + "x " + y() + "y " + z() + "z " + getSlotMask() + "s ";
}
}

View file

@ -1,91 +0,0 @@
package resonantinduction.electrical.charger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonant.api.items.ISimpleItemRenderer;
import resonant.lib.render.RenderItemOverlayUtility;
import resonant.lib.render.RenderUtility;
import resonantinduction.core.Reference;
import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.energy.UnitDisplay;
import universalelectricity.api.energy.UnitDisplay.Unit;
import universalelectricity.api.vector.Vector3;
/**
* Renderer for electric item charger
*
* @author DarkGuardsman
*/
public class RenderCharger implements ISimpleItemRenderer
{
public static final RenderCharger INSTANCE = new RenderCharger();
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "charger.tcn");
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "charger.png");
public void render(PartCharger part, double x, double y, double z)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
RenderUtility.rotateFaceToSideNoTranslate(part.placementSide);
RenderUtility.rotateBlockBasedOnDirection(part.getFacing());
RenderUtility.bind(TEXTURE);
GL11.glPushMatrix();
GL11.glTranslatef(0, 0.12f, 0);
MODEL.renderAll();
GL11.glPopMatrix();
GL11.glPopMatrix();
if (part.getStackInSlot(0) != null)
{
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
RenderUtility.rotateFaceToSideNoTranslate(part.placementSide);
RenderUtility.rotateBlockBasedOnDirection(part.getFacing());
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
RenderItemOverlayUtility.renderItem(part.world(), part.placementSide, part.getStackInSlot(0), new Vector3(0.00, -0.3, -0.00), 0, 4);
GL11.glPopMatrix();
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
boolean isLooking = false;
MovingObjectPosition objectPosition = player.rayTrace(8, 1);
if (objectPosition != null)
{
if (objectPosition.blockX == part.x() && objectPosition.blockY == part.y() && objectPosition.blockZ == part.z())
{
/**
* Render item and tool tip
*/
if (CompatibilityModule.getMaxEnergyItem(part.getStackInSlot(0)) > 0)
{
long energy = CompatibilityModule.getEnergyItem(part.getStackInSlot(0));
long maxEnergy = CompatibilityModule.getMaxEnergyItem(part.getStackInSlot(0));
RenderUtility.renderFloatingText(UnitDisplay.getDisplay(energy, Unit.JOULES, 2, true) + "/" + UnitDisplay.getDisplay(maxEnergy, Unit.JOULES, 2, true), new Vector3((float) x + 0.5F, (float) y + 0.8F, (float) z + 0.5F));
}
}
}
}
}
@Override
public void renderInventoryItem(ItemStack itemStack)
{
GL11.glTranslatef(0f, 0.5f, 0f);
RenderUtility.bind(TEXTURE);
MODEL.renderAll();
}
}

View file

@ -1,10 +0,0 @@
package resonantinduction.electrical.itemrailing;
/**
* @since 25/05/14
* @author tgame14
*/
public enum EnumRailingMaterial
{
DEFAULT, EXTENTION;
}

View file

@ -1,15 +0,0 @@
package resonantinduction.electrical.itemrailing;
import resonant.lib.grid.TickingGrid;
/**
* @since 25/05/14
* @author tgame14
*/
public class GridRailing extends TickingGrid<NodeRailing>
{
public GridRailing (NodeRailing node, Class type)
{
super(node, type);
}
}

View file

@ -1,60 +0,0 @@
package resonantinduction.electrical.itemrailing;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.MultipartUtility;
import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import codechicken.multipart.ControlKeyModifer;
import codechicken.multipart.JItemMultiPart;
import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.TMultiPart;
/**
* @author tgame14
* @since 17/04/14
*/
public class ItemItemRailing extends JItemMultiPart
{
public ItemItemRailing(int id)
{
super(id);
}
@Override
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 vhit)
{
BlockCoord onPos = pos.copy().offset(side ^ 1);
if (player.isSneaking() && !ControlKeyModifer.isControlDown(player))
{
PartRailing railing = (PartRailing) MultiPartRegistry.createPart("resonant_induction_itemrailing", false);
if (railing != null)
{
railing.preparePlacement(itemStack.getItemDamage());
}
return railing;
}
else
{
if (!MultipartUtility.canPlaceWireOnSide(world, onPos.x, onPos.y, onPos.z, ForgeDirection.getOrientation(side), false))
{
return null;
}
PartRailing railing = (PartRailing) MultiPartRegistry.createPart("resonant_induction_itemrailing", false);
if (railing != null)
{
railing.preparePlacement(side);
}
return railing;
}
}
}

View file

@ -1,94 +0,0 @@
package resonantinduction.electrical.itemrailing;
import codechicken.multipart.TMultiPart;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonant.lib.grid.Node;
import resonant.lib.grid.TickingGrid;
import resonantinduction.electrical.itemrailing.interfaces.IItemRailingProvider;
import universalelectricity.api.vector.IVector3;
import universalelectricity.api.vector.Vector3;
/**
* @since 25/05/14
* @author tgame14
*/
public class NodeRailing extends Node<IItemRailingProvider, GridRailing, Object>
{
protected byte connectionMap = Byte.parseByte("111111", 2);
public NodeRailing (IItemRailingProvider parent)
{
super(parent);
}
public NodeRailing setConnection(byte connectionMap)
{
this.connectionMap = connectionMap;
return this;
}
@Override
protected GridRailing newGrid ()
{
return new GridRailing(this, NodeRailing.class);
}
@Override
public void update (float deltaTime)
{
super.update(deltaTime);
}
@Override
protected void doRecache ()
{
connections.clear();
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tile = new Vector3(position()).translate(dir).getTileEntity(world());
if (tile instanceof IItemRailingProvider)
{
NodeRailing check = (NodeRailing) ((IItemRailingProvider) tile).getNode(NodeRailing.class, dir.getOpposite());
if (check != null && canConnect(dir, check) && check.canConnect(dir.getOpposite(), this))
{
connections.put(check, dir);
}
}
}
}
public IVector3 position()
{
return parent.getVectorWorld();
}
public World world()
{
return parent.getVectorWorld().world();
}
@Override
public boolean canConnect (ForgeDirection from, Object source)
{
return (source instanceof NodeRailing) && (connectionMap & (1 << from.ordinal())) != 0;
}
@Override
public void load (NBTTagCompound nbt)
{
super.load(nbt);
}
@Override
public void save (NBTTagCompound nbt)
{
super.save(nbt);
}
}

View file

@ -1,142 +0,0 @@
package resonantinduction.electrical.itemrailing;
import java.lang.reflect.Constructor;
import codechicken.lib.vec.Vector3;
import codechicken.microblock.IHollowConnect;
import codechicken.multipart.JNormalOcclusion;
import codechicken.multipart.TSlottedPart;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import resonant.api.IExternalInventory;
import resonant.api.IExternalInventoryBox;
import resonant.api.grid.INode;
import resonant.lib.utility.inventory.ExternalInventory;
import resonantinduction.core.prefab.part.PartFramedConnection;
import resonantinduction.core.prefab.part.PartFramedNode;
import resonantinduction.electrical.Electrical;
import resonantinduction.electrical.itemrailing.interfaces.IItemRailingProvider;
import universalelectricity.api.energy.EnergyNetworkLoader;
import universalelectricity.api.energy.IConductor;
import universalelectricity.api.energy.IEnergyNetwork;
import universalelectricity.api.net.IConnector;
import universalelectricity.api.net.INetwork;
import universalelectricity.api.vector.IVectorWorld;
import universalelectricity.api.vector.VectorWorld;
import codechicken.multipart.TileMultipart;
/**
* @since 16/03/14
* @author tgame14
*/
public class PartRailing extends PartFramedNode<EnumRailingMaterial, NodeRailing, IItemRailingProvider> implements IItemRailingProvider, TSlottedPart, JNormalOcclusion, IHollowConnect, IExternalInventory
{
protected ExternalInventory inventory;
protected boolean markPacketUpdate;
public PartRailing ()
{
super(Electrical.itemInsulation);
this.material = EnumRailingMaterial.DEFAULT;
this.node = new NodeRailing(this);
this.markPacketUpdate = true;
this.requiresInsulation = false;
this.inventory = new ExternalInventory(tile(), 5);
}
@Override
public INode getNode(Class<? extends INode> nodeType, ForgeDirection from)
{
if (nodeType.isInstance(this.node))
return node;
try
{
for (Constructor con : nodeType.getConstructors())
{
if ((con.getParameterTypes().length == 1) && con.getParameterTypes()[0].equals(getClass()))
{
this.node = (NodeRailing) con.newInstance(this);
return this.node;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
public VectorWorld getWorldPos()
{
return new VectorWorld(getWorld(), x(), y(), z());
}
@Override
public boolean doesTick ()
{
return false;
}
//TODO: Fix up to proper data
@Override
public void setMaterial (int i)
{
this.material = EnumRailingMaterial.values()[i];
}
@Override
protected ItemStack getItem ()
{
return new ItemStack(Electrical.itemRailing, 1, getMaterialID());
}
@Override
public String getType ()
{
return "resonant_induction_itemrailing";
}
@Override
public void renderDynamic (Vector3 pos, float frame, int pass)
{
super.renderDynamic(pos, frame, pass);
//TODO: Implement
}
@Override
public IVectorWorld getVectorWorld ()
{
return new VectorWorld(getWorld(), x(), y(), z());
}
@Override
public void onInventoryChanged ()
{
//TODO: Implement
}
@Override
public IExternalInventoryBox getInventory ()
{
return this.inventory;
}
@Override
public boolean canStore (ItemStack stack, int slot, ForgeDirection side)
{
return false;
}
@Override
public boolean canRemove (ItemStack stack, int slot, ForgeDirection side)
{
return false;
}
}

View file

@ -1,17 +0,0 @@
package resonantinduction.electrical.itemrailing;
import net.minecraft.item.ItemStack;
import resonant.api.items.ISimpleItemRenderer;
/**
* @author tgame14
* @since 20/04/14
*/
public class RenderRailing implements ISimpleItemRenderer
{
@Override
public void renderInventoryItem(ItemStack itemStack)
{
}
}

View file

@ -1,233 +0,0 @@
package resonantinduction.electrical.laser.gun;
import java.awt.Color;
import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge;
import resonant.api.event.LaserEvent;
import resonant.api.event.LaserFiredPlayerEvent;
import resonant.lib.prefab.vector.RayTraceHelper;
import resonant.lib.type.Pair;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.prefab.items.ItemEnergyTool;
import universalelectricity.api.vector.IVector3;
import universalelectricity.api.vector.Vector3;
/** Stream laser mining tool, When held down it will slowly mine away at the block in front of it.
*
*
* TODO create model for this that is 3D. The front should spin around the barrel as its mines
* generating a laser. As well the player should be wearing a battery pack when the laser is out.
* Other option is to force the player to wear a battery pack as armor when using the tool
*
* TODO when the laser hits the block there should be a flaring effect that simi blinds the player.
* That way they are force to wear wielding googles. As well this will gear the player more towards
* mining and less to fighting. Though the laser should still be a very effect fighting weapon, with
* only down side being its battery, and that it slows you down when held. Eg its a heavy peace of
* mining gear and the player will be simi-stationary when using it
*
* @author DarkGuardsman */
public class ItemMiningLaser extends ItemEnergyTool
{
/** Cost per tick of using the item */
long joulesPerTick = 100;
/** Damage to entities hit by the laser */
float damageToEntities = 3.3f;
/** Range of the laser ray trace */
int blockRange = 50;
/** Time to break a single block */
int breakTime = 15;
/** Map of players and how long they have focused the laser on a single block */
HashMap<EntityPlayer, Pair<Vector3, Integer>> miningMap = new HashMap<EntityPlayer, Pair<Vector3, Integer>>();
/** Used to track energy used while the player uses the laser rather then direct editing the nbt */
HashMap<EntityPlayer, Long> energyUsedMap = new HashMap<EntityPlayer, Long>();
public static final int MODE_REMOVE = 0, MODE_SMELT = 1, MODE_DAMAGE = 2;
public ItemMiningLaser(int id)
{
super(id);
hasModes = true;
this.energyTiers = 1;
toolModes = new String[] { "laser.toolmode.remove", "laser.toolmode.smelt", "laser.toolmode.damage" };
}
@Override
public void onUpdate(ItemStack itemStack, World world, Entity entity, int slot, boolean currentHeldItem)
{
//Remove player from mining map if he puts the laser gun away
if (entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
if (!currentHeldItem)
{
if (this.miningMap.containsKey(player))
{
this.miningMap.remove(player);
}
if (this.energyUsedMap.containsKey(player))
{
this.energyUsedMap.remove(player);
}
}
}
}
@Override
public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
{
//Small delay to prevent unwanted usage of the item
//TODO increase this delay to simulate warm up time
//TODO increase break time longer the laser has been running
//TODO match hardness of block for break time
//TODO add audio
if (count > 5 && (player.capabilities.isCreativeMode || discharge(stack, joulesPerTick, false) >= joulesPerTick && (!this.energyUsedMap.containsKey(player) || this.energyUsedMap.get(player) <= this.getEnergy(stack))))
{
Vec3 playerPosition = Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ);
Vec3 playerLook = RayTraceHelper.getLook(player, 1.0f);
Vec3 p = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord, playerPosition.yCoord + playerLook.yCoord, playerPosition.zCoord + playerLook.zCoord);
Vec3 playerViewOffset = Vec3.createVectorHelper(playerPosition.xCoord + playerLook.xCoord * blockRange, playerPosition.yCoord + playerLook.yCoord * blockRange, playerPosition.zCoord + playerLook.zCoord * blockRange);
MovingObjectPosition hit = RayTraceHelper.do_rayTraceFromEntity(player, new Vector3().toVec3(), blockRange, true);
if (!player.capabilities.isCreativeMode)
{
long energyUsed = this.energyUsedMap.containsKey(player) ? this.energyUsedMap.get(player) : 0;
switch (getMode(stack))
{
case 0:
energyUsed += joulesPerTick;
case 1:
energyUsed += joulesPerTick / 2;
case 2:
energyUsed += joulesPerTick / 3;
}
this.energyUsedMap.put(player, energyUsed);
}
if (hit != null)
{
LaserEvent event = new LaserFiredPlayerEvent(player, hit, stack);
MinecraftForge.EVENT_BUS.post(event);
if (!player.worldObj.isRemote && !event.isCanceled())
{
if (hit.typeOfHit == EnumMovingObjectType.ENTITY && hit.entityHit != null)
{
//TODO re-implements laser damage source
DamageSource damageSource = DamageSource.causeMobDamage(player);
hit.entityHit.attackEntityFrom(damageSource, damageToEntities);
hit.entityHit.setFire(5);
}
else if (hit.typeOfHit == EnumMovingObjectType.TILE)
{
int time = 1;
boolean mined = false;
if (miningMap.containsKey(player))
{
Pair<Vector3, Integer> lastHit = miningMap.get(player);
if (lastHit != null && lastHit.left() != null && lastHit.left().equals(new Vector3(hit)))
{
Block b = Block.blocksList[player.worldObj.getBlockId(hit.blockX, hit.blockY, hit.blockZ)];
if (b != null && b.getBlockHardness(player.worldObj, hit.blockX, hit.blockY, hit.blockZ) > -1)
{
time = lastHit.right() + 1;
if (time >= breakTime && this.getMode(stack) == MODE_REMOVE)
{
LaserEvent.onBlockMinedByLaser(player.worldObj, player, new Vector3(hit));
mined = true;
miningMap.remove(player);
}
else if (this.getMode(stack) == MODE_SMELT)
{
//TODO get the actual hit side from the angle of the ray trace
LaserEvent.onLaserHitBlock(player.worldObj, player, new Vector3(hit), ForgeDirection.UP);
player.worldObj.destroyBlockInWorldPartially(player.entityId, hit.blockX, hit.blockY, hit.blockZ, time);
}
}
}
}
if (!mined)
{
miningMap.put(player, new Pair<Vector3, Integer>(new Vector3(hit), time));
}
}
}
playerViewOffset = hit.hitVec;
}
//Only call client as the server can render stuff threw packets
if (player.worldObj.isRemote)
{
float x = (float) (MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.4) - MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
float z = (float) (MathHelper.sin((float) (player.rotationYawHead * 0.0174532925)) * (-.4) + MathHelper.cos((float) (player.rotationYawHead * 0.0174532925)) * (-.1));
ResonantInduction.proxy.renderBeam(player.worldObj, (IVector3) new Vector3(p).translate(new Vector3(x, -.25, z)), (IVector3) new Vector3(playerViewOffset), Color.red, 5);
ResonantInduction.proxy.renderBeam(player.worldObj, (IVector3) new Vector3(p).translate(new Vector3(x, -.45, z)), (IVector3) new Vector3(playerViewOffset), Color.red, 5);
}
}
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
{
if (!player.isSneaking())
{
player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
}
return super.onItemRightClick(itemStack, world, player);
}
@Override
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int par4)
{
if (miningMap.containsKey(player))
{
Pair<Vector3, Integer> vec = miningMap.get(player);
if (vec != null && vec.left() != null)
{
player.worldObj.destroyBlockInWorldPartially(player.entityId, vec.left().intX(), vec.left().intY(), vec.left().intZ(), -1);
}
miningMap.remove(player);
}
if (this.energyUsedMap.containsKey(player))
{
discharge(stack, this.energyUsedMap.get(player), true);
this.energyUsedMap.remove(player);
}
}
@Override
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
return par1ItemStack;
}
@Override
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 72000;
}
@Override
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
}

View file

@ -1,80 +0,0 @@
package resonantinduction.electrical.laser.gun;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonantinduction.core.Reference;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderMiningLaserGun implements IItemRenderer
{
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "MiningLaserGun.tcn");
private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "LaserGun.png");
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
{
float scale = 5f;
if (Minecraft.getMinecraft().thePlayer.getItemInUse() != item)
{
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0.2f, 0.2f, 0.67f);
GL11.glRotatef(-40, 0, 1, 0);
GL11.glRotatef(10, 1, 0, 0);
}
else
{
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0.2f, 0.2f, 0.67f);
GL11.glRotatef(-40, 0, 1, 0);
GL11.glRotatef(20, 1, 0, 0);
}
}
else if (type == ItemRenderType.EQUIPPED)
{
float scale = 3f;
GL11.glScalef(scale, scale, scale);
GL11.glRotatef(-80, 1, 0, 0);
GL11.glRotatef(60, 0, 1, 0);
GL11.glRotatef(20, 0, 0, 1);
GL11.glTranslatef(0f, 0f, 0.6f);
}
else if (type == ItemRenderType.INVENTORY)
{
float scale = 1.5f;
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(0.1f, 0.06f, 0.52f);
}
MODEL.renderAll();
GL11.glPopMatrix();
}
}

View file

@ -1,53 +0,0 @@
package resonantinduction.electrical.levitator;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import resonantinduction.core.prefab.part.IHighlight;
import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3;
import codechicken.microblock.FacePlacementGrid$;
import codechicken.multipart.JItemMultiPart;
import codechicken.multipart.MultiPartRegistry;
import codechicken.multipart.TMultiPart;
public class ItemLevitator extends JItemMultiPart implements IHighlight
{
public ItemLevitator(int id)
{
super(id);
}
@Override
@SuppressWarnings("unchecked")
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4)
{
list.add("\u00a7cFrom Dev's - Functionality Disabled");
}
@Override
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit)
{
side = FacePlacementGrid$.MODULE$.getHitSlot(hit, side);
PartLevitator part = (PartLevitator) MultiPartRegistry.createPart("resonant_induction_levitator", false);
if (part != null)
{
int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
int facing = l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
part.preparePlacement(side, facing);
}
return part;
}
@Override
public int getHighlightType()
{
return 0;
}
}

View file

@ -1,246 +0,0 @@
package resonantinduction.electrical.levitator;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelEMContractor extends ModelBase
{
public boolean doSpin;
// fields
ModelRenderer frame1;
ModelRenderer frame2;
ModelRenderer frame3;
ModelRenderer frame4;
ModelRenderer frame5;
ModelRenderer frame6;
ModelRenderer frame7;
ModelRenderer frame8;
ModelRenderer left_frame_connector;
ModelRenderer right_frame_connector;
ModelRenderer teslapole;
ModelRenderer Coil1;
ModelRenderer coil2;
ModelRenderer coil3;
ModelRenderer coil4;
ModelRenderer pole1;
ModelRenderer pole2;
ModelRenderer pole3;
ModelRenderer pole4;
ModelRenderer poletop1;
ModelRenderer poletop2;
ModelRenderer poletop3;
ModelRenderer poletop4;
ModelRenderer base1;
ModelRenderer base2;
ModelRenderer base3;
public ModelEMContractor(boolean spin)
{
doSpin = spin;
textureWidth = 128;
textureHeight = 128;
frame1 = new ModelRenderer(this, 0, 24);
frame1.addBox(0F, 0F, 0F, 1, 8, 1);
frame1.setRotationPoint(-3F, 15F, -2F);
frame1.setTextureSize(128, 128);
frame1.mirror = true;
setRotation(frame1, 0F, 0F, 0F);
frame2 = new ModelRenderer(this, 0, 24);
frame2.addBox(0F, 0F, 0F, 1, 8, 1);
frame2.setRotationPoint(1F, 15F, 2F);
frame2.setTextureSize(128, 128);
frame2.mirror = true;
setRotation(frame2, 0F, 0F, 0F);
frame3 = new ModelRenderer(this, 0, 24);
frame3.addBox(0F, 0F, 0F, 1, 8, 1);
frame3.setRotationPoint(2F, 15F, -2F);
frame3.setTextureSize(128, 128);
frame3.mirror = true;
setRotation(frame3, 0F, 0F, 0F);
frame4 = new ModelRenderer(this, 0, 24);
frame4.addBox(0F, 0F, 0F, 1, 8, 1);
frame4.setRotationPoint(-3F, 15F, 1F);
frame4.setTextureSize(128, 128);
frame4.mirror = true;
setRotation(frame4, 0F, 0F, 0F);
frame5 = new ModelRenderer(this, 0, 24);
frame5.addBox(0F, 0F, 0F, 1, 8, 1);
frame5.setRotationPoint(2F, 15F, 1F);
frame5.setTextureSize(128, 128);
frame5.mirror = true;
setRotation(frame5, 0F, 0F, 0F);
frame6 = new ModelRenderer(this, 0, 24);
frame6.addBox(0F, 0F, 0F, 1, 8, 1);
frame6.setRotationPoint(1F, 15F, -3F);
frame6.setTextureSize(128, 128);
frame6.mirror = true;
setRotation(frame6, 0F, 0F, 0F);
frame7 = new ModelRenderer(this, 0, 24);
frame7.addBox(0F, 0F, 0F, 1, 8, 1);
frame7.setRotationPoint(-2F, 15F, 2F);
frame7.setTextureSize(128, 128);
frame7.mirror = true;
setRotation(frame7, 0F, 0F, 0F);
frame8 = new ModelRenderer(this, 0, 24);
frame8.addBox(0F, 0F, 0F, 1, 8, 1);
frame8.setRotationPoint(-2F, 15F, -3F);
frame8.setTextureSize(128, 128);
frame8.mirror = true;
setRotation(frame8, 0F, 0F, 0F);
left_frame_connector = new ModelRenderer(this, 0, 20);
left_frame_connector.addBox(0F, 0F, 0F, 1, 1, 2);
left_frame_connector.setRotationPoint(-3F, 15F, -1F);
left_frame_connector.setTextureSize(128, 128);
left_frame_connector.mirror = true;
setRotation(left_frame_connector, 0F, 0F, 0F);
right_frame_connector = new ModelRenderer(this, 0, 20);
right_frame_connector.addBox(0F, 0F, 0F, 1, 1, 2);
right_frame_connector.setRotationPoint(2F, 15F, -1F);
right_frame_connector.setTextureSize(128, 128);
right_frame_connector.mirror = true;
setRotation(right_frame_connector, 0F, 0F, 0F);
teslapole = new ModelRenderer(this, 0, 0);
teslapole.addBox(-1F, -1F, -1F, 2, 15, 2);
teslapole.setRotationPoint(0F, 9F, 0F);
teslapole.setTextureSize(128, 128);
teslapole.mirror = true;
setRotation(teslapole, 0F, 0F, 0F);
Coil1 = new ModelRenderer(this, 17, 0);
Coil1.addBox(-1.5F, -0.5F, -1.5F, 3, 1, 3);
Coil1.setRotationPoint(0F, 12.5F, 0F);
Coil1.setTextureSize(128, 128);
Coil1.mirror = true;
setRotation(Coil1, 0F, 0F, 0F);
coil2 = new ModelRenderer(this, 17, 0);
coil2.addBox(-1.5F, -0.5F, -1.5F, 3, 1, 3);
coil2.setRotationPoint(0F, 14F, 0F);
coil2.setTextureSize(128, 128);
coil2.mirror = true;
setRotation(coil2, 0F, 0F, 0F);
coil3 = new ModelRenderer(this, 17, 0);
coil3.addBox(-1.5F, -0.5F, -1.5F, 3, 1, 3);
coil3.setRotationPoint(0F, 9.5F, 0F);
coil3.setTextureSize(128, 128);
coil3.mirror = true;
setRotation(coil3, 0F, 0F, 0F);
coil4 = new ModelRenderer(this, 17, 0);
coil4.addBox(-1.5F, -0.5F, -1.5F, 3, 1, 3);
coil4.setRotationPoint(0F, 11F, 0F);
coil4.setTextureSize(128, 128);
coil4.mirror = true;
setRotation(coil4, 0F, 0F, 0F);
pole1 = new ModelRenderer(this, 5, 26);
pole1.addBox(-0.5F, -1F, -0.5F, 1, 6, 1);
pole1.setRotationPoint(0F, 18F, 6.5F);
pole1.setTextureSize(128, 128);
pole1.mirror = true;
setRotation(pole1, 0F, 0F, 0F);
pole2 = new ModelRenderer(this, 5, 26);
pole2.addBox(-0.5F, -1F, -0.5F, 1, 6, 1);
pole2.setRotationPoint(0F, 18F, -6.5F);
pole2.setTextureSize(128, 128);
pole2.mirror = true;
setRotation(pole2, 0F, 0F, 0F);
pole3 = new ModelRenderer(this, 5, 26);
pole3.addBox(-0.5F, -1F, -0.5F, 1, 6, 1);
pole3.setRotationPoint(-6.5F, 18F, 0F);
pole3.setTextureSize(128, 128);
pole3.mirror = true;
setRotation(pole3, 0F, 0F, 0F);
pole4 = new ModelRenderer(this, 5, 26);
pole4.addBox(-0.5F, -1F, -0.5F, 1, 6, 1);
pole4.setRotationPoint(6.5F, 18F, 0F);
pole4.setTextureSize(128, 128);
pole4.mirror = true;
setRotation(pole4, 0F, 0F, 0F);
poletop1 = new ModelRenderer(this, 31, 0);
poletop1.addBox(-1F, -1F, -1F, 2, 2, 2);
poletop1.setRotationPoint(0F, 16.5F, -6.5F);
poletop1.setTextureSize(128, 128);
poletop1.mirror = true;
setRotation(poletop1, 0F, 0F, 0F);
poletop2 = new ModelRenderer(this, 31, 0);
poletop2.addBox(-1F, -1F, -1F, 2, 2, 2);
poletop2.setRotationPoint(0F, 16.5F, 6.5F);
poletop2.setTextureSize(128, 128);
poletop2.mirror = true;
setRotation(poletop2, 0F, 0F, 0F);
poletop3 = new ModelRenderer(this, 31, 0);
poletop3.addBox(-1F, -1F, -1F, 2, 2, 2);
poletop3.setRotationPoint(6.5F, 16.5F, 0F);
poletop3.setTextureSize(128, 128);
poletop3.mirror = true;
setRotation(poletop3, 0F, 0F, 0F);
poletop4 = new ModelRenderer(this, 31, 0);
poletop4.addBox(-1F, -1F, -1F, 2, 2, 2);
poletop4.setRotationPoint(-6.5F, 16.5F, 0F);
poletop4.setTextureSize(128, 128);
poletop4.mirror = true;
setRotation(poletop4, 0F, 0F, 0F);
base1 = new ModelRenderer(this, 0, 55);
base1.addBox(0F, 0F, 0F, 16, 1, 8);
base1.setRotationPoint(-8F, 23F, -4F);
base1.setTextureSize(128, 128);
base1.mirror = true;
setRotation(base1, 0F, 0F, 0F);
base2 = new ModelRenderer(this, 0, 68);
base2.addBox(0F, 0F, 0F, 8, 1, 5);
base2.setRotationPoint(-4F, 23F, 3F);
base2.setTextureSize(128, 128);
base2.mirror = true;
setRotation(base2, 0F, 0F, 0F);
base3 = new ModelRenderer(this, 0, 79);
base3.addBox(0F, 0F, 0F, 8, 1, 5);
base3.setRotationPoint(-4F, 23F, -8F);
base3.setTextureSize(128, 128);
base3.mirror = true;
setRotation(base3, 0F, 0F, 0F);
}
public void render(float f5)
{
if (doSpin)
{
Coil1.rotateAngleY = (float) Math.toRadians(Math.toDegrees(Coil1.rotateAngleY) + 3 < 360 ? Math.toDegrees(Coil1.rotateAngleY) + 3 : 0);
coil2.rotateAngleY = (float) Math.toRadians(Math.toDegrees(coil2.rotateAngleY) + 3 < 360 ? Math.toDegrees(coil2.rotateAngleY) + 3 : 0);
coil3.rotateAngleY = (float) Math.toRadians(Math.toDegrees(coil3.rotateAngleY) + 3 < 360 ? Math.toDegrees(coil3.rotateAngleY) + 3 : 0);
coil4.rotateAngleY = (float) Math.toRadians(Math.toDegrees(coil4.rotateAngleY) + 3 < 360 ? Math.toDegrees(coil4.rotateAngleY) + 3 : 0);
}
frame1.render(f5);
frame2.render(f5);
frame3.render(f5);
frame4.render(f5);
frame5.render(f5);
frame6.render(f5);
frame7.render(f5);
frame8.render(f5);
left_frame_connector.render(f5);
right_frame_connector.render(f5);
teslapole.render(f5);
Coil1.render(f5);
coil2.render(f5);
coil3.render(f5);
coil4.render(f5);
pole1.render(f5);
pole2.render(f5);
pole3.render(f5);
pole4.render(f5);
poletop1.render(f5);
poletop2.render(f5);
poletop3.render(f5);
poletop4.render(f5);
base1.render(f5);
base2.render(f5);
base3.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -1,688 +0,0 @@
package resonantinduction.electrical.levitator;
import java.lang.ref.WeakReference;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.BlockLadder;
import net.minecraft.block.BlockSnow;
import net.minecraft.block.BlockVine;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.IFluidBlock;
import resonant.lib.render.EnumColor;
import resonant.lib.utility.LinkUtility;
import resonant.lib.utility.WrenchUtility;
import resonant.lib.utility.inventory.InventoryUtility;
import resonantinduction.core.MultipartUtility;
import resonantinduction.core.Settings;
import resonantinduction.core.prefab.part.PartFace;
import resonantinduction.electrical.Electrical;
import resonantinduction.electrical.tesla.TileTesla;
import universalelectricity.api.vector.Vector3;
import universalelectricity.api.vector.VectorWorld;
import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput;
import codechicken.multipart.TMultiPart;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class PartLevitator extends PartFace
{
/**
* true = suck, false = push
*/
public boolean input = true;
/**
* Client Side Only
*/
public float renderRotation = 0;
private int pushDelay;
private AxisAlignedBB operationBounds;
private AxisAlignedBB suckBounds;
/**
* Pathfinding
*/
private ThreadLevitatorPathfinding thread;
private PathfinderLevitator pathfinder;
private WeakReference<PartLevitator> linked;
private int lastCalcTime = 0;
/**
* Color of beam
*/
private int dyeID = TileTesla.DEFAULT_COLOR;
/**
* Linking
*/
private byte saveLinkSide;
private VectorWorld saveLinkVector;
public static boolean canBePath(World world, Vector3 position)
{
Block block = Block.blocksList[position.getBlockID(world)];
return block == null || (block instanceof BlockSnow || block instanceof BlockVine || block instanceof BlockLadder || ((block instanceof BlockFluid || block instanceof IFluidBlock) && block.blockID != Block.lavaMoving.blockID && block.blockID != Block.lavaStill.blockID));
}
@Override
public boolean activate(EntityPlayer player, MovingObjectPosition part, ItemStack itemStack)
{
if (WrenchUtility.isWrench(itemStack))
{
if (tryLink(LinkUtility.getLink(itemStack), LinkUtility.getSide(itemStack)))
{
if (world().isRemote)
{
player.addChatMessage("Successfully linked devices.");
}
LinkUtility.clearLink(itemStack);
}
else
{
if (world().isRemote)
{
player.addChatMessage("Marked link for device.");
}
LinkUtility.setLink(itemStack, new VectorWorld(world(), x(), y(), z()));
LinkUtility.setSide(itemStack, (byte) placementSide.ordinal());
}
return true;
}
if (player.getCurrentEquippedItem() != null)
{
if (player.getCurrentEquippedItem().itemID == Item.dyePowder.itemID)
{
setDye(player.getCurrentEquippedItem().getItemDamage());
if (!player.capabilities.isCreativeMode)
{
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
return true;
}
}
if (player.isSneaking())
{
input = !input;
}
updateBounds();
updatePath();
return true;
}
/**
* Link methods
*/
public boolean tryLink(VectorWorld linkVector, byte side)
{
if (linkVector != null)
{
TMultiPart part = MultipartUtility.getMultipart(world(), linkVector, side);
if (part instanceof PartLevitator)
{
setLink((PartLevitator) part, true);
}
return true;
}
return false;
}
public PartLevitator getLink()
{
return linked != null && linked.get() != null && linked.get().world() != null ? linked.get() : null;
}
@Override
public void onEntityCollision(Entity entity)
{
/**
* Attempt to pull items in.
*/
if (!world().isRemote && input && canFunction() && entity instanceof EntityItem)
{
EntityItem entityItem = (EntityItem) entity;
IInventory inventory = (IInventory) getLatched();
ItemStack remains = InventoryUtility.putStackInInventory(inventory, entityItem.getEntityItem(), placementSide.getOpposite().getOpposite().ordinal(), false);
if (remains == null)
{
entityItem.setDead();
}
else
{
entityItem.getEntityItem().stackSize = remains.stackSize;
}
// TODO: Add redstone pulse and reaction?
}
}
@Override
public void update()
{
if (ticks % 60 == 0)
{
updateBounds();
}
super.update();
pushDelay = Math.max(0, pushDelay - 1);
/**
* Try to use temp link vectors from save/loads to link.
*/
if (saveLinkVector != null)
{
tryLink(saveLinkVector, saveLinkSide);
saveLinkVector = null;
}
if (canFunction())
{
IInventory inventory = (IInventory) getLatched();
/**
* Place items or take items from the inventory into the world.
*/
if (!input)
{
renderRotation = Math.min(20, renderRotation + 0.8f);
/**
* Attempt to push items out.
*/
if (pushDelay == 0)
{
ItemStack retrieved = InventoryUtility.takeTopItemFromInventory(inventory, placementSide.getOpposite().getOpposite().ordinal());
if (retrieved != null)
{
EntityItem entityItem = getItemWithPosition(retrieved);
if (!world().isRemote)
{
world().spawnEntityInWorld(entityItem);
}
pushDelay = Settings.LEVITATOR_PUSH_DELAY;
}
}
}
else if (input)
{
renderRotation = Math.max(0, renderRotation - 0.8f);
}
final int renderPeriod = 1;
final boolean renderBeam = ticks % renderPeriod == 0 && hasLink() && getLink().input != input;
if (!input)
{
if (hasLink())
{
if (getLink().input)
{
/**
* Linked usage.
*/
if (thread != null)
{
PathfinderLevitator newPath = thread.getPath();
if (newPath != null)
{
pathfinder = newPath;
pathfinder.results.add(getPosition());
thread = null;
}
}
// Push entity along path.
if (pathfinder != null)
{
List<Vector3> results = pathfinder.results;
/**
* Draw default beams.
*/
if (renderBeam)
{
Electrical.proxy.renderElectricShock(world(), getBeamSpawnPosition(), getPosition().translate(0.5), EnumColor.DYES[dyeID].toColor(), world().rand.nextFloat() > 0.9);
Electrical.proxy.renderElectricShock(world(), getLink().getPosition().translate(0.5), getLink().getBeamSpawnPosition(), EnumColor.DYES[dyeID].toColor(), world().rand.nextFloat() > 0.9);
}
for (int i = 0; i < results.size(); i++)
{
Vector3 result = results.get(i).clone();
if (canBeMovePath(world(), result))
{
if (i - 1 >= 0)
{
Vector3 prevResult = results.get(i - 1).clone();
Vector3 difference = prevResult.clone().difference(result);
final ForgeDirection direction = difference.toForgeDirection();
if (renderBeam)
{
Electrical.proxy.renderElectricShock(world(), prevResult.clone().translate(0.5), result.clone().translate(0.5), EnumColor.DYES[dyeID].toColor(), world().rand.nextFloat() > 0.9);
}
AxisAlignedBB bounds = AxisAlignedBB.getAABBPool().getAABB(result.x, result.y, result.z, result.x + 1, result.y + 1, result.z + 1);
List<EntityItem> entities = world().getEntitiesWithinAABB(EntityItem.class, bounds);
for (EntityItem entityItem : entities)
{
moveEntity(entityItem, direction, result);
}
}
}
else
{
updatePath();
break;
}
}
}
else
{
updatePath();
}
}
}
else if (operationBounds != null)
{
/**
* Non-linked usage.
*/
for (EntityItem entityItem : (List<EntityItem>) world().getEntitiesWithinAABB(EntityItem.class, operationBounds))
{
moveEntity(entityItem, placementSide.getOpposite(), getPosition());
}
if (ticks % renderPeriod == 0)
{
Electrical.proxy.renderElectricShock(world(), getBeamSpawnPosition(), new Vector3(operationBounds.maxX - 0.5 - placementSide.offsetX / 3f, operationBounds.maxY - 0.5 - placementSide.offsetY / 3f, operationBounds.maxZ - 0.5 - placementSide.offsetZ / 3f), EnumColor.DYES[dyeID].toColor(), world().rand.nextFloat() > 0.9);
}
}
}
lastCalcTime--;
}
}
public boolean canBeMovePath(World world, Vector3 position)
{
TMultiPart partSelf = MultipartUtility.getMultipart(new VectorWorld(world, position), placementSide.ordinal());
if (partSelf == this)
{
return true;
}
TMultiPart partLink = MultipartUtility.getMultipart(new VectorWorld(world, position), getLink().placementSide.ordinal());
if (partLink == getLink())
{
return true;
}
return canBePath(world, position);
}
private boolean hasLink()
{
return getLink() != null && getLink().getLink() == this;
}
private void moveEntity(EntityItem entityItem, ForgeDirection direction, Vector3 lockVector)
{
switch (direction)
{
case DOWN:
entityItem.setPosition(lockVector.x + 0.5, entityItem.posY, lockVector.z + 0.5);
entityItem.motionX = 0;
entityItem.motionZ = 0;
if (!input)
{
entityItem.motionY = Math.max(-Settings.LEVITATOR_MAX_SPEED, entityItem.motionY - Settings.LEVITATOR_ACCELERATION);
}
else
{
entityItem.motionY = Math.min(Settings.LEVITATOR_MAX_SPEED, entityItem.motionY + .04 + Settings.LEVITATOR_ACCELERATION);
}
break;
case UP:
entityItem.setPosition(lockVector.x + 0.5, entityItem.posY, lockVector.z + 0.5);
entityItem.motionX = 0;
entityItem.motionZ = 0;
if (!input)
{
entityItem.motionY = Math.min(Settings.LEVITATOR_MAX_SPEED, entityItem.motionY + .04 + Settings.LEVITATOR_ACCELERATION);
}
else
{
entityItem.motionY = Math.max(-Settings.LEVITATOR_MAX_SPEED, entityItem.motionY - Settings.LEVITATOR_ACCELERATION);
}
break;
case NORTH:
entityItem.setPosition(lockVector.x + 0.5, lockVector.y + 0.5, entityItem.posZ);
entityItem.motionX = 0;
entityItem.motionY = 0;
if (!input)
{
entityItem.motionZ = Math.max(-Settings.LEVITATOR_MAX_SPEED, entityItem.motionZ - Settings.LEVITATOR_ACCELERATION);
}
else
{
entityItem.motionZ = Math.min(Settings.LEVITATOR_MAX_SPEED, entityItem.motionZ + Settings.LEVITATOR_ACCELERATION);
}
break;
case SOUTH:
entityItem.setPosition(lockVector.x + 0.5, lockVector.y + 0.5, entityItem.posZ);
entityItem.motionX = 0;
entityItem.motionY = 0;
if (!input)
{
entityItem.motionZ = Math.min(Settings.LEVITATOR_MAX_SPEED, entityItem.motionZ + Settings.LEVITATOR_ACCELERATION);
}
else
{
entityItem.motionZ = Math.max(-Settings.LEVITATOR_MAX_SPEED, entityItem.motionZ - Settings.LEVITATOR_ACCELERATION);
}
break;
case WEST:
entityItem.setPosition(entityItem.posX, lockVector.y + 0.5, lockVector.z + 0.5);
entityItem.motionY = 0;
entityItem.motionZ = 0;
if (!input)
{
entityItem.motionX = Math.max(-Settings.LEVITATOR_MAX_SPEED, entityItem.motionX - Settings.LEVITATOR_ACCELERATION);
}
else
{
entityItem.motionX = Math.min(Settings.LEVITATOR_MAX_SPEED, entityItem.motionX + Settings.LEVITATOR_ACCELERATION);
}
break;
case EAST:
entityItem.setPosition(entityItem.posX, lockVector.y + 0.5, lockVector.z + 0.5);
entityItem.motionY = 0;
entityItem.motionZ = 0;
if (!input)
{
entityItem.motionX = Math.min(Settings.LEVITATOR_MAX_SPEED, entityItem.motionX + Settings.LEVITATOR_ACCELERATION);
}
else
{
entityItem.motionX = Math.max(-Settings.LEVITATOR_MAX_SPEED, entityItem.motionX - Settings.LEVITATOR_ACCELERATION);
}
break;
default:
break;
}
entityItem.ticksExisted = 1;
entityItem.isAirBorne = true;
entityItem.delayBeforeCanPickup = 1;
entityItem.age = Math.max(entityItem.age - 1, 0);
}
private EntityItem getItemWithPosition(ItemStack toSend)
{
EntityItem item = new EntityItem(world(), x() + 0.5, y() + 0.5, z() + 0.5, toSend);
item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
return item;
}
public void updateBounds()
{
suckBounds = operationBounds = null;
ForgeDirection dir = placementSide.getOpposite();
MovingObjectPosition mop = world().clip(getPosition().translate(dir).toVec3(), getPosition().translate(dir, Settings.LEVITATOR_MAX_REACH).toVec3());
int reach = Settings.LEVITATOR_MAX_REACH;
if (mop != null)
{
if (MultipartUtility.getMultipart(world(), mop.blockX, mop.blockY, mop.blockZ, placementSide.getOpposite().ordinal()) instanceof PartLevitator)
{
reach = (int) Math.min(getPosition().distance(new Vector3(mop.hitVec)), reach);
if (dir.offsetX + dir.offsetY + dir.offsetZ < 0)
{
operationBounds = AxisAlignedBB.getBoundingBox(x() + dir.offsetX * reach, y() + dir.offsetY * reach, z() + dir.offsetZ * reach, x() + 1, y() + 1, z() + 1);
suckBounds = AxisAlignedBB.getBoundingBox(x() + dir.offsetX, y() + dir.offsetY, z() + dir.offsetZ, x() + 1, y() + 1, z() + 1);
}
else
{
operationBounds = AxisAlignedBB.getBoundingBox(x(), y(), z(), x() + 1 + dir.offsetX * reach, y() + 1 + dir.offsetY * reach, z() + 1 + dir.offsetZ * reach);
suckBounds = AxisAlignedBB.getBoundingBox(x(), y(), z(), x() + 1 + dir.offsetX, y() + 1 + dir.offsetY, z() + 1 + dir.offsetZ);
}
}
}
}
@Override
public void onNeighborChanged()
{
super.onNeighborChanged();
updateBounds();
}
public boolean canFunction()
{
//TODO remove (false) when working on
return false && isLatched() && !world().isBlockIndirectlyGettingPowered(x(), y(), z());
}
public boolean isLatched()
{
return getLatched() != null;
}
public TileEntity getLatched()
{
ForgeDirection side = placementSide;
TileEntity tile = world().getBlockTileEntity(x() + side.offsetX, y() + side.offsetY, z() + side.offsetZ);
if (tile instanceof IInventory)
{
return tile;
}
return null;
}
@Override
public void readDesc(MCDataInput packet)
{
super.readDesc(packet);
input = packet.readBoolean();
dyeID = packet.readByte();
if (packet.readBoolean())
{
saveLinkVector = new VectorWorld(packet.readNBTTagCompound());
saveLinkSide = packet.readByte();
}
}
@Override
public void writeDesc(MCDataOutput packet)
{
super.writeDesc(packet);
packet.writeBoolean(input);
packet.writeByte(dyeID);
if (getLink() != null)
{
packet.writeBoolean(true);
NBTTagCompound nbt = new NBTTagCompound();
new VectorWorld(getLink().world(), getLink().x(), getLink().y(), getLink().z()).writeToNBT(nbt);
packet.writeNBTTagCompound(nbt);
packet.writeByte(getLink().placementSide.ordinal());
}
else
{
packet.writeBoolean(false);
}
}
@Override
public void load(NBTTagCompound nbt)
{
super.load(nbt);
this.input = nbt.getBoolean("suck");
this.dyeID = nbt.getInteger("dyeID");
if (nbt.hasKey("link"))
{
saveLinkVector = new VectorWorld(nbt.getCompoundTag("link"));
saveLinkSide = nbt.getByte("linkSide");
}
}
@Override
public void save(NBTTagCompound nbt)
{
super.save(nbt);
nbt.setBoolean("suck", input);
nbt.setInteger("dyeID", dyeID);
if (getLink() != null && getLink().world() != null)
{
nbt.setCompoundTag("link", new VectorWorld(getLink().world(), getLink().x(), getLink().y(), getLink().z()).writeToNBT(new NBTTagCompound()));
nbt.setByte("linkSide", (byte) getLink().placementSide.ordinal());
}
}
/**
* Link between two TileEntities, do pathfinding operation.
*/
public void setLink(PartLevitator levitator, boolean setOpponent)
{
if (getLink() != null && setOpponent)
{
getLink().setLink(null, false);
}
linked = new WeakReference(levitator);
if (setOpponent)
{
getLink().setLink(this, false);
}
updatePath();
}
public void updatePath()
{
if (thread == null && getLink() != null && lastCalcTime <= 0)
{
pathfinder = null;
Vector3 start = getPosition();
Vector3 target = new Vector3(getLink().x(), getLink().y(), getLink().z());
if (start.distance(target) < Settings.MAX_LEVITATOR_DISTANCE)
{
if (canBeMovePath(world(), start) && canBeMovePath(world(), target))
{
thread = new ThreadLevitatorPathfinding(new PathfinderLevitator(world(), target), start);
thread.start();
lastCalcTime = 40;
}
}
}
}
public void setDye(int dye)
{
dyeID = dye;
world().markBlockForUpdate(x(), y(), z());
}
public Vector3 getPosition()
{
return new Vector3(x(), y(), z());
}
public Vector3 getBeamSpawnPosition()
{
return new Vector3(x() + 0.5 + placementSide.offsetX / 3f, y() + 0.5 + placementSide.offsetY / 3f, z() + 0.5 + placementSide.offsetZ / 3f);
}
@Override
protected ItemStack getItem()
{
return new ItemStack(Electrical.itemLevitator);
}
@Override
public String getType()
{
return "resonant_induction_levitator";
}
@Override
@SideOnly(Side.CLIENT)
public void renderDynamic(codechicken.lib.vec.Vector3 pos, float frame, int pass)
{
if (pass == 0)
{
RenderLevitator.INSTANCE.render(this, pos.x, pos.y, pos.z);
}
}
}

View file

@ -1,79 +0,0 @@
package resonantinduction.electrical.levitator;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import resonant.lib.path.IPathCallBack;
import resonant.lib.path.Pathfinder;
import resonant.lib.path.PathfinderAStar;
import universalelectricity.api.vector.Vector3;
/**
* Uses the well known A* Pathfinding algorithm.
*
* @author Calclavia
*
*/
public class PathfinderLevitator extends PathfinderAStar
{
private World world;
private double maxSearchDistance;
public PathfinderLevitator(final World world, final Vector3 goal)
{
super(new IPathCallBack()
{
@Override
public Set<Vector3> getConnectedNodes(Pathfinder finder, Vector3 currentNode)
{
Set<Vector3> neighbors = new HashSet<Vector3>();
for (int i = 0; i < 6; i++)
{
Vector3 neighbor = currentNode.clone().translate(ForgeDirection.getOrientation(i));
if (PartLevitator.canBePath(world, neighbor) || neighbor.equals(goal))
{
neighbors.add(neighbor);
}
}
return neighbors;
}
@Override
public boolean onSearch(Pathfinder finder, Vector3 start, Vector3 node)
{
return !(start.distance(node) < (start.distance(goal) * 2));
}
}, goal);
this.world = world;
}
@Override
public boolean findNodes(Vector3 start)
{
int blockCount = 0;
for (int i = 0; i < 6; i++)
{
ForgeDirection direction = ForgeDirection.getOrientation(i);
Vector3 neighbor = this.goal.clone().translate(new Vector3(direction.offsetX, direction.offsetY, direction.offsetZ));
if (!PartLevitator.canBePath(this.world, neighbor))
{
blockCount++;
}
}
if (blockCount >= 6)
{
return false;
}
return super.findNodes(start);
}
}

View file

@ -1,68 +0,0 @@
package resonantinduction.electrical.levitator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.AdvancedModelLoader;
import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import resonant.api.items.ISimpleItemRenderer;
import resonant.lib.render.RenderUtility;
import resonantinduction.core.Reference;
import cpw.mods.fml.client.FMLClientHandler;
public class RenderLevitator implements ISimpleItemRenderer
{
public static final RenderLevitator INSTANCE = new RenderLevitator();
public static final IModelCustom MODEL = AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "levitator.tcn");
public static final ResourceLocation TEXTURE_ON = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "levitator_on.png");
public static final ResourceLocation TEXTURE_OFF = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "levitator_off.png");
public void render(PartLevitator part, double x, double y, double z)
{
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
RenderUtility.rotateFaceToSideNoTranslate(part.placementSide);
if (part.canFunction())
RenderUtility.bind(TEXTURE_ON);
else
RenderUtility.bind(TEXTURE_OFF);
GL11.glPushMatrix();
GL11.glRotatef(part.renderRotation, 1, 0, 0);
MODEL.renderOnly("ring1");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glRotatef(-part.renderRotation, 1, 0, 0);
MODEL.renderOnly("ring2");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glRotatef(part.renderRotation, 0, 0, 1);
MODEL.renderOnly("ring3");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glRotatef(-part.renderRotation, 0, 0, 1);
MODEL.renderOnly("ring4");
GL11.glPopMatrix();
MODEL.renderAllExcept("ring1", "ring2", "ring3", "ring4");
GL11.glPopMatrix();
}
@Override
public void renderInventoryItem(ItemStack itemStack)
{
GL11.glPushMatrix();
GL11.glTranslatef(0f, 0.5f, 0f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_OFF);
MODEL.renderAll();
GL11.glPopMatrix();
}
}

View file

@ -1,41 +0,0 @@
/**
*
*/
package resonantinduction.electrical.levitator;
import universalelectricity.api.vector.Vector3;
/**
* @author Calclavia
*
*/
public class ThreadLevitatorPathfinding extends Thread
{
private boolean isCompleted = false;
private PathfinderLevitator pathfinder;
private Vector3 start;
public ThreadLevitatorPathfinding(PathfinderLevitator pathfinder, Vector3 start)
{
this.pathfinder = pathfinder;
this.start = start;
this.setPriority(Thread.MIN_PRIORITY);
}
@Override
public void run()
{
this.pathfinder.findNodes(this.start);
this.isCompleted = true;
}
public PathfinderLevitator getPath()
{
if (this.isCompleted)
{
return this.pathfinder;
}
return null;
}
}