Assembly Line 0.1.8. Release
This commit is contained in:
parent
b32bf79fd3
commit
8988452c85
18 changed files with 329 additions and 76 deletions
|
@ -1 +1 @@
|
|||
28
|
||||
29
|
||||
|
|
1
info.txt
1
info.txt
|
@ -23,3 +23,4 @@ x AssemblyLine_v0.1.6.23.jar AssemblyLine_v0.1.6.23_api.zip
|
|||
* AssemblyLine_v0.1.7.26.jar AssemblyLine_v0.1.7.26_api.zip
|
||||
* AssemblyLine_v0.1.7.27.jar AssemblyLine_v0.1.7.27_api.zip
|
||||
@ AssemblyLine_v0.1.8.28.jar AssemblyLine_v0.1.8.28_api.zip
|
||||
* AssemblyLine_v0.1.8.29.jar AssemblyLine_v0.1.8.29_api.zip
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.1.7
|
||||
0.1.8
|
||||
|
|
|
@ -52,15 +52,15 @@ public class TileEntityManipulator extends TileEntityAssemblyNetwork implements
|
|||
* Find items going into the manipulator and input them into an inventory behind
|
||||
* this manipulator.
|
||||
*/
|
||||
Vector3 inputPosition = Vector3.get(this);
|
||||
Vector3 inputPosition = new Vector3(this);
|
||||
|
||||
Vector3 outputUp = Vector3.get(this);
|
||||
Vector3 outputUp = new Vector3(this);
|
||||
outputUp.modifyPositionFromSide(ForgeDirection.UP);
|
||||
|
||||
Vector3 outputDown = Vector3.get(this);
|
||||
Vector3 outputDown = new Vector3(this);
|
||||
outputDown.modifyPositionFromSide(ForgeDirection.DOWN);
|
||||
|
||||
Vector3 outputPosition = Vector3.get(this);
|
||||
Vector3 outputPosition = new Vector3(this);
|
||||
outputPosition.modifyPositionFromSide(this.getBeltDirection().getOpposite());
|
||||
|
||||
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(inputPosition.x, inputPosition.y, inputPosition.z, inputPosition.x + 1, inputPosition.y + 1, inputPosition.z + 1);
|
||||
|
@ -101,16 +101,16 @@ public class TileEntityManipulator extends TileEntityAssemblyNetwork implements
|
|||
{
|
||||
this.onPowerOff();
|
||||
|
||||
Vector3 inputUp = Vector3.get(this);
|
||||
Vector3 inputUp = new Vector3(this);
|
||||
inputUp.modifyPositionFromSide(ForgeDirection.UP);
|
||||
|
||||
Vector3 inputDown = Vector3.get(this);
|
||||
Vector3 inputDown = new Vector3(this);
|
||||
inputDown.modifyPositionFromSide(ForgeDirection.DOWN);
|
||||
|
||||
Vector3 inputPosition = Vector3.get(this);
|
||||
Vector3 inputPosition = new Vector3(this);
|
||||
inputPosition.modifyPositionFromSide(this.getBeltDirection().getOpposite());
|
||||
|
||||
Vector3 outputPosition = Vector3.get(this);
|
||||
Vector3 outputPosition = new Vector3(this);
|
||||
outputPosition.modifyPositionFromSide(this.getBeltDirection());
|
||||
|
||||
ItemStack itemStack = this.tryGrabFromPosition(inputUp, ForgeDirection.DOWN);
|
||||
|
|
|
@ -229,7 +229,7 @@ public class TileEntityRejector extends TileEntityAssemblyNetwork implements IPa
|
|||
}
|
||||
else
|
||||
{
|
||||
PacketManager.sendPacketToClients(packet, worldObj, Vector3.get(this), 10);
|
||||
PacketManager.sendPacketToClients(packet, worldObj, new Vector3(this), 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public class TileEntityCraftingArm extends TileEntityElectricityReceiver impleme
|
|||
|
||||
if (inputDirection != ForgeDirection.UP)
|
||||
{
|
||||
TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, Vector3.get(this), inputDirection);
|
||||
TileEntity inputTile = Vector3.getTileEntityFromSide(this.worldObj, new Vector3(this), inputDirection);
|
||||
|
||||
if (inputTile != null)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,8 @@ public class UELoader
|
|||
Electricity.instance = new Electricity();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
UniversalElectricity.isVoltageSensitive = UniversalElectricity.CONFIGURATION.get("Compatiblity", "Is Voltage Sensitive", UniversalElectricity.isVoltageSensitive).getBoolean(UniversalElectricity.isVoltageSensitive);
|
||||
|
||||
UniversalElectricity.IC2_RATIO = UniversalElectricity.CONFIGURATION.get("Compatiblity", "IndustrialCraft Conversion Ratio", UniversalElectricity.IC2_RATIO).getDouble(UniversalElectricity.IC2_RATIO);
|
||||
UniversalElectricity.BC3_RATIO = UniversalElectricity.CONFIGURATION.get("Compatiblity", "BuildCraft Conversion Ratio", UniversalElectricity.BC3_RATIO).getDouble(UniversalElectricity.BC3_RATIO);
|
||||
UniversalElectricity.TO_IC2_RATIO = 1 / UniversalElectricity.IC2_RATIO;
|
||||
|
|
|
@ -49,6 +49,8 @@ public class UniversalElectricity
|
|||
public static double TO_IC2_RATIO = 1 / IC2_RATIO;
|
||||
public static double TO_BC_RATIO = 1 / BC3_RATIO;
|
||||
|
||||
public static boolean isVoltageSensitive = false;
|
||||
|
||||
/**
|
||||
* Use this material for all your machine blocks. It can be breakable by hand.
|
||||
*/
|
||||
|
|
|
@ -78,25 +78,36 @@ public class Electricity
|
|||
*/
|
||||
public void splitConnection(IConductor conductorA, IConductor conductorB)
|
||||
{
|
||||
ElectricityNetwork network = conductorA.getNetwork();
|
||||
|
||||
if (network != null)
|
||||
try
|
||||
{
|
||||
network.cleanConductors();
|
||||
network.resetConductors();
|
||||
ElectricityNetwork network = conductorA.getNetwork();
|
||||
|
||||
for (IConductor conductor : network.conductors)
|
||||
if (network != null)
|
||||
{
|
||||
for (byte i = 0; i < 6; i++)
|
||||
network.cleanConductors();
|
||||
network.resetConductors();
|
||||
|
||||
Iterator it = network.conductors.iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
conductor.updateConnectionWithoutSplit(Vector3.getConnectorFromSide(((TileEntity) conductor).worldObj, new Vector3((TileEntity) conductor), ForgeDirection.getOrientation(i)), ForgeDirection.getOrientation(i));
|
||||
IConductor conductor = (IConductor) it.next();
|
||||
|
||||
for (byte i = 0; i < 6; i++)
|
||||
{
|
||||
conductor.updateConnectionWithoutSplit(Vector3.getConnectorFromSide(((TileEntity) conductor).worldObj, new Vector3((TileEntity) conductor), ForgeDirection.getOrientation(i)), ForgeDirection.getOrientation(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
FMLLog.severe("Conductor invalid network while splitting connection!");
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
FMLLog.severe("Conductor invalid network while splitting connection!");
|
||||
FMLLog.severe("Failed to split wire connection!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +122,7 @@ public class Electricity
|
|||
|
||||
while (it.hasNext())
|
||||
{
|
||||
ElectricityNetwork network = ((ElectricityNetwork) it.next());
|
||||
ElectricityNetwork network = (ElectricityNetwork) it.next();
|
||||
network.cleanConductors();
|
||||
|
||||
if (network.conductors.size() == 0)
|
||||
|
|
|
@ -120,8 +120,11 @@ public class ElectricityNetwork
|
|||
|
||||
if (pairs.getKey() != null && pairs.getValue() != null && pack != null)
|
||||
{
|
||||
totalElectricity.amperes += pack.amperes;
|
||||
totalElectricity.voltage = Math.max(totalElectricity.voltage, pack.voltage);
|
||||
double newWatts = totalElectricity.getWatts() + pack.getWatts();
|
||||
double newVoltage = Math.max(totalElectricity.voltage, pack.voltage);
|
||||
|
||||
totalElectricity.amperes = newWatts / newVoltage;
|
||||
totalElectricity.voltage = newVoltage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -208,8 +211,8 @@ public class ElectricityNetwork
|
|||
totalElectricity.amperes *= (tileRequest.amperes / totalRequest.amperes);
|
||||
|
||||
int distance = this.conductors.size();
|
||||
double ampsReceived = totalElectricity.amperes - (totalElectricity.amperes * totalElectricity.amperes * this.getResistance() * distance) / totalElectricity.voltage;
|
||||
double voltsReceived = totalElectricity.voltage - (totalElectricity.amperes * this.getResistance() * distance);
|
||||
double ampsReceived = totalElectricity.amperes - (totalElectricity.amperes * totalElectricity.amperes * this.getTotalResistance()) / totalElectricity.voltage;
|
||||
double voltsReceived = totalElectricity.voltage - (totalElectricity.amperes * this.getTotalResistance());
|
||||
|
||||
totalElectricity.amperes = ampsReceived;
|
||||
totalElectricity.voltage = voltsReceived;
|
||||
|
@ -320,15 +323,15 @@ public class ElectricityNetwork
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the resistance of this electrical network.
|
||||
* Gets the total amount of resistance of this electrical network. In Ohms.
|
||||
*/
|
||||
public double getResistance()
|
||||
public double getTotalResistance()
|
||||
{
|
||||
double resistance = 0;
|
||||
|
||||
for (int i = 0; i < conductors.size(); i++)
|
||||
{
|
||||
resistance = Math.max(resistance, conductors.get(i).getResistance());
|
||||
resistance += conductors.get(i).getResistance();
|
||||
}
|
||||
|
||||
return resistance;
|
||||
|
|
|
@ -113,36 +113,6 @@ public class Vector3 extends Vector2 implements Cloneable
|
|||
return new Vector3(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Vector3 get(Entity par1)
|
||||
{
|
||||
return new Vector3(par1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Vector3 get(TileEntity par1)
|
||||
{
|
||||
return new Vector3(par1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Vector3 get(Vec3 par1)
|
||||
{
|
||||
return new Vector3(par1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Vector3 get(MovingObjectPosition par1)
|
||||
{
|
||||
return new Vector3(par1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Vector3 get(ChunkCoordinates par1)
|
||||
{
|
||||
return new Vector3(par1);
|
||||
}
|
||||
|
||||
public int getBlockID(IBlockAccess world)
|
||||
{
|
||||
return world.getBlockId(this.intX(), this.intY(), this.intZ());
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.implement.IItemElectric;
|
||||
import universalelectricity.prefab.implement.ISneakUseWrench;
|
||||
import universalelectricity.prefab.implement.IToolConfigurator;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +21,7 @@ import universalelectricity.prefab.implement.IToolConfigurator;
|
|||
* block if you do not want to. It's optional but it comes with some useful functions that will make
|
||||
* coding easier for you.
|
||||
*/
|
||||
public abstract class BlockMachine extends BlockContainer
|
||||
public abstract class BlockMachine extends BlockContainer implements ISneakUseWrench
|
||||
{
|
||||
public BlockMachine(int id, Material material)
|
||||
{
|
||||
|
@ -89,14 +90,7 @@ public abstract class BlockMachine extends BlockContainer
|
|||
world.notifyBlocksOfNeighborChange(x, y, z, this.blockID);
|
||||
((IToolConfigurator) par5EntityPlayer.inventory.getCurrentItem().getItem()).wrenchUsed(par5EntityPlayer, x, y, z);
|
||||
|
||||
if (par5EntityPlayer.isSneaking())
|
||||
{
|
||||
return this.onSneakUseWrench(world, x, y, z, par5EntityPlayer, side, hitX, hitY, hitZ);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.onUseWrench(world, x, y, z, par5EntityPlayer, side, hitX, hitY, hitZ);
|
||||
}
|
||||
return this.onUseWrench(world, x, y, z, par5EntityPlayer, side, hitX, hitY, hitZ);
|
||||
}
|
||||
else if (par5EntityPlayer.inventory.getCurrentItem().getItem() instanceof IItemElectric)
|
||||
{
|
||||
|
@ -124,11 +118,7 @@ public abstract class BlockMachine extends BlockContainer
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the machine is right clicked by the player while sneaking (shift clicking)
|
||||
*
|
||||
* @return True if something happens
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean onSneakMachineActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return false;
|
||||
|
@ -159,6 +149,7 @@ public abstract class BlockMachine extends BlockContainer
|
|||
*
|
||||
* @return True if some happens
|
||||
*/
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
return this.onUseWrench(par1World, x, y, z, par5EntityPlayer, side, hitX, hitY, hitZ);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class UpdateNotifier implements IPlayerTracker
|
|||
|
||||
if (latestUpdate != null && latestUpdate != "" && !currentVersion.trim().equals(latestUpdate.trim()))
|
||||
{
|
||||
modsToUpdate.put(modName, latestUpdate);
|
||||
modsToUpdate.put(modName, latestUpdate.trim());
|
||||
}
|
||||
|
||||
return latestUpdate;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package universalelectricity.prefab.implement;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ISneakUseWrench
|
||||
{
|
||||
public boolean onSneakUseWrench(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ);
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package universalelectricity.prefab.multiblock;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.UniversalElectricity;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
public class BlockMulti extends BlockContainer
|
||||
{
|
||||
public BlockMulti(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
this.setHardness(0.8F);
|
||||
this.setBlockName("MultiBlock");
|
||||
}
|
||||
|
||||
public void makeFakeBlock(World worldObj, Vector3 position, Vector3 mainBlock)
|
||||
{
|
||||
worldObj.setBlockWithNotify(position.intX(), position.intY(), position.intZ(), this.blockID);
|
||||
((TileEntityMulti) worldObj.getBlockTileEntity(position.intX(), position.intY(), position.intZ())).setMainBlock(mainBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int x, int y, int z, int par5, int par6)
|
||||
{
|
||||
TileEntityMulti tileEntity = (TileEntityMulti) par1World.getBlockTileEntity(x, y, z);
|
||||
tileEntity.onBlockRemoval();
|
||||
super.breakBlock(par1World, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the block is right clicked by the player. This modified version detects electric
|
||||
* items and wrench actions on your machine block. Do not override this function. Use
|
||||
* machineActivated instead! (It does the same thing)
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
TileEntityMulti tileEntity = (TileEntityMulti) par1World.getBlockTileEntity(x, y, z);
|
||||
return tileEntity.onBlockActivated(par1World, x, y, z, par5EntityPlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileEntityMulti();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World par1World, int x, int y, int z)
|
||||
{
|
||||
TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z);
|
||||
Vector3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition;
|
||||
|
||||
if (mainBlockPosition != null)
|
||||
{
|
||||
int mainBlockID = par1World.getBlockId(mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ());
|
||||
|
||||
if (mainBlockID > 0) { return Block.blocksList[mainBlockID].getPickBlock(target, par1World, mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ()); }
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package universalelectricity.prefab.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/**
|
||||
* A general interface to be implemented by anything that needs it.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public interface IBlockActivate
|
||||
{
|
||||
/**
|
||||
* Called when activated
|
||||
*/
|
||||
public boolean onActivated(EntityPlayer entityPlayer);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package universalelectricity.prefab.multiblock;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
|
||||
/**
|
||||
* Interface to be applied to tile entity blocks that occupies more than one block space. Useful for
|
||||
* large machines.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public interface IMultiBlock extends IBlockActivate
|
||||
{
|
||||
/**
|
||||
* Called when this multiblock is created
|
||||
*
|
||||
* @param placedPosition - The position the block was placed at
|
||||
*/
|
||||
public void onCreate(Vector3 placedPosition);
|
||||
|
||||
/**
|
||||
* Called when one of the multiblocks of this block is destroyed
|
||||
*
|
||||
* @param callingBlock - The tile entity who called the onDestroy function
|
||||
*/
|
||||
public void onDestroy(TileEntity callingBlock);
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package universalelectricity.prefab.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import universalelectricity.core.vector.Vector3;
|
||||
import universalelectricity.prefab.network.IPacketReceiver;
|
||||
import universalelectricity.prefab.network.PacketManager;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
/**
|
||||
* This is a multiblock to be used for blocks that are bigger than one block.
|
||||
*
|
||||
* @author Calclavia
|
||||
*
|
||||
*/
|
||||
public class TileEntityMulti extends TileEntity implements IPacketReceiver
|
||||
{
|
||||
// The the position of the main block
|
||||
public Vector3 mainBlockPosition;
|
||||
|
||||
public void setMainBlock(Vector3 mainBlock)
|
||||
{
|
||||
this.mainBlockPosition = mainBlock;
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
PacketManager.sendPacketToClients(this.getDescriptionPacket());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
if (this.mainBlockPosition != null) { return PacketManager.getPacket("BasicComponents", this, this.mainBlockPosition.x, this.mainBlockPosition.y, this.mainBlockPosition.z); }
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onBlockRemoval()
|
||||
{
|
||||
if (mainBlockPosition != null)
|
||||
{
|
||||
TileEntity tileEntity = this.worldObj.getBlockTileEntity((int) mainBlockPosition.x, (int) mainBlockPosition.y, (int) mainBlockPosition.z);
|
||||
|
||||
if (tileEntity != null && tileEntity instanceof IMultiBlock)
|
||||
{
|
||||
IMultiBlock mainBlock = (IMultiBlock) tileEntity;
|
||||
|
||||
if (mainBlock != null)
|
||||
{
|
||||
mainBlock.onDestroy(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer)
|
||||
{
|
||||
if (mainBlockPosition != null)
|
||||
{
|
||||
TileEntity tileEntity = this.worldObj.getBlockTileEntity((int) mainBlockPosition.x, (int) mainBlockPosition.y, (int) mainBlockPosition.z);
|
||||
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (tileEntity instanceof IMultiBlock) { return ((IMultiBlock) tileEntity).onActivated(par5EntityPlayer); }
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a tile entity from NBT.
|
||||
*/
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
this.mainBlockPosition = Vector3.readFromNBT("mainBlockPosition", par1NBTTagCompound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a tile entity to NBT.
|
||||
*/
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
|
||||
{
|
||||
super.writeToNBT(par1NBTTagCompound);
|
||||
|
||||
this.mainBlockPosition.writeToNBT("mainBlockPosition", par1NBTTagCompound);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this TileEntity requires update calls.
|
||||
*
|
||||
* @return True if you want updateEntity() to be called, false if not
|
||||
*/
|
||||
public boolean canUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.mainBlockPosition = new Vector3(dataStream.readDouble(), dataStream.readDouble(), dataStream.readDouble());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue