Removed linker in favor of Calclavia Core's Multitool
This commit is contained in:
parent
751d040487
commit
c4e0a03da8
10 changed files with 191 additions and 127 deletions
|
@ -66,7 +66,7 @@ jar {
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven { url 'http://calclavia.com/maven/' }
|
maven { url 'file://var/www/maven/' }
|
||||||
|
|
||||||
ivy {
|
ivy {
|
||||||
name 'CB FS'
|
name 'CB FS'
|
||||||
|
@ -74,8 +74,8 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'universalelectricity:Universal-Electricity:+:dev'
|
compile 'universalelectricity:Universal-Electricity:3.0.+:dev'
|
||||||
compile 'calclaviacore:calclavia-core:+:dev'
|
compile 'calclaviacore:calclavia-core:1.1.+:dev'
|
||||||
compile name: 'CodeChickenLib', version: "1.6.4-1.0.0.49", ext: 'jar'
|
compile name: 'CodeChickenLib', version: "1.6.4-1.0.0.49", ext: 'jar'
|
||||||
compile name: 'ForgeMultipart', version: "1.6.4-1.0.0.233", ext: 'jar'
|
compile name: 'ForgeMultipart', version: "1.6.4-1.0.0.233", ext: 'jar'
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,12 +34,12 @@ import resonantinduction.machine.grinder.TileGrinderWheel;
|
||||||
import resonantinduction.machine.item.ItemDust;
|
import resonantinduction.machine.item.ItemDust;
|
||||||
import resonantinduction.machine.liquid.BlockFluidMixture;
|
import resonantinduction.machine.liquid.BlockFluidMixture;
|
||||||
import resonantinduction.machine.liquid.TileFluidMixture;
|
import resonantinduction.machine.liquid.TileFluidMixture;
|
||||||
|
import resonantinduction.transport.LinkEvent;
|
||||||
import resonantinduction.transport.battery.BlockBattery;
|
import resonantinduction.transport.battery.BlockBattery;
|
||||||
import resonantinduction.transport.battery.ItemBlockBattery;
|
import resonantinduction.transport.battery.ItemBlockBattery;
|
||||||
import resonantinduction.transport.battery.TileBattery;
|
import resonantinduction.transport.battery.TileBattery;
|
||||||
import resonantinduction.transport.levitator.BlockLevitator;
|
import resonantinduction.transport.levitator.BlockLevitator;
|
||||||
import resonantinduction.transport.levitator.ItemBlockContractor;
|
import resonantinduction.transport.levitator.ItemBlockContractor;
|
||||||
import resonantinduction.transport.levitator.ItemLinker;
|
|
||||||
import resonantinduction.transport.levitator.TileEMLevitator;
|
import resonantinduction.transport.levitator.TileEMLevitator;
|
||||||
import resonantinduction.transport.tesla.BlockTesla;
|
import resonantinduction.transport.tesla.BlockTesla;
|
||||||
import resonantinduction.transport.tesla.TileTesla;
|
import resonantinduction.transport.tesla.TileTesla;
|
||||||
|
@ -154,7 +154,6 @@ public class ResonantInduction
|
||||||
/**
|
/**
|
||||||
* Transport
|
* Transport
|
||||||
*/
|
*/
|
||||||
public static Item itemLinker;
|
|
||||||
private static Item itemPartWire;
|
private static Item itemPartWire;
|
||||||
public static Item itemMultimeter;
|
public static Item itemMultimeter;
|
||||||
public static Item itemTransformer;
|
public static Item itemTransformer;
|
||||||
|
@ -199,7 +198,6 @@ public class ResonantInduction
|
||||||
TileEMLevitator.PUSH_DELAY = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Push Delay", TileEMLevitator.PUSH_DELAY).getInt(TileEMLevitator.PUSH_DELAY);
|
TileEMLevitator.PUSH_DELAY = CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "Contractor Item Push Delay", TileEMLevitator.PUSH_DELAY).getInt(TileEMLevitator.PUSH_DELAY);
|
||||||
|
|
||||||
// Items
|
// Items
|
||||||
itemLinker = new ItemLinker(getNextItemID());
|
|
||||||
itemPartWire = new ItemWire(getNextItemID());
|
itemPartWire = new ItemWire(getNextItemID());
|
||||||
itemMultimeter = new ItemMultimeter(getNextItemID());
|
itemMultimeter = new ItemMultimeter(getNextItemID());
|
||||||
itemTransformer = new ItemTransformer(getNextItemID());
|
itemTransformer = new ItemTransformer(getNextItemID());
|
||||||
|
@ -225,7 +223,6 @@ public class ResonantInduction
|
||||||
|
|
||||||
CONFIGURATION.save();
|
CONFIGURATION.save();
|
||||||
|
|
||||||
GameRegistry.registerItem(itemLinker, itemLinker.getUnlocalizedName());
|
|
||||||
GameRegistry.registerItem(itemMultimeter, itemMultimeter.getUnlocalizedName());
|
GameRegistry.registerItem(itemMultimeter, itemMultimeter.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(itemTransformer, itemTransformer.getUnlocalizedName());
|
GameRegistry.registerItem(itemTransformer, itemTransformer.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(itemDust, itemDust.getUnlocalizedName());
|
GameRegistry.registerItem(itemDust, itemDust.getUnlocalizedName());
|
||||||
|
@ -257,6 +254,7 @@ public class ResonantInduction
|
||||||
}
|
}
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.register(itemDust);
|
MinecraftForge.EVENT_BUS.register(itemDust);
|
||||||
|
MinecraftForge.EVENT_BUS.register(new LinkEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -287,9 +285,6 @@ public class ResonantInduction
|
||||||
*/
|
*/
|
||||||
final ItemStack defaultWire = EnumWireMaterial.IRON.getWire();
|
final ItemStack defaultWire = EnumWireMaterial.IRON.getWire();
|
||||||
|
|
||||||
/** Linker **/
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(itemLinker, " E ", "GCG", " E ", 'E', Item.eyeOfEnder, 'C', UniversalRecipe.BATTERY.get(), 'G', UniversalRecipe.SECONDARY_METAL.get()));
|
|
||||||
|
|
||||||
/** Tesla - by Jyzarc */
|
/** Tesla - by Jyzarc */
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(blockTesla, "WEW", " C ", " I ", 'W', defaultWire, 'E', Item.eyeOfEnder, 'C', UniversalRecipe.BATTERY.get(), 'I', UniversalRecipe.PRIMARY_PLATE.get()));
|
GameRegistry.addRecipe(new ShapedOreRecipe(blockTesla, "WEW", " C ", " I ", 'W', defaultWire, 'E', Item.eyeOfEnder, 'C', UniversalRecipe.BATTERY.get(), 'I', UniversalRecipe.PRIMARY_PLATE.get()));
|
||||||
|
|
||||||
|
|
19
src/main/java/resonantinduction/transport/ILinkable.java
Normal file
19
src/main/java/resonantinduction/transport/ILinkable.java
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package resonantinduction.transport;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import universalelectricity.api.vector.VectorWorld;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Calclavia
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ILinkable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* @param vector
|
||||||
|
* @return True to clear the link.
|
||||||
|
*/
|
||||||
|
public boolean onLink(EntityPlayer player, VectorWorld vector);
|
||||||
|
}
|
81
src/main/java/resonantinduction/transport/LinkEvent.java
Normal file
81
src/main/java/resonantinduction/transport/LinkEvent.java
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package resonantinduction.transport;
|
||||||
|
|
||||||
|
import codechicken.multipart.ControlKeyModifer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.event.Event.Result;
|
||||||
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
|
import universalelectricity.api.vector.VectorWorld;
|
||||||
|
import calclavia.components.event.MultitoolEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Calclavia
|
||||||
|
*/
|
||||||
|
public class LinkEvent
|
||||||
|
{
|
||||||
|
@ForgeSubscribe
|
||||||
|
public void linkEvent(MultitoolEvent evt)
|
||||||
|
{
|
||||||
|
if (ControlKeyModifer.isControlDown(evt.player))
|
||||||
|
{
|
||||||
|
TileEntity tile = evt.world.getBlockTileEntity(evt.x, evt.y, evt.z);
|
||||||
|
|
||||||
|
if (tile instanceof ILinkable && this.hasLink(evt.toolStack))
|
||||||
|
{
|
||||||
|
if (!evt.world.isRemote)
|
||||||
|
{
|
||||||
|
if (((ILinkable) tile).onLink(evt.player, this.getLink(evt.toolStack)))
|
||||||
|
{
|
||||||
|
this.clearLink(evt.toolStack);
|
||||||
|
evt.player.addChatMessage("Link cleared.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evt.setResult(Result.DENY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!evt.world.isRemote)
|
||||||
|
{
|
||||||
|
evt.player.addChatMessage("Set link to block [" + evt.x + ", " + evt.y + ", " + evt.z + "], Dimension: '" + evt.world.provider.getDimensionName() + "'");
|
||||||
|
this.setLink(evt.toolStack, new VectorWorld(evt.world, evt.x, evt.y, evt.z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
evt.setCanceled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasLink(ItemStack itemStack)
|
||||||
|
{
|
||||||
|
return getLink(itemStack) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VectorWorld getLink(ItemStack itemStack)
|
||||||
|
{
|
||||||
|
if (itemStack.stackTagCompound == null || !itemStack.getTagCompound().hasKey("link"))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new VectorWorld(itemStack.getTagCompound().getCompoundTag("link"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLink(ItemStack itemStack, VectorWorld vec)
|
||||||
|
{
|
||||||
|
if (itemStack.getTagCompound() == null)
|
||||||
|
{
|
||||||
|
itemStack.setTagCompound(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
|
itemStack.getTagCompound().setCompoundTag("link", vec.writeToNBT(new NBTTagCompound()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearLink(ItemStack itemStack)
|
||||||
|
{
|
||||||
|
itemStack.getTagCompound().removeTag("link");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package resonantinduction.transport.levitator;
|
package resonantinduction.transport.levitator;
|
||||||
|
|
||||||
import calclavia.lib.prefab.item.ItemCoordLink;
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
@ -11,7 +10,6 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.core.base.BlockBase;
|
import resonantinduction.core.base.BlockBase;
|
||||||
import resonantinduction.core.render.BlockRenderingHandler;
|
import resonantinduction.core.render.BlockRenderingHandler;
|
||||||
import universalelectricity.api.vector.Vector3;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -19,7 +17,7 @@ public class BlockLevitator extends BlockBase implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
public BlockLevitator(int id)
|
public BlockLevitator(int id)
|
||||||
{
|
{
|
||||||
super("contractor", id);
|
super("levitator", id);
|
||||||
this.setTextureName(ResonantInduction.PREFIX + "machine");
|
this.setTextureName(ResonantInduction.PREFIX + "machine");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,59 +29,42 @@ public class BlockLevitator extends BlockBase implements ITileEntityProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
||||||
{
|
{
|
||||||
TileEMLevitator contractor = (TileEMLevitator) world.getBlockTileEntity(par2, par3, par4);
|
TileEMLevitator levitator = (TileEMLevitator) world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
if (entityPlayer.getCurrentEquippedItem() != null)
|
if (entityPlayer.getCurrentEquippedItem() != null)
|
||||||
{
|
{
|
||||||
if (entityPlayer.getCurrentEquippedItem().itemID == Item.dyePowder.itemID)
|
if (entityPlayer.getCurrentEquippedItem().itemID == Item.dyePowder.itemID)
|
||||||
{
|
{
|
||||||
contractor.setDye(entityPlayer.getCurrentEquippedItem().getItemDamage());
|
levitator.setDye(entityPlayer.getCurrentEquippedItem().getItemDamage());
|
||||||
|
|
||||||
if (!entityPlayer.capabilities.isCreativeMode)
|
if (!entityPlayer.capabilities.isCreativeMode)
|
||||||
{
|
{
|
||||||
entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1);
|
entityPlayer.inventory.decrStackSize(entityPlayer.inventory.currentItem, 1);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemCoordLink)
|
|
||||||
{
|
|
||||||
ItemCoordLink link = ((ItemCoordLink) entityPlayer.getCurrentEquippedItem().getItem());
|
|
||||||
Vector3 linkVec = link.getLink(entityPlayer.getCurrentEquippedItem());
|
|
||||||
|
|
||||||
if (linkVec != null)
|
|
||||||
{
|
|
||||||
if (linkVec.getTileEntity(world) instanceof TileEMLevitator)
|
|
||||||
{
|
|
||||||
contractor.setLink((TileEMLevitator) linkVec.getTileEntity(world), true);
|
|
||||||
|
|
||||||
if (world.isRemote)
|
|
||||||
{
|
|
||||||
entityPlayer.addChatMessage("Linked " + this.getLocalizedName() + " with " + " [" + (int) linkVec.x + ", " + (int) linkVec.y + ", " + (int) linkVec.z + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
link.clearLink(entityPlayer.getCurrentEquippedItem());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
levitator.suck = !levitator.suck;
|
||||||
|
levitator.updatePath();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||||
|
{
|
||||||
if (!entityPlayer.isSneaking())
|
if (!entityPlayer.isSneaking())
|
||||||
{
|
{
|
||||||
contractor.incrementFacing();
|
TileEMLevitator levitator = (TileEMLevitator) world.getBlockTileEntity(x, y, z);
|
||||||
}
|
levitator.incrementFacing();
|
||||||
else
|
return true;
|
||||||
{
|
|
||||||
contractor.suck = !contractor.suck;
|
|
||||||
contractor.updatePath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package resonantinduction.transport.levitator;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import resonantinduction.ResonantInduction;
|
|
||||||
import resonantinduction.TabRI;
|
|
||||||
import universalelectricity.api.vector.VectorWorld;
|
|
||||||
import calclavia.lib.prefab.item.ItemCoordLink;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Calclavia
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ItemLinker extends ItemCoordLink
|
|
||||||
{
|
|
||||||
public ItemLinker(int id)
|
|
||||||
{
|
|
||||||
super(id, "linker", ResonantInduction.CONFIGURATION, ResonantInduction.PREFIX, TabRI.INSTANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@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)
|
|
||||||
{
|
|
||||||
player.addChatMessage("Set link to block [" + x + ", " + y + ", " + z + "], Dimension: '" + world.getWorldInfo().getWorldName() + "'");
|
|
||||||
this.setLink(stack, new VectorWorld(world, x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,10 +22,13 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.IFluidBlock;
|
import net.minecraftforge.fluids.IFluidBlock;
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
|
import resonantinduction.transport.ILinkable;
|
||||||
import resonantinduction.transport.tesla.TileTesla;
|
import resonantinduction.transport.tesla.TileTesla;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
|
import universalelectricity.api.vector.VectorWorld;
|
||||||
import calclavia.lib.network.IPacketReceiver;
|
import calclavia.lib.network.IPacketReceiver;
|
||||||
import calclavia.lib.network.IPacketSender;
|
import calclavia.lib.network.IPacketSender;
|
||||||
|
import calclavia.lib.prefab.item.ItemCoordLink;
|
||||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||||
import calclavia.lib.utility.InventoryUtility;
|
import calclavia.lib.utility.InventoryUtility;
|
||||||
|
|
||||||
|
@ -36,7 +39,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IPacketSender
|
public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IPacketSender, ILinkable
|
||||||
{
|
{
|
||||||
public static int MAX_REACH = 40;
|
public static int MAX_REACH = 40;
|
||||||
public static int PUSH_DELAY = 5;
|
public static int PUSH_DELAY = 5;
|
||||||
|
@ -597,4 +600,25 @@ public class TileEMLevitator extends TileAdvanced implements IPacketReceiver, IP
|
||||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onLink(EntityPlayer player, VectorWorld vector)
|
||||||
|
{
|
||||||
|
if (vector != null)
|
||||||
|
{
|
||||||
|
if (vector.getTileEntity(this.worldObj) instanceof TileEMLevitator)
|
||||||
|
{
|
||||||
|
this.setLink((TileEMLevitator) vector.getTileEntity(this.worldObj), true);
|
||||||
|
|
||||||
|
if (this.worldObj.isRemote)
|
||||||
|
{
|
||||||
|
player.addChatMessage("Linked " + this.getBlockType().getLocalizedName() + " with " + " [" + (int) vector.x + ", " + (int) vector.y + ", " + (int) vector.z + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.Utility;
|
import resonantinduction.Utility;
|
||||||
import resonantinduction.core.base.BlockIOBase;
|
import resonantinduction.core.base.BlockIOBase;
|
||||||
import resonantinduction.core.render.BlockRenderingHandler;
|
import resonantinduction.core.render.BlockRenderingHandler;
|
||||||
|
import resonantinduction.transport.levitator.TileEMLevitator;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
import universalelectricity.api.vector.VectorWorld;
|
import universalelectricity.api.vector.VectorWorld;
|
||||||
import calclavia.lib.prefab.item.ItemCoordLink;
|
import calclavia.lib.prefab.item.ItemCoordLink;
|
||||||
|
@ -40,7 +41,7 @@ public class BlockTesla extends BlockIOBase implements ITileEntityProvider
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
TileEntity t = world.getBlockTileEntity(x, y, z);
|
TileEntity t = world.getBlockTileEntity(x, y, z);
|
||||||
TileTesla tileEntity = ((TileTesla) t).getControllingTelsa();
|
TileTesla tileEntity = ((TileTesla) t).getControllingTelsa();
|
||||||
|
@ -76,45 +77,6 @@ public class BlockTesla extends BlockIOBase implements ITileEntityProvider
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemCoordLink)
|
|
||||||
{
|
|
||||||
if (tileEntity.linked == null)
|
|
||||||
{
|
|
||||||
ItemCoordLink link = ((ItemCoordLink) entityPlayer.getCurrentEquippedItem().getItem());
|
|
||||||
VectorWorld linkVec = link.getLink(entityPlayer.getCurrentEquippedItem());
|
|
||||||
|
|
||||||
if (linkVec != null)
|
|
||||||
{
|
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
World otherWorld = linkVec.world;
|
|
||||||
|
|
||||||
if (linkVec.getTileEntity(otherWorld) instanceof TileTesla)
|
|
||||||
{
|
|
||||||
tileEntity.setLink(new Vector3(((TileTesla) linkVec.getTileEntity(otherWorld)).getTopTelsa()), linkVec.world.provider.dimensionId, true);
|
|
||||||
|
|
||||||
entityPlayer.addChatMessage(LanguageUtility.getLocal("message.tesla.pair").replace("%v0", this.getLocalizedName()).replace("%v1", linkVec.x + "").replace("%v2", linkVec.y + "").replace("%v3", linkVec.z + ""));
|
|
||||||
|
|
||||||
link.clearLink(entityPlayer.getCurrentEquippedItem());
|
|
||||||
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "ambient.weather.thunder", 5, 1);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tileEntity.setLink(null, world.provider.dimensionId, true);
|
|
||||||
|
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
entityPlayer.addChatMessage("Unlinked Tesla.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -124,11 +86,12 @@ public class BlockTesla extends BlockIOBase implements ITileEntityProvider
|
||||||
{
|
{
|
||||||
entityPlayer.addChatMessage(LanguageUtility.getLocal("message.tesla.mode").replace("%v", receiveMode + ""));
|
entityPlayer.addChatMessage(LanguageUtility.getLocal("message.tesla.mode").replace("%v", receiveMode + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onBlockActivated(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -21,12 +21,15 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import resonantinduction.ResonantInduction;
|
import resonantinduction.ResonantInduction;
|
||||||
import resonantinduction.api.ITesla;
|
import resonantinduction.api.ITesla;
|
||||||
|
import resonantinduction.transport.ILinkable;
|
||||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
|
import universalelectricity.api.vector.VectorWorld;
|
||||||
import calclavia.lib.CustomDamageSource;
|
import calclavia.lib.CustomDamageSource;
|
||||||
import calclavia.lib.network.IPacketReceiver;
|
import calclavia.lib.network.IPacketReceiver;
|
||||||
import calclavia.lib.network.IPacketSender;
|
import calclavia.lib.network.IPacketSender;
|
||||||
import calclavia.lib.prefab.tile.TileElectrical;
|
import calclavia.lib.prefab.tile.TileElectrical;
|
||||||
|
import calclavia.lib.utility.LanguageUtility;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
|
@ -40,7 +43,7 @@ import cpw.mods.fml.common.network.PacketDispatcher;
|
||||||
* @author Calclavia
|
* @author Calclavia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TileTesla extends TileElectrical implements ITesla, IPacketSender, IPacketReceiver
|
public class TileTesla extends TileElectrical implements ITesla, IPacketSender, IPacketReceiver, ILinkable
|
||||||
{
|
{
|
||||||
public final static int DEFAULT_COLOR = 12;
|
public final static int DEFAULT_COLOR = 12;
|
||||||
public final long TRANSFER_CAP = 10000;
|
public final long TRANSFER_CAP = 10000;
|
||||||
|
@ -610,4 +613,38 @@ public class TileTesla extends TileElectrical implements ITesla, IPacketSender,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onLink(EntityPlayer player, VectorWorld vector)
|
||||||
|
{
|
||||||
|
if (linked == null)
|
||||||
|
{
|
||||||
|
if (vector != null)
|
||||||
|
{
|
||||||
|
if (!worldObj.isRemote)
|
||||||
|
{
|
||||||
|
World otherWorld = vector.world;
|
||||||
|
|
||||||
|
if (vector.getTileEntity(otherWorld) instanceof TileTesla)
|
||||||
|
{
|
||||||
|
this.setLink(new Vector3(((TileTesla) vector.getTileEntity(otherWorld)).getTopTelsa()), vector.world.provider.dimensionId, true);
|
||||||
|
player.addChatMessage(LanguageUtility.getLocal("message.tesla.pair").replace("%v0", this.getBlockType().getLocalizedName()).replace("%v1", vector.x + "").replace("%v2", vector.y + "").replace("%v3", vector.z + ""));
|
||||||
|
worldObj.playSoundEffect(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5, "ambient.weather.thunder", 5, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.setLink(null, worldObj.provider.dimensionId, true);
|
||||||
|
|
||||||
|
if (!worldObj.isRemote)
|
||||||
|
{
|
||||||
|
player.addChatMessage("Unlinked Tesla.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ fluid.mixture=Mixture
|
||||||
|
|
||||||
## Blocks
|
## Blocks
|
||||||
tile.resonantinduction\:tesla.name=Tesla Coil
|
tile.resonantinduction\:tesla.name=Tesla Coil
|
||||||
tile.resonantinduction\:contractor.name=Electromagnetic Levitator
|
tile.resonantinduction\:levitator.name=Electromagnetic Levitator
|
||||||
tile.resonantinduction\:battery.name=Battery
|
tile.resonantinduction\:battery.name=Battery
|
||||||
tile.resonantinduction\:machinePart.name=Machine Part
|
tile.resonantinduction\:machinePart.name=Machine Part
|
||||||
tile.resonantinduction\:grindingWheel.name=Grinder Wheel
|
tile.resonantinduction\:grindingWheel.name=Grinder Wheel
|
||||||
|
|
Loading…
Reference in a new issue