Added electrostatic linker

This commit is contained in:
Calclavia 2013-08-04 10:20:45 -04:00
parent be5d59180c
commit 43f770fd66
7 changed files with 67 additions and 22 deletions

View file

@ -11,3 +11,4 @@ tile.resonantinduction\:battery.name=Modular Battery
## Items
item.resonantinduction\:quantumEntangler.name=Quantum Entangler
item.resonantinduction\:capacitor.name=Capacitor Cell
item.resonantinduction\:linker.name=Electrostatic Linker

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,018 B

View file

@ -16,6 +16,7 @@ import resonantinduction.battery.TileEntityBattery;
import resonantinduction.contractor.BlockEMContractor;
import resonantinduction.contractor.ItemBlockContractor;
import resonantinduction.contractor.TileEntityEMContractor;
import resonantinduction.entangler.ItemLinker;
import resonantinduction.entangler.ItemQuantumEntangler;
import resonantinduction.multimeter.BlockMultimeter;
import resonantinduction.multimeter.ItemBlockMultimeter;
@ -114,6 +115,7 @@ public class ResonantInduction
// Items
public static Item itemQuantumEntangler;
public static Item itemCapacitor;
public static Item itemLinker;
// Blocks
public static Block blockTesla;
@ -141,9 +143,11 @@ public class ResonantInduction
// Items
itemQuantumEntangler = new ItemQuantumEntangler(getNextItemID());
itemCapacitor = new ItemCapacitor(getNextItemID());
itemLinker = new ItemLinker(getNextItemID());
GameRegistry.registerItem(itemQuantumEntangler, itemQuantumEntangler.getUnlocalizedName());
GameRegistry.registerItem(itemCapacitor, itemCapacitor.getUnlocalizedName());
GameRegistry.registerItem(itemLinker, itemLinker.getUnlocalizedName());
// Blocks
blockTesla = new BlockTesla(getNextBlockID());
@ -163,7 +167,7 @@ public class ResonantInduction
GameRegistry.registerTileEntity(TileEntityMultimeter.class, blockMultimeter.getUnlocalizedName());
GameRegistry.registerTileEntity(TileEntityEMContractor.class, blockEMContractor.getUnlocalizedName());
GameRegistry.registerTileEntity(TileEntityBattery.class, blockBattery.getUnlocalizedName());
TickRegistry.registerTickHandler(new BatteryManager(), Side.SERVER);
ResonantInduction.proxy.registerRenderers();

View file

@ -16,7 +16,7 @@ import resonantinduction.base.Vector3;
* @author Calclavia
*
*/
public class Pathfinding
public class Pathfinder
{
public Set<Vector3> openSet, closedSet;
@ -28,7 +28,7 @@ public class Pathfinding
public Set<Vector3> results;
public Pathfinding(Vector3 target)
public Pathfinder(Vector3 target)
{
this.target = target;
}

View file

@ -3,6 +3,11 @@
*/
package resonantinduction.entangler;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import resonantinduction.base.ItemBase;
@ -19,6 +24,25 @@ public abstract class ItemCoordLink extends ItemBase
super(name, id);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
super.addInformation(itemstack, entityplayer, list, flag);
if (hasLink(itemstack))
{
Vector3 vec = getLink(itemstack);
int dimID = getLinkDim(itemstack);
list.add("Bound to [" + (int) vec.x + ", " + (int) vec.y + ", " + (int) vec.z + "], dimension '" + dimID + "'");
}
else
{
list.add("No block bound");
}
}
public boolean hasLink(ItemStack itemStack)
{
return getLink(itemStack) != null;

View file

@ -0,0 +1,35 @@
/**
*
*/
package resonantinduction.entangler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import resonantinduction.base.Vector3;
/**
* @author Calclavia
*
*/
public class ItemLinker extends ItemCoordLink
{
public ItemLinker(int id)
{
super("linker", id);
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10)
{
if (!world.isRemote)
{
System.out.println("TEST");
int dimID = world.provider.dimensionId;
player.addChatMessage("Set link to block [" + x + ", " + y + ", " + z + "], dimension '" + dimID + "'");
this.setLink(stack, new Vector3(x, y, z), dimID);
}
return true;
}
}

View file

@ -26,25 +26,6 @@ public class ItemQuantumEntangler extends ItemCoordLink
// TODO Handheld model, render animation, energy usage (should be easy?)
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag)
{
super.addInformation(itemstack, entityplayer, list, flag);
if (hasLink(itemstack))
{
Vector3 vec = getLink(itemstack);
int dimID = getLinkDim(itemstack);
list.add("Bound to [" + (int) vec.x + ", " + (int) vec.y + ", " + (int) vec.z + "], dimension '" + dimID + "'");
}
else
{
list.add("No block bound");
}
}
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int x, int y, int z, int side, float posX, float posY, float posZ)
{