mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-29 18:28:34 +01:00
Cleanuuup~
This commit is contained in:
parent
a6f989f45c
commit
5fa2925d8a
29 changed files with 330 additions and 331 deletions
|
@ -119,6 +119,12 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
|
||||||
|
return rarity == null ? EnumRarity.common : rarity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack){
|
public String getItemStackDisplayName(ItemStack stack){
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
@ -131,11 +137,5 @@ public class BlockInputter extends BlockContainerBase implements IActAddItemOrBl
|
||||||
|
|
||||||
return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ModUtil.MOD_ID_LOWER+".blockInputter.add."+this.toPick+".name")+")";
|
return StringUtil.localize(this.getUnlocalizedName()+".name")+" ("+StringUtil.localize("tile."+ModUtil.MOD_ID_LOWER+".blockInputter.add."+this.toPick+".name")+")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
|
|
||||||
return rarity == null ? EnumRarity.common : rarity;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,6 @@ public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOr
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata){
|
|
||||||
return side;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType(){
|
public int getRenderType(){
|
||||||
return AssetUtil.LASER_RELAY_RENDER_ID;
|
return AssetUtil.LASER_RELAY_RENDER_ID;
|
||||||
|
@ -59,6 +54,11 @@ public class BlockLaserRelay extends BlockContainerBase implements IActAddItemOr
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata){
|
||||||
|
return side;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconReg){
|
public void registerBlockIcons(IIconRegister iconReg){
|
||||||
|
|
|
@ -98,17 +98,6 @@ public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{
|
||||||
this.setMaxDamage(0);
|
this.setMaxDamage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(int damage){
|
|
||||||
return damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
|
|
||||||
return rarity == null ? EnumRarity.common : rarity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIconFromDamage(int meta){
|
public IIcon getIconFromDamage(int meta){
|
||||||
|
@ -119,5 +108,16 @@ public class BlockWildPlant extends BlockBush implements IActAddItemOrBlock{
|
||||||
public String getUnlocalizedName(ItemStack stack){
|
public String getUnlocalizedName(ItemStack stack){
|
||||||
return this.getUnlocalizedName()+(stack.getItemDamage() >= allWildPlants.length ? " ERROR!" : allWildPlants[stack.getItemDamage()].name);
|
return this.getUnlocalizedName()+(stack.getItemDamage() >= allWildPlants.length ? " ERROR!" : allWildPlants[stack.getItemDamage()].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int damage){
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
|
EnumRarity rarity = ((IActAddItemOrBlock)this.field_150939_a).getRarity(stack);
|
||||||
|
return rarity == null ? EnumRarity.common : rarity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,6 +151,12 @@ public class ModelLaserRelay extends ModelBaseAA{
|
||||||
setRotation(energyBall, 0F, 0F, 0F);
|
setRotation(energyBall, 0F, 0F, 0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setRotation(ModelRenderer model, float x, float y, float z){
|
||||||
|
model.rotateAngleX = x;
|
||||||
|
model.rotateAngleY = y;
|
||||||
|
model.rotateAngleZ = z;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float f){
|
public void render(float f){
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
@ -174,6 +180,11 @@ public class ModelLaserRelay extends ModelBaseAA{
|
||||||
covering12.render(f);
|
covering12.render(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName(){
|
||||||
|
return "modelLaserRelay";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderExtra(float f, TileEntity tile){
|
public void renderExtra(float f, TileEntity tile){
|
||||||
TileEntityLaserRelay relay = (TileEntityLaserRelay)tile;
|
TileEntityLaserRelay relay = (TileEntityLaserRelay)tile;
|
||||||
|
@ -188,17 +199,6 @@ public class ModelLaserRelay extends ModelBaseAA{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName(){
|
|
||||||
return "modelLaserRelay";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setRotation(ModelRenderer model, float x, float y, float z){
|
|
||||||
model.rotateAngleX = x;
|
|
||||||
model.rotateAngleY = y;
|
|
||||||
model.rotateAngleZ = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesRotate(){
|
public boolean doesRotate(){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -67,6 +67,18 @@ public class ItemLaserWrench extends Item implements IActAddItemOrBlock{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getShareTag(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
|
||||||
|
if(ItemPhantomConnector.getStoredPosition(stack) == null){
|
||||||
|
ItemPhantomConnector.clearStorage(stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@ -85,18 +97,6 @@ public class ItemLaserWrench extends Item implements IActAddItemOrBlock{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getShareTag(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
|
|
||||||
if(ItemPhantomConnector.getStoredPosition(stack) == null){
|
|
||||||
ItemPhantomConnector.clearStorage(stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
return EnumRarity.epic;
|
return EnumRarity.epic;
|
||||||
|
|
|
@ -76,24 +76,6 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
|
||||||
WorldPos coords = getStoredPosition(stack);
|
|
||||||
if(coords != null){
|
|
||||||
World world = coords.getWorld();
|
|
||||||
if(world != null){
|
|
||||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".boundTo.desc")+":");
|
|
||||||
list.add("X: "+coords.getX());
|
|
||||||
list.add("Y: "+coords.getY());
|
|
||||||
list.add("Z: "+coords.getZ());
|
|
||||||
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".inWorld.desc")+" "+world.provider.dimensionId);
|
|
||||||
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WorldPos getStoredPosition(ItemStack stack){
|
public static WorldPos getStoredPosition(ItemStack stack){
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
if(tag != null){
|
if(tag != null){
|
||||||
|
@ -138,6 +120,24 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
|
||||||
|
WorldPos coords = getStoredPosition(stack);
|
||||||
|
if(coords != null){
|
||||||
|
World world = coords.getWorld();
|
||||||
|
if(world != null){
|
||||||
|
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".boundTo.desc")+":");
|
||||||
|
list.add("X: "+coords.getX());
|
||||||
|
list.add("Y: "+coords.getY());
|
||||||
|
list.add("Z: "+coords.getZ());
|
||||||
|
list.add(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".inWorld.desc")+" "+world.provider.dimensionId);
|
||||||
|
list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
public EnumRarity getRarity(ItemStack stack){
|
||||||
return EnumRarity.epic;
|
return EnumRarity.epic;
|
||||||
|
|
|
@ -66,20 +66,6 @@ public class LaserRelayConnectionHandler{
|
||||||
return network;
|
return network;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a Network for a Relay
|
|
||||||
*/
|
|
||||||
public ArrayList<ConnectionPair> getNetworkFor(WorldPos relay){
|
|
||||||
for(ArrayList<ConnectionPair> aNetwork : this.networks){
|
|
||||||
for(ConnectionPair pair : aNetwork){
|
|
||||||
if(pair.contains(relay)){
|
|
||||||
return aNetwork;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all Connections for a Relay
|
* Gets all Connections for a Relay
|
||||||
*/
|
*/
|
||||||
|
@ -95,6 +81,45 @@ public class LaserRelayConnectionHandler{
|
||||||
return allPairs;
|
return allPairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a Relay from its Network
|
||||||
|
*/
|
||||||
|
public void removeRelayFromNetwork(WorldPos relay){
|
||||||
|
ArrayList<ConnectionPair> network = this.getNetworkFor(relay);
|
||||||
|
if(network != null){
|
||||||
|
//Remove the relay from the network
|
||||||
|
Iterator<ConnectionPair> iterator = network.iterator();
|
||||||
|
while(iterator.hasNext()){
|
||||||
|
ConnectionPair next = iterator.next();
|
||||||
|
if(next.contains(relay)){
|
||||||
|
iterator.remove();
|
||||||
|
//System.out.println("Removed "+relay.toString()+" from Network "+network.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Setup new network (so that splitting a network will cause it to break into two)
|
||||||
|
this.networks.remove(network);
|
||||||
|
for(ConnectionPair pair : network){
|
||||||
|
this.addConnection(pair.firstRelay, pair.secondRelay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WorldData.makeDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a Network for a Relay
|
||||||
|
*/
|
||||||
|
public ArrayList<ConnectionPair> getNetworkFor(WorldPos relay){
|
||||||
|
for(ArrayList<ConnectionPair> aNetwork : this.networks){
|
||||||
|
for(ConnectionPair pair : aNetwork){
|
||||||
|
if(pair.contains(relay)){
|
||||||
|
return aNetwork;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new connection between two relays
|
* Adds a new connection between two relays
|
||||||
* (Puts it into the correct network!)
|
* (Puts it into the correct network!)
|
||||||
|
@ -137,31 +162,6 @@ public class LaserRelayConnectionHandler{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes a Relay from its Network
|
|
||||||
*/
|
|
||||||
public void removeRelayFromNetwork(WorldPos relay){
|
|
||||||
ArrayList<ConnectionPair> network = this.getNetworkFor(relay);
|
|
||||||
if(network != null){
|
|
||||||
//Remove the relay from the network
|
|
||||||
Iterator<ConnectionPair> iterator = network.iterator();
|
|
||||||
while(iterator.hasNext()){
|
|
||||||
ConnectionPair next = iterator.next();
|
|
||||||
if(next.contains(relay)){
|
|
||||||
iterator.remove();
|
|
||||||
//System.out.println("Removed "+relay.toString()+" from Network "+network.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Setup new network (so that splitting a network will cause it to break into two)
|
|
||||||
this.networks.remove(network);
|
|
||||||
for(ConnectionPair pair : network){
|
|
||||||
this.addConnection(pair.firstRelay, pair.secondRelay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WorldData.makeDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges two networks together
|
* Merges two networks together
|
||||||
* (Actually puts everything from the second network into the first one and removes the second one)
|
* (Actually puts everything from the second network into the first one and removes the second one)
|
||||||
|
@ -212,6 +212,18 @@ public class LaserRelayConnectionHandler{
|
||||||
this.secondRelay = secondRelay;
|
this.secondRelay = secondRelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ConnectionPair readFromNBT(NBTTagCompound compound, String name){
|
||||||
|
WorldPos[] pos = new WorldPos[2];
|
||||||
|
for(int i = 0; i < pos.length; i++){
|
||||||
|
World aWorld = DimensionManager.getWorld(compound.getInteger("world"+name+i));
|
||||||
|
int anX = compound.getInteger("x"+name+i);
|
||||||
|
int aY = compound.getInteger("y"+name+i);
|
||||||
|
int aZ = compound.getInteger("z"+name+i);
|
||||||
|
pos[i] = new WorldPos(aWorld, anX, aY, aZ);
|
||||||
|
}
|
||||||
|
return new ConnectionPair(pos[0], pos[1]);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean contains(WorldPos relay){
|
public boolean contains(WorldPos relay){
|
||||||
return (this.firstRelay != null && this.firstRelay.isEqual(relay)) || (this.secondRelay != null && this.secondRelay.isEqual(relay));
|
return (this.firstRelay != null && this.firstRelay.isEqual(relay)) || (this.secondRelay != null && this.secondRelay.isEqual(relay));
|
||||||
}
|
}
|
||||||
|
@ -230,17 +242,5 @@ public class LaserRelayConnectionHandler{
|
||||||
compound.setInteger("z"+name+i, relay.getZ());
|
compound.setInteger("z"+name+i, relay.getZ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConnectionPair readFromNBT(NBTTagCompound compound, String name){
|
|
||||||
WorldPos[] pos = new WorldPos[2];
|
|
||||||
for(int i = 0; i < pos.length; i++){
|
|
||||||
World aWorld = DimensionManager.getWorld(compound.getInteger("world"+name+i));
|
|
||||||
int anX = compound.getInteger("x"+name+i);
|
|
||||||
int aY = compound.getInteger("y"+name+i);
|
|
||||||
int aZ = compound.getInteger("z"+name+i);
|
|
||||||
pos[i] = new WorldPos(aWorld, anX, aY, aZ);
|
|
||||||
}
|
|
||||||
return new ConnectionPair(pos[0], pos[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,35 @@ import java.util.ArrayList;
|
||||||
public class WorldData extends WorldSavedData{
|
public class WorldData extends WorldSavedData{
|
||||||
|
|
||||||
public static final String DATA_TAG = ModUtil.MOD_ID+"WorldData";
|
public static final String DATA_TAG = ModUtil.MOD_ID+"WorldData";
|
||||||
|
public static WorldData instance;
|
||||||
|
|
||||||
public WorldData(String tag){
|
public WorldData(String tag){
|
||||||
super(tag);
|
super(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WorldData instance;
|
public static void makeDirty(){
|
||||||
|
if(instance != null){
|
||||||
|
instance.markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(MinecraftServer server){
|
||||||
|
if(server != null){
|
||||||
|
World world = server.getEntityWorld();
|
||||||
|
if(!world.isRemote){
|
||||||
|
WorldSavedData savedData = world.loadItemData(WorldData.class, WorldData.DATA_TAG);
|
||||||
|
//Generate new SavedData
|
||||||
|
if(savedData == null){
|
||||||
|
savedData = new WorldData(WorldData.DATA_TAG);
|
||||||
|
world.setItemData(WorldData.DATA_TAG, savedData);
|
||||||
|
}
|
||||||
|
//Set the current SavedData to the retreived one
|
||||||
|
if(savedData instanceof WorldData){
|
||||||
|
WorldData.instance = (WorldData)savedData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
|
@ -69,28 +92,4 @@ public class WorldData extends WorldSavedData{
|
||||||
theSave.toNBT(compound, "PlayerSaveData"+i);
|
theSave.toNBT(compound, "PlayerSaveData"+i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void makeDirty(){
|
|
||||||
if(instance != null){
|
|
||||||
instance.markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void init(MinecraftServer server){
|
|
||||||
if(server != null){
|
|
||||||
World world = server.getEntityWorld();
|
|
||||||
if(!world.isRemote){
|
|
||||||
WorldSavedData savedData = world.loadItemData(WorldData.class, WorldData.DATA_TAG);
|
|
||||||
//Generate new SavedData
|
|
||||||
if(savedData == null){
|
|
||||||
savedData = new WorldData(WorldData.DATA_TAG);
|
|
||||||
world.setItemData(WorldData.DATA_TAG, savedData);
|
|
||||||
}
|
|
||||||
//Set the current SavedData to the retreived one
|
|
||||||
if(savedData instanceof WorldData){
|
|
||||||
WorldData.instance = (WorldData)savedData;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,18 +77,18 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.currentTime = compound.getInteger("CurrentTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
compound.setInteger("CurrentTime", this.currentTime);
|
compound.setInteger("CurrentTime", this.currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.currentTime = compound.getInteger("CurrentTime");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return this.isPlacer;
|
return this.isPlacer;
|
||||||
|
|
|
@ -103,14 +103,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
||||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.tank.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||||
|
@ -119,6 +111,14 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.tank.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
||||||
|
|
|
@ -98,14 +98,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
||||||
return this.currentBurnTime*i/this.maxBurnTime;
|
return this.currentBurnTime*i/this.maxBurnTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
|
||||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||||
|
@ -114,6 +106,14 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||||
|
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
||||||
|
|
|
@ -139,15 +139,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
return this.brewTime*i/ConfigIntValues.COFFEE_MACHINE_TIME_USED.getValue();
|
return this.brewTime*i/ConfigIntValues.COFFEE_MACHINE_TIME_USED.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.tank.readFromNBT(compound);
|
|
||||||
this.coffeeCacheAmount = compound.getInteger("Cache");
|
|
||||||
this.brewTime = compound.getInteger("Time");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
@ -157,6 +148,15 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
compound.setInteger("Time", this.brewTime);
|
compound.setInteger("Time", this.brewTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.tank.readFromNBT(compound);
|
||||||
|
this.coffeeCacheAmount = compound.getInteger("Cache");
|
||||||
|
this.brewTime = compound.getInteger("Time");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal());
|
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal());
|
||||||
|
|
|
@ -56,18 +56,18 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.conversionTime = compound.getInteger("ConversionTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.readSyncableNBT(compound, sync);
|
super.readSyncableNBT(compound, sync);
|
||||||
compound.setInteger("ConversionTime", this.conversionTime);
|
compound.setInteger("ConversionTime", this.conversionTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.conversionTime = compound.getInteger("ConversionTime");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit(){
|
public int getInventoryStackLimit(){
|
||||||
return ConfigIntValues.COMPOST_AMOUNT.getValue();
|
return ConfigIntValues.COMPOST_AMOUNT.getValue();
|
||||||
|
|
|
@ -62,18 +62,18 @@ public class TileEntityDropper extends TileEntityInventoryBase{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.currentTime = compound.getInteger("CurrentTime");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
compound.setInteger("CurrentTime", this.currentTime);
|
compound.setInteger("CurrentTime", this.currentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.currentTime = compound.getInteger("CurrentTime");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -53,18 +53,18 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
this.storage.writeToNBT(compound);
|
this.storage.writeToNBT(compound);
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||||
|
|
|
@ -63,18 +63,18 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
this.storage.writeToNBT(compound);
|
this.storage.writeToNBT(compound);
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||||
|
|
|
@ -98,18 +98,18 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
||||||
return this.currentTimer*i/ConfigIntValues.FEEDER_TIME.getValue();
|
return this.currentTimer*i/ConfigIntValues.FEEDER_TIME.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.currentTimer = compound.getInteger("Timer");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
compound.setInteger("Timer", this.currentTimer);
|
compound.setInteger("Timer", this.currentTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.currentTimer = compound.getInteger("Timer");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -129,14 +129,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
|
||||||
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
@ -145,6 +137,14 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
this.storage.writeToNBT(compound);
|
this.storage.writeToNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
||||||
|
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||||
|
|
|
@ -196,14 +196,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
|
||||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||||
|
@ -212,6 +204,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||||
|
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
||||||
|
|
|
@ -68,13 +68,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
||||||
return stack != null && stack.getItem().isRepairable();
|
return stack != null && stack.getItem().isRepairable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||||
|
@ -82,6 +75,13 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
||||||
this.storage.writeToNBT(compound);
|
this.storage.writeToNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == SLOT_INPUT;
|
return i == SLOT_INPUT;
|
||||||
|
|
|
@ -23,11 +23,6 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileEntityLaserRelay extends TileEntityBase implements IEnergyReceiver{
|
public class TileEntityLaserRelay extends TileEntityBase implements IEnergyReceiver{
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canUpdate(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate(){
|
public void invalidate(){
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
|
@ -36,6 +31,11 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUpdate(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket(){
|
public Packet getDescriptionPacket(){
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
|
@ -81,11 +81,6 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canConnectEnergy(ForgeDirection from){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int transmitEnergy(int maxTransmit, boolean simulate){
|
public int transmitEnergy(int maxTransmit, boolean simulate){
|
||||||
int transmitted = 0;
|
int transmitted = 0;
|
||||||
if(maxTransmit > 0){
|
if(maxTransmit > 0){
|
||||||
|
@ -96,4 +91,9 @@ public class TileEntityLaserRelay extends TileEntityBase implements IEnergyRecei
|
||||||
}
|
}
|
||||||
return transmitted;
|
return transmitted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canConnectEnergy(ForgeDirection from){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,14 +101,6 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
||||||
return this.currentBurnTime*i/ConfigIntValues.OIL_GEN_BURN_TIME.getValue();
|
return this.currentBurnTime*i/ConfigIntValues.OIL_GEN_BURN_TIME.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.tank.readFromNBT(compound);
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||||
|
@ -117,6 +109,14 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.tank.readFromNBT(compound);
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
||||||
|
|
|
@ -179,14 +179,6 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
||||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
this.storage.readFromNBT(compound);
|
|
||||||
this.tank.readFromNBT(compound);
|
|
||||||
this.currentWorkTimer = compound.getInteger("CurrentWorkTimer");
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
this.storage.writeToNBT(compound);
|
this.storage.writeToNBT(compound);
|
||||||
|
@ -195,6 +187,14 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
this.storage.readFromNBT(compound);
|
||||||
|
this.tank.readFromNBT(compound);
|
||||||
|
this.currentWorkTimer = compound.getInteger("CurrentWorkTimer");
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, 1)) && i == SLOT_OIL_INPUT;
|
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, 1)) && i == SLOT_OIL_INPUT;
|
||||||
|
|
|
@ -119,6 +119,17 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
return this.range;
|
return this.range;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.writeSyncableNBT(compound, sync);
|
||||||
|
if(this.hasBoundPosition()){
|
||||||
|
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||||
|
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
||||||
|
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
||||||
|
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.readSyncableNBT(compound, sync);
|
super.readSyncableNBT(compound, sync);
|
||||||
|
@ -132,17 +143,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.writeSyncableNBT(compound, sync);
|
|
||||||
if(this.hasBoundPosition()){
|
|
||||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
|
||||||
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
|
||||||
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
|
||||||
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -53,18 +53,18 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
|
||||||
super.readSyncableNBT(compound, sync);
|
|
||||||
this.amount = compound.getShort("Amount");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
super.writeSyncableNBT(compound, sync);
|
super.writeSyncableNBT(compound, sync);
|
||||||
compound.setShort("Amount", this.amount);
|
compound.setShort("Amount", this.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||||
|
super.readSyncableNBT(compound, sync);
|
||||||
|
this.amount = compound.getShort("Amount");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,14 +22,6 @@ public class BlockUtil{
|
||||||
register(block, itemBlock, true);
|
register(block, itemBlock, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register(Block block){
|
|
||||||
register(block, ItemBlockBase.class, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void register(Block block, boolean addTab){
|
|
||||||
register(block, ItemBlockBase.class, addTab);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void register(Block block, Class<? extends ItemBlock> itemBlock, boolean addTab){
|
public static void register(Block block, Class<? extends ItemBlock> itemBlock, boolean addTab){
|
||||||
block.setCreativeTab(addTab ? CreativeTab.instance : null);
|
block.setCreativeTab(addTab ? CreativeTab.instance : null);
|
||||||
block.setBlockName(createUnlocalizedName(block));
|
block.setBlockName(createUnlocalizedName(block));
|
||||||
|
@ -39,4 +31,12 @@ public class BlockUtil{
|
||||||
public static String createUnlocalizedName(Block block){
|
public static String createUnlocalizedName(Block block){
|
||||||
return ModUtil.MOD_ID_LOWER+"."+((IActAddItemOrBlock)block).getName();
|
return ModUtil.MOD_ID_LOWER+"."+((IActAddItemOrBlock)block).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void register(Block block){
|
||||||
|
register(block, ItemBlockBase.class, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register(Block block, boolean addTab){
|
||||||
|
register(block, ItemBlockBase.class, addTab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,14 @@ public class WorldPos{
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlock(){
|
|
||||||
return this.getWorld() != null ? this.getWorld().getBlock(this.x, this.y, this.z) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity getTileEntity(){
|
public TileEntity getTileEntity(){
|
||||||
return this.getWorld() != null ? this.getWorld().getTileEntity(this.x, this.y, this.z) : null;
|
return this.getWorld() != null ? this.getWorld().getTileEntity(this.x, this.y, this.z) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public World getWorld(){
|
||||||
|
return DimensionManager.getWorld(this.worldID);
|
||||||
|
}
|
||||||
|
|
||||||
public Material getMaterial(){
|
public Material getMaterial(){
|
||||||
return this.getWorld() != null ? this.getWorld().getBlock(this.x, this.y, this.z).getMaterial() : null;
|
return this.getWorld() != null ? this.getWorld().getBlock(this.x, this.y, this.z).getMaterial() : null;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,10 @@ public class WorldPos{
|
||||||
return this.getWorld() != null ? Item.getItemFromBlock(this.getBlock()) : null;
|
return this.getWorld() != null ? Item.getItemFromBlock(this.getBlock()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Block getBlock(){
|
||||||
|
return this.getWorld() != null ? this.getWorld().getBlock(this.x, this.y, this.z) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public int getMetadata(){
|
public int getMetadata(){
|
||||||
return this.getWorld() != null ? this.getWorld().getBlockMetadata(this.x, this.y, this.z) : 0;
|
return this.getWorld() != null ? this.getWorld().getBlockMetadata(this.x, this.y, this.z) : 0;
|
||||||
}
|
}
|
||||||
|
@ -55,12 +59,6 @@ public class WorldPos{
|
||||||
return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ() && this.getWorld() == pos.getWorld();
|
return pos != null && this.x == pos.getX() && this.y == pos.getY() && this.z == pos.getZ() && this.getWorld() == pos.getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(){
|
|
||||||
if(this.getWorld() != null){
|
|
||||||
this.getWorld().markBlockForUpdate(this.x, this.y, this.z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getX(){
|
public int getX(){
|
||||||
return this.x;
|
return this.x;
|
||||||
}
|
}
|
||||||
|
@ -73,8 +71,10 @@ public class WorldPos{
|
||||||
return this.z;
|
return this.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld(){
|
public void update(){
|
||||||
return DimensionManager.getWorld(this.worldID);
|
if(this.getWorld() != null){
|
||||||
|
this.getWorld().markBlockForUpdate(this.x, this.y, this.z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldPos copy(){
|
public WorldPos copy(){
|
||||||
|
|
|
@ -42,6 +42,45 @@ public class PersistentClientData{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static NBTTagCompound readCompound(){
|
||||||
|
try{
|
||||||
|
return CompressedStreamTools.readCompressed(new FileInputStream(getTheFile()));
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
return new NBTTagCompound();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getName(String name){
|
||||||
|
return (Minecraft.getMinecraft().isIntegratedServerRunning() ? Minecraft.getMinecraft().getIntegratedServer().getFolderName() : Minecraft.getMinecraft().func_147104_D().serverIP)+"-"+name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void writeCompound(NBTTagCompound compound){
|
||||||
|
try{
|
||||||
|
|
||||||
|
CompressedStreamTools.writeCompressed(compound, new FileOutputStream(getTheFile()));
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
ModUtil.LOGGER.fatal("Couldn't write Persistent Variable!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static File getTheFile(){
|
||||||
|
try{
|
||||||
|
if(!theFile.exists()){
|
||||||
|
theFile.createNewFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
ModUtil.LOGGER.fatal("Couldn't create Persistent Variables file!", e);
|
||||||
|
}
|
||||||
|
return theFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTheFile(File file){
|
||||||
|
theFile = file;
|
||||||
|
}
|
||||||
|
|
||||||
public static void openLastBookPage(GuiBooklet gui){
|
public static void openLastBookPage(GuiBooklet gui){
|
||||||
NBTTagCompound compound = readCompound();
|
NBTTagCompound compound = readCompound();
|
||||||
if(compound != null){
|
if(compound != null){
|
||||||
|
@ -74,47 +113,8 @@ public class PersistentClientData{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getName(String name){
|
|
||||||
return (Minecraft.getMinecraft().isIntegratedServerRunning() ? Minecraft.getMinecraft().getIntegratedServer().getFolderName() : Minecraft.getMinecraft().func_147104_D().serverIP)+"-"+name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean getBoolean(String name){
|
public static boolean getBoolean(String name){
|
||||||
NBTTagCompound compound = readCompound();
|
NBTTagCompound compound = readCompound();
|
||||||
return compound != null && compound.getBoolean(getName(name));
|
return compound != null && compound.getBoolean(getName(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTheFile(File file){
|
|
||||||
theFile = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getTheFile(){
|
|
||||||
try{
|
|
||||||
if(!theFile.exists()){
|
|
||||||
theFile.createNewFile();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(Exception e){
|
|
||||||
ModUtil.LOGGER.fatal("Couldn't create Persistent Variables file!", e);
|
|
||||||
}
|
|
||||||
return theFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static NBTTagCompound readCompound(){
|
|
||||||
try{
|
|
||||||
return CompressedStreamTools.readCompressed(new FileInputStream(getTheFile()));
|
|
||||||
}
|
|
||||||
catch(Exception e){
|
|
||||||
return new NBTTagCompound();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void writeCompound(NBTTagCompound compound){
|
|
||||||
try{
|
|
||||||
|
|
||||||
CompressedStreamTools.writeCompressed(compound, new FileOutputStream(getTheFile()));
|
|
||||||
}
|
|
||||||
catch(Exception e){
|
|
||||||
ModUtil.LOGGER.fatal("Couldn't write Persistent Variable!", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,18 +44,18 @@ public class PersistentServerData{
|
||||||
this.theCompound = theCompound;
|
this.theCompound = theCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PlayerSave fromNBT(NBTTagCompound compound, String name){
|
||||||
|
UUID theID = new UUID(compound.getLong(name+"MostSignificant"), compound.getLong(name+"LeastSignificant"));
|
||||||
|
NBTTagCompound theCompound = compound.getCompoundTag(name+"Tag");
|
||||||
|
return new PlayerSave(theID, theCompound);
|
||||||
|
}
|
||||||
|
|
||||||
public void toNBT(NBTTagCompound compound, String name){
|
public void toNBT(NBTTagCompound compound, String name){
|
||||||
compound.setLong(name+"LeastSignificant", this.thePlayerUUID.getLeastSignificantBits());
|
compound.setLong(name+"LeastSignificant", this.thePlayerUUID.getLeastSignificantBits());
|
||||||
compound.setLong(name+"MostSignificant", this.thePlayerUUID.getMostSignificantBits());
|
compound.setLong(name+"MostSignificant", this.thePlayerUUID.getMostSignificantBits());
|
||||||
|
|
||||||
compound.setTag(name+"Tag", this.theCompound);
|
compound.setTag(name+"Tag", this.theCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PlayerSave fromNBT(NBTTagCompound compound, String name){
|
|
||||||
UUID theID = new UUID(compound.getLong(name+"MostSignificant"), compound.getLong(name+"LeastSignificant"));
|
|
||||||
NBTTagCompound theCompound = compound.getCompoundTag(name+"Tag");
|
|
||||||
return new PlayerSave(theID, theCompound);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue