mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Less stupid method of syncing changes to the client
This commit is contained in:
parent
737dfb0770
commit
2c763c9199
35 changed files with 196 additions and 654 deletions
|
@ -16,7 +16,6 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import ellpeck.actuallyadditions.network.gui.PacketGuiButton;
|
||||
import ellpeck.actuallyadditions.network.gui.PacketGuiNumber;
|
||||
import ellpeck.actuallyadditions.network.gui.PacketGuiString;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
|
||||
public class PacketHandler{
|
||||
|
@ -27,8 +26,7 @@ public class PacketHandler{
|
|||
theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(ModUtil.MOD_ID_LOWER);
|
||||
|
||||
theNetwork.registerMessage(PacketGuiButton.Handler.class, PacketGuiButton.class, 0, Side.SERVER);
|
||||
theNetwork.registerMessage(PacketSyncerToClient.Handler.class, PacketSyncerToClient.class, 1, Side.CLIENT);
|
||||
theNetwork.registerMessage(PacketGuiNumber.Handler.class, PacketGuiNumber.class, 2, Side.SERVER);
|
||||
theNetwork.registerMessage(PacketGuiString.Handler.class, PacketGuiString.class, 3, Side.SERVER);
|
||||
theNetwork.registerMessage(PacketGuiNumber.Handler.class, PacketGuiNumber.class, 1, Side.SERVER);
|
||||
theNetwork.registerMessage(PacketGuiString.Handler.class, PacketGuiString.class, 2, Side.SERVER);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* This file ("IPacketSyncerToClient.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015 Ellpeck
|
||||
*/
|
||||
|
||||
package ellpeck.actuallyadditions.network.sync;
|
||||
|
||||
public interface IPacketSyncerToClient{
|
||||
|
||||
/**
|
||||
* @return The values that should be sent to the Client
|
||||
*/
|
||||
int[] getValues();
|
||||
|
||||
/**
|
||||
* Sets the Values on the Client
|
||||
*
|
||||
* @param values The Values
|
||||
*/
|
||||
void setValues(int[] values);
|
||||
|
||||
/**
|
||||
* Sends the Update
|
||||
*/
|
||||
void sendUpdate();
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* This file ("PacketSyncerToClient.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015 Ellpeck
|
||||
*/
|
||||
|
||||
package ellpeck.actuallyadditions.network.sync;
|
||||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.network.PacketHandler;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class PacketSyncerToClient implements IMessage{
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private int[] values;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public PacketSyncerToClient(){
|
||||
|
||||
}
|
||||
|
||||
public PacketSyncerToClient(TileEntity tile, int[] values){
|
||||
this.x = tile.xCoord;
|
||||
this.y = tile.yCoord;
|
||||
this.z = tile.zCoord;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public static void sendPacket(TileEntity tile){
|
||||
if(tile instanceof IPacketSyncerToClient){
|
||||
PacketHandler.theNetwork.sendToAllAround(new PacketSyncerToClient(tile, ((IPacketSyncerToClient)tile).getValues()), new NetworkRegistry.TargetPoint(tile.getWorldObj().provider.dimensionId, tile.xCoord, tile.yCoord, tile.zCoord, 128));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf){
|
||||
this.x = buf.readInt();
|
||||
this.y = buf.readInt();
|
||||
this.z = buf.readInt();
|
||||
int length = buf.readInt();
|
||||
if(this.values == null){
|
||||
this.values = new int[length];
|
||||
}
|
||||
for(int i = 0; i < length; i++){
|
||||
this.values[i] = buf.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf){
|
||||
buf.writeInt(this.x);
|
||||
buf.writeInt(this.y);
|
||||
buf.writeInt(this.z);
|
||||
buf.writeInt(this.values.length);
|
||||
for(int value : this.values){
|
||||
buf.writeInt(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Handler implements IMessageHandler<PacketSyncerToClient, IMessage>{
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IMessage onMessage(PacketSyncerToClient message, MessageContext ctx){
|
||||
World world = FMLClientHandler.instance().getClient().theWorld;
|
||||
TileEntity tile = world.getTileEntity(message.x, message.y, message.z);
|
||||
if(tile != null && tile instanceof IPacketSyncerToClient){
|
||||
((IPacketSyncerToClient)tile).setValues(message.values);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityBase extends TileEntity{
|
||||
public abstract class TileEntityBase extends TileEntity{
|
||||
|
||||
public static void init(){
|
||||
ModUtil.LOGGER.info("Registering TileEntities...");
|
||||
|
@ -64,20 +64,40 @@ public class TileEntityBase extends TileEntity{
|
|||
GameRegistry.registerTileEntity(TileEntityRangedCollector.class, ModUtil.MOD_ID_LOWER+":tileEntityRangedCollector");
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.readSyncableNBT(compound, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
this.writeSyncableNBT(compound, false);
|
||||
}
|
||||
|
||||
public abstract void readSyncableNBT(NBTTagCompound compound, boolean isForSync);
|
||||
|
||||
public abstract void writeSyncableNBT(NBTTagCompound compound, boolean isForSync);
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket(){
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag);
|
||||
this.writeSyncableNBT(tag, true);
|
||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 3, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
this.readSyncableNBT(pkt.func_148857_g(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){
|
||||
return !(oldBlock.isAssociatedBlock(newBlock));
|
||||
}
|
||||
|
||||
protected void sendUpdate(){
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
}
|
||||
}
|
|
@ -78,14 +78,14 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ import ellpeck.actuallyadditions.blocks.InitBlocks;
|
|||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -27,7 +25,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler, IPacketSyncerToClient{
|
||||
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(40000);
|
||||
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
@ -106,19 +104,19 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -188,26 +186,4 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.currentProcessTime, this.tank.getFluidAmount(), this.tank.getFluid() == null ? -1 : this.tank.getFluid().getFluidID(), this.storage.getEnergyStored()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.currentProcessTime = values[0];
|
||||
if(values[2] != -1){
|
||||
this.tank.setFluid(new FluidStack(FluidRegistry.getFluid(values[2]), values[1]));
|
||||
}
|
||||
else{
|
||||
this.tank.setFluid(null);
|
||||
}
|
||||
this.storage.setEnergyStored(values[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,15 +15,13 @@ import cofh.api.energy.IEnergyProvider;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider, IPacketSyncerToClient{
|
||||
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(60000);
|
||||
public int maxBurnTime;
|
||||
|
@ -101,19 +99,19 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,21 +148,4 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored(), this.currentBurnTime, this.maxBurnTime};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
this.currentBurnTime = values[1];
|
||||
this.maxBurnTime = values[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ import ellpeck.actuallyadditions.items.InitItems;
|
|||
import ellpeck.actuallyadditions.items.ItemCoffee;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.network.gui.IButtonReactor;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -28,7 +26,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, IEnergyReceiver, IFluidHandler, IPacketSyncerToClient{
|
||||
public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, IEnergyReceiver, IFluidHandler{
|
||||
|
||||
public static final int SLOT_COFFEE_BEANS = 0;
|
||||
public static final int SLOT_INPUT = 1;
|
||||
|
@ -142,8 +140,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
this.coffeeCacheAmount = compound.getInteger("Cache");
|
||||
|
@ -151,8 +149,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
compound.setInteger("Cache", this.coffeeCacheAmount);
|
||||
|
@ -230,27 +228,4 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.tank.getFluidAmount(), this.tank.getFluid() == null ? -1 : this.tank.getFluid().getFluidID(), this.storage.getEnergyStored(), this.brewTime, this.coffeeCacheAmount};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
if(values[1] != -1){
|
||||
this.tank.setFluid(new FluidStack(FluidRegistry.getFluid(values[1]), values[0]));
|
||||
}
|
||||
else{
|
||||
this.tank.setFluid(null);
|
||||
}
|
||||
this.storage.setEnergyStored(values[2]);
|
||||
this.brewTime = values[3];
|
||||
this.coffeeCacheAmount = values[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,14 +57,14 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.conversionTime = compound.getInteger("ConversionTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
compound.setInteger("ConversionTime", this.conversionTime);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ import cofh.api.energy.IEnergyReceiver;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldPos;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -27,7 +25,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements IEnergyReceiver, IPacketSyncerToClient{
|
||||
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(10000);
|
||||
private int lastEnergy;
|
||||
|
@ -91,15 +89,15 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
this.storage.writeToNBT(compound);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
@ -138,19 +136,4 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,14 +63,14 @@ public class TileEntityDropper extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,13 +15,11 @@ import cofh.api.energy.IEnergyContainerItem;
|
|||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityEnergizer extends TileEntityInventoryBase implements IEnergyReceiver, IPacketSyncerToClient{
|
||||
public class TileEntityEnergizer extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(500000);
|
||||
private int lastEnergy;
|
||||
|
@ -56,15 +54,15 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,19 +104,4 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,12 @@ import cofh.api.energy.IEnergyContainerItem;
|
|||
import cofh.api.energy.IEnergyProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityEnervator extends TileEntityInventoryBase implements IEnergyProvider, IPacketSyncerToClient{
|
||||
public class TileEntityEnervator extends TileEntityInventoryBase implements IEnergyProvider{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(500000);
|
||||
private int lastEnergy;
|
||||
|
@ -66,15 +64,15 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,19 +114,4 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ package ellpeck.actuallyadditions.tile;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -23,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class TileEntityFeeder extends TileEntityInventoryBase implements IPacketSyncerToClient{
|
||||
public class TileEntityFeeder extends TileEntityInventoryBase{
|
||||
|
||||
public int currentTimer;
|
||||
public int currentAnimalAmount;
|
||||
|
@ -101,14 +99,14 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements IPacket
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTimer = compound.getInteger("Timer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("Timer", this.currentTimer);
|
||||
}
|
||||
|
||||
|
@ -126,20 +124,4 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements IPacket
|
|||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.currentAnimalAmount, this.currentTimer};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.currentAnimalAmount = values[0];
|
||||
this.currentTimer = values[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -23,7 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityFermentingBarrel extends TileEntityInventoryBase implements IFluidHandler, IPacketSyncerToClient{
|
||||
public class TileEntityFermentingBarrel extends TileEntityInventoryBase implements IFluidHandler{
|
||||
|
||||
public FluidTank canolaTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
public FluidTank oilTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
@ -82,21 +80,21 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
this.canolaTank.readFromNBT(compound);
|
||||
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
this.canolaTank.writeToNBT(compound);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.oilTank.writeToNBT(tag);
|
||||
compound.setTag("OilTank", tag);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,31 +157,4 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
|||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.canolaTank.getInfo(), this.oilTank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.oilTank.getFluidAmount(), this.oilTank.getFluid() == null ? -1 : this.oilTank.getFluid().getFluidID(), this.canolaTank.getFluidAmount(), this.canolaTank.getFluid() == null ? -1 : this.canolaTank.getFluid().getFluidID(), this.currentProcessTime};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
if(values[1] != -1){
|
||||
this.oilTank.setFluid(new FluidStack(FluidRegistry.getFluid(values[1]), values[0]));
|
||||
}
|
||||
else{
|
||||
this.oilTank.setFluid(null);
|
||||
}
|
||||
if(values[3] != -1){
|
||||
this.canolaTank.setFluid(new FluidStack(FluidRegistry.getFluid(values[3]), values[2]));
|
||||
}
|
||||
else{
|
||||
this.canolaTank.setFluid(null);
|
||||
}
|
||||
this.currentProcessTime = values[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,12 @@ public class TileEntityFishingNet extends TileEntityBase{
|
|||
public int timeUntilNextDrop;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ package ellpeck.actuallyadditions.tile;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldPos;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -24,7 +22,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityFluidCollector extends TileEntityInventoryBase implements IFluidHandler, IPacketSyncerToClient{
|
||||
public class TileEntityFluidCollector extends TileEntityInventoryBase implements IFluidHandler{
|
||||
|
||||
public FluidTank tank = new FluidTank(8*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
public boolean isPlacer;
|
||||
|
@ -79,26 +77,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.tank.getFluidAmount(), this.tank.getFluid() == null ? -1 : this.tank.getFluid().getFluidID()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
if(values[1] != -1){
|
||||
this.tank.setFluid(new FluidStack(FluidRegistry.getFluid(values[1]), values[0]));
|
||||
}
|
||||
else{
|
||||
this.tank.setFluid(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -181,15 +159,15 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
this.tank.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
this.tank.writeToNBT(compound);
|
||||
}
|
||||
|
|
|
@ -15,14 +15,12 @@ import cofh.api.energy.IEnergyReceiver;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IEnergyReceiver, IPacketSyncerToClient{
|
||||
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_INPUT_1 = 0;
|
||||
public static final int SLOT_OUTPUT_1 = 1;
|
||||
|
@ -132,16 +130,16 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
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
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
|
@ -196,21 +194,4 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored(), this.firstSmeltTime, this.secondSmeltTime};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
this.firstSmeltTime = values[1];
|
||||
this.secondSmeltTime = values[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,15 +42,13 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,6 +15,7 @@ import ellpeck.actuallyadditions.util.WorldPos;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockGrass;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
import java.util.Random;
|
||||
|
@ -63,4 +64,13 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
compound.setInteger("Time", this.timeUntilNextFert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
this.timeUntilNextFert = compound.getInteger("Time");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ import cofh.api.energy.IEnergyReceiver;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -26,7 +24,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver, IPacketSyncerToClient{
|
||||
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_INPUT_1 = 0;
|
||||
public static final int SLOT_OUTPUT_1_1 = 1;
|
||||
|
@ -71,23 +69,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored(), this.firstCrushTime, this.secondCrushTime};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
this.firstCrushTime = values[1];
|
||||
this.secondCrushTime = values[2];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
|
@ -216,19 +197,19 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@ import ellpeck.actuallyadditions.util.WorldPos;
|
|||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -77,4 +78,14 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
|
|||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return from == ForgeDirection.UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ package ellpeck.actuallyadditions.tile;
|
|||
|
||||
import ellpeck.actuallyadditions.network.gui.IButtonReactor;
|
||||
import ellpeck.actuallyadditions.network.gui.INumberReactor;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -22,7 +20,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor, IPacketSyncerToClient{
|
||||
public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor, INumberReactor{
|
||||
|
||||
public static final int PUT_FILTER_START = 13;
|
||||
public static final int PULL_FILTER_START = 1;
|
||||
|
@ -82,28 +80,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{sideToPut, sideToPull, slotToPutStart, slotToPutEnd, slotToPullStart, slotToPullEnd, this.isPutWhitelist ? 1 : 0, this.isPullWhitelist ? 1 : 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.sideToPut = values[0];
|
||||
this.sideToPull = values[1];
|
||||
this.slotToPutStart = values[2];
|
||||
this.slotToPutEnd = values[3];
|
||||
this.slotToPullStart = values[4];
|
||||
this.slotToPullEnd = values[5];
|
||||
this.isPutWhitelist = values[6] == 1;
|
||||
this.isPullWhitelist = values[7] == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
|
@ -425,7 +401,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.sideToPut = compound.getInteger("SideToPut");
|
||||
this.slotToPutStart = compound.getInteger("SlotToPut");
|
||||
this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
|
||||
|
@ -434,12 +410,12 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
|
||||
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
|
||||
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("SideToPut", this.sideToPut);
|
||||
compound.setInteger("SlotToPut", this.slotToPutStart);
|
||||
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
|
||||
|
|
|
@ -32,34 +32,36 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
if(this.slots.length > 0){
|
||||
NBTTagList tagList = compound.getTagList("Items", 10);
|
||||
for(int i = 0; i < tagList.tagCount(); i++){
|
||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
||||
byte slotIndex = tagCompound.getByte("Slot");
|
||||
if(slotIndex >= 0 && slotIndex < slots.length){
|
||||
slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
if(!isForSync){
|
||||
if(this.slots.length > 0){
|
||||
NBTTagList tagList = compound.getTagList("Items", 10);
|
||||
for(int i = 0; i < tagList.tagCount(); i++){
|
||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
||||
byte slotIndex = tagCompound.getByte("Slot");
|
||||
if(slotIndex >= 0 && slotIndex < slots.length){
|
||||
slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
if(this.slots.length > 0){
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
|
||||
if(slots[currentIndex] != null){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setByte("Slot", (byte)currentIndex);
|
||||
slots[currentIndex].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
if(!isForSync){
|
||||
if(this.slots.length > 0){
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
|
||||
if(slots[currentIndex] != null){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setByte("Slot", (byte)currentIndex);
|
||||
slots[currentIndex].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
}
|
||||
}
|
||||
compound.setTag("Items", tagList);
|
||||
}
|
||||
compound.setTag("Items", tagList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,13 +15,11 @@ import cofh.api.energy.IEnergyReceiver;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityItemRepairer extends TileEntityInventoryBase implements IEnergyReceiver, IPacketSyncerToClient{
|
||||
public class TileEntityItemRepairer extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_INPUT = 0;
|
||||
public static final int SLOT_OUTPUT = 1;
|
||||
|
@ -71,16 +69,16 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -131,19 +129,4 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,17 +31,15 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
|
|||
private int currentWorkTime;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
this.currentWorkTime = compound.getInteger("WorkTime");
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
compound.setInteger("WorkTime", this.currentWorkTime);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,15 +29,13 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
|
|||
private int nextUseCounter;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,15 +16,13 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityOilGenerator extends TileEntityInventoryBase implements IEnergyProvider, IFluidHandler, IPacketSyncerToClient{
|
||||
public class TileEntityOilGenerator extends TileEntityInventoryBase implements IEnergyProvider, IFluidHandler{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(50000);
|
||||
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
@ -104,19 +102,19 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -186,26 +184,4 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored(), this.currentBurnTime, this.tank.getFluidAmount(), this.tank.getFluid() == null ? -1 : this.tank.getFluid().getFluidID()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
this.currentBurnTime = values[1];
|
||||
if(values[3] != -1){
|
||||
this.tank.setFluid(new FluidStack(FluidRegistry.getFluid(values[3]), values[2]));
|
||||
}
|
||||
else{
|
||||
this.tank.setFluid(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@ import ellpeck.actuallyadditions.blocks.InitBlocks;
|
|||
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
||||
import ellpeck.actuallyadditions.config.ConfigValues;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldPos;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -32,7 +30,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler, IPacketSyncerToClient{
|
||||
public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler{
|
||||
|
||||
public static final int SLOT_OIL_INPUT = 0;
|
||||
public static final int SLOT_OIL_OUTPUT = 1;
|
||||
|
@ -182,19 +180,19 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
this.currentWorkTimer = compound.getInteger("CurrentWorkTimer");
|
||||
super.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
compound.setInteger("CurrentWorkTimer", this.currentWorkTimer);
|
||||
super.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -264,25 +262,4 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
|||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.storage.getEnergyStored(), this.tank.getFluidAmount(), this.tank.getFluid() == null ? -1 : this.tank.getFluid().getFluidID()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.storage.setEnergyStored(values[0]);
|
||||
if(values[2] != -1){
|
||||
this.tank.setFluid(new FluidStack(FluidRegistry.getFluid(values[2]), values[1]));
|
||||
}
|
||||
else{
|
||||
this.tank.setFluid(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityPhantomBooster extends TileEntityBase{
|
||||
|
||||
@Override
|
||||
|
@ -17,4 +19,13 @@ public class TileEntityPhantomBooster extends TileEntityBase{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,8 +138,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
int x = compound.getInteger("XCoordOfTileStored");
|
||||
int y = compound.getInteger("YCoordOfTileStored");
|
||||
int z = compound.getInteger("ZCoordOfTileStored");
|
||||
|
@ -151,8 +151,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("Time", currentTime);
|
||||
if(this.hasBoundPosition()){
|
||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||
|
|
|
@ -120,8 +120,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
int x = compound.getInteger("XCoordOfTileStored");
|
||||
int y = compound.getInteger("YCoordOfTileStored");
|
||||
int z = compound.getInteger("ZCoordOfTileStored");
|
||||
|
@ -133,8 +133,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
if(this.hasBoundPosition()){
|
||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
||||
|
|
|
@ -12,8 +12,6 @@ package ellpeck.actuallyadditions.tile;
|
|||
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.network.gui.IButtonReactor;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -23,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor, IPacketSyncerToClient{
|
||||
public class TileEntityRangedCollector extends TileEntityInventoryBase implements IButtonReactor{
|
||||
|
||||
public static final int WHITELIST_START = 6;
|
||||
|
||||
|
@ -77,14 +75,14 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.isWhitelist = compound.getBoolean("Whitelist");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setBoolean("Whitelist", this.isWhitelist);
|
||||
}
|
||||
|
||||
|
@ -107,19 +105,4 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
|
|||
public void onButtonPressed(int buttonID, EntityPlayer player){
|
||||
this.isWhitelist = !this.isWhitelist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.isWhitelist ? 1 : 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.isWhitelist = values[0] == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,14 +13,12 @@ package ellpeck.actuallyadditions.tile;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.network.gui.IStringReactor;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class TileEntitySmileyCloud extends TileEntityBase implements IPacketSyncerToClient, IStringReactor{
|
||||
public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{
|
||||
|
||||
public String name;
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -30,14 +28,12 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IPacketSync
|
|||
private String nameBefore;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.name = compound.getString("Name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
if(this.name != null){
|
||||
compound.setString("Name", this.name);
|
||||
}
|
||||
|
@ -54,38 +50,6 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IPacketSync
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
if(this.name != null && !this.name.isEmpty()){
|
||||
int[] chars = new int[this.name.length()];
|
||||
for(int i = 0; i < this.name.length(); i++){
|
||||
char atPlace = this.name.charAt(i);
|
||||
chars[i] = (int)atPlace;
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
if(values != null && values.length > 0){
|
||||
String newName = "";
|
||||
for(int value : values){
|
||||
newName += (char)value;
|
||||
}
|
||||
this.name = newName;
|
||||
}
|
||||
else{
|
||||
this.name = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextReceived(String text, int textID, EntityPlayer player){
|
||||
this.name = text;
|
||||
|
|
|
@ -15,13 +15,11 @@ import ellpeck.actuallyadditions.items.InitItems;
|
|||
import ellpeck.actuallyadditions.items.ItemSpecialDrop;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
|
||||
import ellpeck.actuallyadditions.network.gui.IButtonReactor;
|
||||
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
|
||||
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor, IPacketSyncerToClient{
|
||||
public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor{
|
||||
|
||||
public short amount;
|
||||
private short lastAmount;
|
||||
|
@ -56,14 +54,14 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.amount = compound.getShort("Amount");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setShort("Amount", this.amount);
|
||||
}
|
||||
|
||||
|
@ -150,19 +148,4 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getValues(){
|
||||
return new int[]{this.amount};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValues(int[] values){
|
||||
this.amount = (short)values[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendUpdate(){
|
||||
PacketSyncerToClient.sendPacket(this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue