This commit is contained in:
Glenthor 2015-10-18 18:43:52 +02:00
commit a69b94bba0
55 changed files with 254 additions and 802 deletions

View file

@ -1,4 +1,4 @@
![](https://github.com/Ellpeck/ActuallyAdditions/blob/master/src/main/resources/assets/actuallyadditions/textures/logoBig.png) ![](https://raw.githubusercontent.com/Ellpeck/ActuallyAdditions/master/pics/logoBig.png)
##It's a Minecraft Mod! ##It's a Minecraft Mod!

View file

Before

Width:  |  Height:  |  Size: 728 KiB

After

Width:  |  Height:  |  Size: 728 KiB

View file

Before

Width:  |  Height:  |  Size: 905 KiB

After

Width:  |  Height:  |  Size: 905 KiB

BIN
pics/items.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

View file

Before

Width:  |  Height:  |  Size: 347 KiB

After

Width:  |  Height:  |  Size: 347 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -10,8 +10,8 @@
package ellpeck.actuallyadditions.blocks.render; package ellpeck.actuallyadditions.blocks.render;
import ellpeck.actuallyadditions.gadget.cloud.ISmileyCloudEasterEgg; import ellpeck.actuallyadditions.misc.cloud.ISmileyCloudEasterEgg;
import ellpeck.actuallyadditions.gadget.cloud.SmileyCloudEasterEggs; import ellpeck.actuallyadditions.misc.cloud.SmileyCloudEasterEggs;
import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud; import ellpeck.actuallyadditions.tile.TileEntitySmileyCloud;
import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;

View file

@ -15,7 +15,10 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.booklet.page.BookletPage; import ellpeck.actuallyadditions.booklet.page.BookletPage;
import ellpeck.actuallyadditions.config.GuiConfiguration; import ellpeck.actuallyadditions.config.GuiConfiguration;
import ellpeck.actuallyadditions.update.UpdateChecker; import ellpeck.actuallyadditions.update.UpdateChecker;
import ellpeck.actuallyadditions.util.*; import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import ellpeck.actuallyadditions.util.Util;
import ellpeck.actuallyadditions.util.playerdata.PersistentClientData; import ellpeck.actuallyadditions.util.playerdata.PersistentClientData;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
@ -81,7 +84,7 @@ public class GuiBooklet extends GuiScreen{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(resLoc); this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.isGimmicky() ? 256 : this.xSize, this.isGimmicky() ? 256 : this.ySize); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
if(this.currentIndexEntry instanceof BookletEntryAllSearch && this.currentChapter == null){ if(this.currentIndexEntry instanceof BookletEntryAllSearch && this.currentChapter == null){
this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14); this.drawTexturedModalRect(this.guiLeft+146, this.guiTop+160, 146, 80, 70, 14);
@ -111,18 +114,6 @@ public class GuiBooklet extends GuiScreen{
} }
} }
if(this.isGimmicky()){
this.fontRendererObj.drawSplitString("This book looks a lot like the one from Botania, doesn't it? Well, I think it does, too, and I'm kind of annoyed by it to be honest. Wasn't really meant to be that way. I guess I just kind of had the design of the Botania Book in mind when designing this. Well. I made the Code on my own, so I don't really care. Also: How did you find this gimmick? :P -Peck", this.guiLeft-80-3, this.guiTop+25, 80, StringUtil.DECIMAL_COLOR_WHITE);
String strg = "Click this! I need followaz #Pathetic #DontTakeSeriously ->";
this.fontRendererObj.drawString(strg, this.guiLeft-this.fontRendererObj.getStringWidth(strg)-3, this.guiTop, StringUtil.DECIMAL_COLOR_WHITE);
if(this.currentChapter == InitBooklet.chapterIntro && this.currentPage == InitBooklet.chapterIntro.pages[1]){
strg = "Hey Hose, I kind of hate you a bit for that Ellopecko thing. (Not really! It's fun and games and stuff! :D)";
this.fontRendererObj.drawString(strg, this.guiLeft+this.xSize/2-this.fontRendererObj.getStringWidth(strg)/2, this.guiTop-20, StringUtil.DECIMAL_COLOR_WHITE);
}
}
super.drawScreen(x, y, f); super.drawScreen(x, y, f);
this.searchField.drawTextBox(); this.searchField.drawTextBox();
@ -509,10 +500,6 @@ public class GuiBooklet extends GuiScreen{
} }
} }
private boolean isGimmicky(){
return KeyUtil.isControlPressed() && KeyUtil.isShiftPressed() && KeyUtil.isAltPressed();
}
private static class IndexButton extends GuiButton{ private static class IndexButton extends GuiButton{
public BookletChapter chap; public BookletChapter chap;

View file

@ -198,7 +198,7 @@ public class ItemCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeBlockPlacing), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeBlockPlacing),
"CEC", "RAR", "CEC", "CEC", "RAR", "CEC",
'C', "cobblestone", 'C', "cobblestone",
'E', Items.ender_pearl, 'E', Items.paper,
'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), 'A', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
'R', "ingotIron")); 'R', "ingotIron"));
recipeDrillPlacing = Util.GetRecipes.lastIRecipe(); recipeDrillPlacing = Util.GetRecipes.lastIRecipe();

View file

@ -20,7 +20,7 @@ public class EntityConstructingEvent{
@SubscribeEvent @SubscribeEvent
public void onEntityConstructing(EntityEvent.EntityConstructing event){ public void onEntityConstructing(EntityEvent.EntityConstructing event){
if(event.entity instanceof EntityPlayer){ if(event.entity instanceof EntityPlayer && !event.entity.worldObj.isRemote){
if(PersistentServerData.get((EntityPlayer)event.entity) == null){ if(PersistentServerData.get((EntityPlayer)event.entity) == null){
event.entity.registerExtendedProperties(ModUtil.MOD_ID, new PersistentServerData()); event.entity.registerExtendedProperties(ModUtil.MOD_ID, new PersistentServerData());
} }

View file

@ -13,8 +13,8 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.gadget.RenderSpecial;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.misc.RenderSpecial;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.event.RenderPlayerEvent;

View file

@ -1,39 +0,0 @@
/*
* This file ("ModelStandardBlock.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.gadget;
import ellpeck.actuallyadditions.blocks.render.ModelBaseAA;
import net.minecraft.client.model.ModelRenderer;
public class ModelStandardBlock extends ModelBaseAA{
public ModelRenderer s;
private String name;
public ModelStandardBlock(String name){
this.name = name;
this.textureWidth = 64;
this.textureHeight = 64;
this.s = new ModelRenderer(this, 0, 0);
this.s.setRotationPoint(-8.0F, 8.0F, -8.0F);
this.s.addBox(0.0F, 0.0F, 0.0F, 16, 16, 16, 0.0F);
}
@Override
public void render(float f){
this.s.render(f);
}
@Override
public String getName(){
return "model"+this.name;
}
}

View file

@ -1,37 +0,0 @@
/*
* This file ("ModelTorch.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.gadget;
import ellpeck.actuallyadditions.blocks.render.ModelBaseAA;
import net.minecraft.client.model.ModelRenderer;
public class ModelTorch extends ModelBaseAA{
public ModelRenderer s;
public ModelTorch(){
this.textureWidth = 64;
this.textureHeight = 32;
this.s = new ModelRenderer(this, 0, 0);
this.s.setRotationPoint(-1.0F, 14.0F, -1.0F);
this.s.addBox(0.0F, 0.0F, 0.0F, 2, 10, 2, 0.0F);
}
@Override
public void render(float f){
this.s.render(f);
}
@Override
public String getName(){
return "modelHose";
}
}

View file

@ -27,7 +27,7 @@ import net.minecraft.world.World;
public class ItemBooklet extends Item implements IActAddItemOrBlock{ public class ItemBooklet extends Item implements IActAddItemOrBlock{
public ItemBooklet(){ public ItemBooklet(){
this.setMaxStackSize(1); this.setMaxStackSize(16);
this.setMaxDamage(0); this.setMaxDamage(0);
} }

View file

@ -8,7 +8,7 @@
* © 2015 Ellpeck * © 2015 Ellpeck
*/ */
package ellpeck.actuallyadditions.gadget; package ellpeck.actuallyadditions.misc;
import ellpeck.actuallyadditions.event.RenderPlayerEventAA; import ellpeck.actuallyadditions.event.RenderPlayerEventAA;
import ellpeck.actuallyadditions.util.AssetUtil; import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -8,7 +8,7 @@
* © 2015 Ellpeck * © 2015 Ellpeck
*/ */
package ellpeck.actuallyadditions.gadget.cloud; package ellpeck.actuallyadditions.misc.cloud;
public interface ISmileyCloudEasterEgg{ public interface ISmileyCloudEasterEgg{

View file

@ -8,7 +8,7 @@
* © 2015 Ellpeck * © 2015 Ellpeck
*/ */
package ellpeck.actuallyadditions.gadget.cloud; package ellpeck.actuallyadditions.misc.cloud;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;

View file

@ -16,7 +16,6 @@ import cpw.mods.fml.relauncher.Side;
import ellpeck.actuallyadditions.network.gui.PacketGuiButton; import ellpeck.actuallyadditions.network.gui.PacketGuiButton;
import ellpeck.actuallyadditions.network.gui.PacketGuiNumber; import ellpeck.actuallyadditions.network.gui.PacketGuiNumber;
import ellpeck.actuallyadditions.network.gui.PacketGuiString; import ellpeck.actuallyadditions.network.gui.PacketGuiString;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
public class PacketHandler{ public class PacketHandler{
@ -27,8 +26,7 @@ public class PacketHandler{
theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(ModUtil.MOD_ID_LOWER); theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(ModUtil.MOD_ID_LOWER);
theNetwork.registerMessage(PacketGuiButton.Handler.class, PacketGuiButton.class, 0, Side.SERVER); 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, 1, Side.SERVER);
theNetwork.registerMessage(PacketGuiNumber.Handler.class, PacketGuiNumber.class, 2, Side.SERVER); theNetwork.registerMessage(PacketGuiString.Handler.class, PacketGuiString.class, 2, Side.SERVER);
theNetwork.registerMessage(PacketGuiString.Handler.class, PacketGuiString.class, 3, Side.SERVER);
} }
} }

View file

@ -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();
}

View file

@ -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;
}
}
}

View file

@ -41,7 +41,7 @@ public class CrusherRecipeRegistry{
String output = theCase.resultPreString+ore.substring(theCase.theCase.length()); String output = theCase.resultPreString+ore.substring(theCase.theCase.length());
if(!hasRecipe(ore)){ if(!hasRecipe(ore)){
if(!OreDictionary.getOres(output, false).isEmpty()){ if(!OreDictionary.getOres(output, false).isEmpty() && !OreDictionary.getOres(ore, false).isEmpty()){
addRecipe(ore, output, theCase.resultAmount); addRecipe(ore, output, theCase.resultAmount);
recipesAdded++; recipesAdded++;
} }

View file

@ -20,7 +20,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
public class TileEntityBase extends TileEntity{ public abstract class TileEntityBase extends TileEntity{
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Registering TileEntities..."); ModUtil.LOGGER.info("Registering TileEntities...");
@ -64,20 +64,40 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityRangedCollector.class, ModUtil.MOD_ID_LOWER+":tileEntityRangedCollector"); 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 writeSyncableNBT(NBTTagCompound compound, boolean isForSync);
@Override @Override
public Packet getDescriptionPacket(){ public Packet getDescriptionPacket(){
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
this.writeToNBT(tag); this.writeSyncableNBT(tag, true);
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 3, tag);
} }
@Override @Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){
this.readFromNBT(pkt.func_148857_g()); this.readSyncableNBT(pkt.func_148857_g(), true);
} }
@Override @Override
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){ public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){
return !(oldBlock.isAssociatedBlock(newBlock)); return !(oldBlock.isAssociatedBlock(newBlock));
} }
public abstract void readSyncableNBT(NBTTagCompound compound, boolean isForSync);
protected void sendUpdate(){
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
} }

View file

@ -78,14 +78,14 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime"); this.currentTime = compound.getInteger("CurrentTime");
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime); compound.setInteger("CurrentTime", this.currentTime);
} }

View file

@ -18,8 +18,6 @@ import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -27,7 +25,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*; 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 EnergyStorage storage = new EnergyStorage(40000);
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME); public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
@ -106,19 +104,19 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime"); this.currentProcessTime = compound.getInteger("ProcessTime");
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound); this.tank.readFromNBT(compound);
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("ProcessTime", this.currentProcessTime); compound.setInteger("ProcessTime", this.currentProcessTime);
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound); this.tank.writeToNBT(compound);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
} }
@Override @Override
@ -188,26 +186,4 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
public FluidTankInfo[] getTankInfo(ForgeDirection from){ public FluidTankInfo[] getTankInfo(ForgeDirection from){
return new FluidTankInfo[]{this.tank.getInfo()}; 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);
}
} }

View file

@ -15,15 +15,13 @@ import cofh.api.energy.IEnergyProvider;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.util.ForgeDirection; 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 EnergyStorage storage = new EnergyStorage(60000);
public int maxBurnTime; public int maxBurnTime;
@ -101,19 +99,19 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentBurnTime = compound.getInteger("BurnTime"); this.currentBurnTime = compound.getInteger("BurnTime");
this.maxBurnTime = compound.getInteger("MaxBurnTime"); this.maxBurnTime = compound.getInteger("MaxBurnTime");
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("BurnTime", this.currentBurnTime); compound.setInteger("BurnTime", this.currentBurnTime);
compound.setInteger("MaxBurnTime", this.maxBurnTime); compound.setInteger("MaxBurnTime", this.maxBurnTime);
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
} }
@Override @Override
@ -150,21 +148,4 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
public boolean canConnectEnergy(ForgeDirection from){ public boolean canConnectEnergy(ForgeDirection from){
return true; 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);
}
} }

View file

@ -19,8 +19,6 @@ import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemCoffee; import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.network.gui.IButtonReactor; import ellpeck.actuallyadditions.network.gui.IButtonReactor;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -28,7 +26,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*; 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_COFFEE_BEANS = 0;
public static final int SLOT_INPUT = 1; public static final int SLOT_INPUT = 1;
@ -142,8 +140,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound); this.tank.readFromNBT(compound);
this.coffeeCacheAmount = compound.getInteger("Cache"); this.coffeeCacheAmount = compound.getInteger("Cache");
@ -151,8 +149,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound); this.tank.writeToNBT(compound);
compound.setInteger("Cache", this.coffeeCacheAmount); compound.setInteger("Cache", this.coffeeCacheAmount);
@ -230,27 +228,4 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
public FluidTankInfo[] getTankInfo(ForgeDirection from){ public FluidTankInfo[] getTankInfo(ForgeDirection from){
return new FluidTankInfo[]{this.tank.getInfo()}; 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);
}
} }

View file

@ -57,14 +57,14 @@ public class TileEntityCompost extends TileEntityInventoryBase{
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.conversionTime = compound.getInteger("ConversionTime"); this.conversionTime = compound.getInteger("ConversionTime");
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.readSyncableNBT(compound, sync);
compound.setInteger("ConversionTime", this.conversionTime); compound.setInteger("ConversionTime", this.conversionTime);
} }

View file

@ -15,8 +15,6 @@ import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; 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.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -27,7 +25,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; 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); public EnergyStorage storage = new EnergyStorage(10000);
private int lastEnergy; private int lastEnergy;
@ -91,17 +89,17 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.writeSyncableNBT(compound, sync);
this.storage.readFromNBT(compound); this.storage.writeToNBT(compound);
this.currentTime = compound.getInteger("CurrentTime"); compound.setInteger("CurrentTime", this.currentTime);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.readSyncableNBT(compound, sync);
this.storage.writeToNBT(compound); this.storage.readFromNBT(compound);
compound.setInteger("CurrentTime", this.currentTime); this.currentTime = compound.getInteger("CurrentTime");
} }
@Override @Override
@ -138,19 +136,4 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
public boolean canConnectEnergy(ForgeDirection from){ public boolean canConnectEnergy(ForgeDirection from){
return true; 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);
}
} }

View file

@ -63,14 +63,14 @@ public class TileEntityDropper extends TileEntityInventoryBase{
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime"); this.currentTime = compound.getInteger("CurrentTime");
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime); compound.setInteger("CurrentTime", this.currentTime);
} }

View file

@ -15,13 +15,11 @@ import cofh.api.energy.IEnergyContainerItem;
import cofh.api.energy.IEnergyReceiver; import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; 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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; 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); public EnergyStorage storage = new EnergyStorage(500000);
private int lastEnergy; private int lastEnergy;
@ -56,15 +54,15 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
} }
@Override @Override
@ -106,19 +104,4 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
public boolean canConnectEnergy(ForgeDirection from){ public boolean canConnectEnergy(ForgeDirection from){
return true; 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);
}
} }

View file

@ -15,14 +15,12 @@ import cofh.api.energy.IEnergyContainerItem;
import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyProvider;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; 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); public EnergyStorage storage = new EnergyStorage(500000);
private int lastEnergy; private int lastEnergy;
@ -66,15 +64,15 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
} }
@Override @Override
@ -116,19 +114,4 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
public boolean canExtractItem(int slot, ItemStack stack, int side){ public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == 1; 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);
}
} }

View file

@ -13,8 +13,6 @@ package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; 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.entity.passive.EntityAnimal;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -23,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class TileEntityFeeder extends TileEntityInventoryBase implements IPacketSyncerToClient{ public class TileEntityFeeder extends TileEntityInventoryBase{
public int currentTimer; public int currentTimer;
public int currentAnimalAmount; public int currentAnimalAmount;
@ -101,14 +99,14 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements IPacket
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.currentTimer = compound.getInteger("Timer"); this.currentTimer = compound.getInteger("Timer");
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
compound.setInteger("Timer", this.currentTimer); 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){ public boolean canExtractItem(int slot, ItemStack stack, int side){
return false; 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);
}
} }

View file

@ -14,8 +14,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -23,7 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*; 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 canolaTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
public FluidTank oilTank = 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 @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.canolaTank.readFromNBT(compound);
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
super.readFromNBT(compound);
}
@Override
public void writeToNBT(NBTTagCompound compound){
compound.setInteger("ProcessTime", this.currentProcessTime); compound.setInteger("ProcessTime", this.currentProcessTime);
this.canolaTank.writeToNBT(compound); this.canolaTank.writeToNBT(compound);
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
this.oilTank.writeToNBT(tag); this.oilTank.writeToNBT(tag);
compound.setTag("OilTank", tag); compound.setTag("OilTank", tag);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentProcessTime = compound.getInteger("ProcessTime");
this.canolaTank.readFromNBT(compound);
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
super.readSyncableNBT(compound, sync);
} }
@Override @Override
@ -159,31 +157,4 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
public FluidTankInfo[] getTankInfo(ForgeDirection from){ public FluidTankInfo[] getTankInfo(ForgeDirection from){
return new FluidTankInfo[]{this.canolaTank.getInfo(), this.oilTank.getInfo()}; 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);
}
} }

View file

@ -28,15 +28,13 @@ public class TileEntityFishingNet extends TileEntityBase{
public int timeUntilNextDrop; public int timeUntilNextDrop;
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
} }
@Override @Override

View file

@ -13,8 +13,6 @@ package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; 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.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -24,7 +22,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*; 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 FluidTank tank = new FluidTank(8*FluidContainerRegistry.BUCKET_VOLUME);
public boolean isPlacer; public boolean isPlacer;
@ -79,26 +77,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
return new FluidTankInfo[]{this.tank.getInfo()}; 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 @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -181,17 +159,17 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.writeSyncableNBT(compound, sync);
this.currentTime = compound.getInteger("CurrentTime"); compound.setInteger("CurrentTime", this.currentTime);
this.tank.readFromNBT(compound); this.tank.writeToNBT(compound);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.readSyncableNBT(compound, sync);
compound.setInteger("CurrentTime", this.currentTime); this.currentTime = compound.getInteger("CurrentTime");
this.tank.writeToNBT(compound); this.tank.readFromNBT(compound);
} }
@Override @Override

View file

@ -15,14 +15,12 @@ import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; 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.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; 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_INPUT_1 = 0;
public static final int SLOT_OUTPUT_1 = 1; public static final int SLOT_OUTPUT_1 = 1;
@ -132,16 +130,16 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.firstSmeltTime = compound.getInteger("FirstSmeltTime"); this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
this.secondSmeltTime = compound.getInteger("SecondSmeltTime"); this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
compound.setInteger("FirstSmeltTime", this.firstSmeltTime); compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
compound.setInteger("SecondSmeltTime", this.secondSmeltTime); compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
@ -196,21 +194,4 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
public boolean canConnectEnergy(ForgeDirection from){ public boolean canConnectEnergy(ForgeDirection from){
return true; 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);
}
} }

View file

@ -42,15 +42,13 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound); this.storage.writeToNBT(compound);
super.readFromNBT(compound);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound); this.storage.readFromNBT(compound);
super.writeToNBT(compound);
} }
@Override @Override

View file

@ -15,6 +15,7 @@ import ellpeck.actuallyadditions.util.WorldPos;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockGrass; import net.minecraft.block.BlockGrass;
import net.minecraft.block.IGrowable; import net.minecraft.block.IGrowable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import java.util.Random; import java.util.Random;
@ -63,4 +64,13 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
return null; return null;
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
this.timeUntilNextFert = compound.getInteger("Time");
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
compound.setInteger("Time", this.timeUntilNextFert);
}
} }

View file

@ -16,8 +16,6 @@ import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry; import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -26,7 +24,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; 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_INPUT_1 = 0;
public static final int SLOT_OUTPUT_1_1 = 1; public static final int SLOT_OUTPUT_1_1 = 1;
@ -71,23 +69,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
return true; 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 @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void updateEntity(){ public void updateEntity(){
@ -216,19 +197,19 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.firstCrushTime = compound.getInteger("FirstCrushTime"); this.firstCrushTime = compound.getInteger("FirstCrushTime");
this.secondCrushTime = compound.getInteger("SecondCrushTime"); this.secondCrushTime = compound.getInteger("SecondCrushTime");
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("FirstCrushTime", this.firstCrushTime); compound.setInteger("FirstCrushTime", this.firstCrushTime);
compound.setInteger("SecondCrushTime", this.secondCrushTime); compound.setInteger("SecondCrushTime", this.secondCrushTime);
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
} }
@Override @Override

View file

@ -17,6 +17,7 @@ import ellpeck.actuallyadditions.util.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
@ -77,4 +78,14 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
public boolean canConnectEnergy(ForgeDirection from){ public boolean canConnectEnergy(ForgeDirection from){
return from == ForgeDirection.UP; return from == ForgeDirection.UP;
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
this.storage.writeToNBT(compound);
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
this.storage.readFromNBT(compound);
}
} }

View file

@ -12,8 +12,6 @@ package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.network.gui.IButtonReactor; import ellpeck.actuallyadditions.network.gui.IButtonReactor;
import ellpeck.actuallyadditions.network.gui.INumberReactor; import ellpeck.actuallyadditions.network.gui.INumberReactor;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@ -22,7 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; 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 PUT_FILTER_START = 13;
public static final int PULL_FILTER_START = 1; public static final int PULL_FILTER_START = 1;
@ -82,28 +80,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
this.markDirty(); 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 @Override
public void updateEntity(){ public void updateEntity(){
if(!worldObj.isRemote){ if(!worldObj.isRemote){
@ -425,7 +401,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.sideToPut = compound.getInteger("SideToPut"); this.sideToPut = compound.getInteger("SideToPut");
this.slotToPutStart = compound.getInteger("SlotToPut"); this.slotToPutStart = compound.getInteger("SlotToPut");
this.slotToPutEnd = compound.getInteger("SlotToPutEnd"); this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
@ -434,12 +410,12 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
this.slotToPullEnd = compound.getInteger("SlotToPullEnd"); this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
this.isPullWhitelist = compound.getBoolean("PullWhitelist"); this.isPullWhitelist = compound.getBoolean("PullWhitelist");
this.isPutWhitelist = compound.getBoolean("PutWhitelist"); this.isPutWhitelist = compound.getBoolean("PutWhitelist");
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
compound.setInteger("SideToPut", this.sideToPut); compound.setInteger("SideToPut", this.sideToPut);
compound.setInteger("SlotToPut", this.slotToPutStart); compound.setInteger("SlotToPut", this.slotToPutStart);
compound.setInteger("SlotToPutEnd", this.slotToPutEnd); compound.setInteger("SlotToPutEnd", this.slotToPutEnd);

View file

@ -32,23 +32,8 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
super.readFromNBT(compound); 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){ if(this.slots.length > 0){
NBTTagList tagList = new NBTTagList(); NBTTagList tagList = new NBTTagList();
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){ for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
@ -62,6 +47,23 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
compound.setTag("Items", tagList); compound.setTag("Items", tagList);
} }
} }
}
@Override
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 @Override
public int[] getAccessibleSlotsFromSide(int side){ public int[] getAccessibleSlotsFromSide(int side){

View file

@ -15,13 +15,11 @@ import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; 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.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; 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_INPUT = 0;
public static final int SLOT_OUTPUT = 1; public static final int SLOT_OUTPUT = 1;
@ -71,16 +69,16 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.nextRepairTick = compound.getInteger("NextRepairTick"); this.nextRepairTick = compound.getInteger("NextRepairTick");
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("NextRepairTick", this.nextRepairTick); compound.setInteger("NextRepairTick", this.nextRepairTick);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
} }
@ -131,19 +129,4 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
public boolean canConnectEnergy(ForgeDirection from){ public boolean canConnectEnergy(ForgeDirection from){
return true; 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);
}
} }

View file

@ -31,17 +31,15 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
private int currentWorkTime; private int currentWorkTime;
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound); this.storage.writeToNBT(compound);
this.currentWorkTime = compound.getInteger("WorkTime"); compound.setInteger("WorkTime", this.currentWorkTime);
super.readFromNBT(compound);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound); this.storage.readFromNBT(compound);
compound.setInteger("WorkTime", this.currentWorkTime); this.currentWorkTime = compound.getInteger("WorkTime");
super.writeToNBT(compound);
} }
@Override @Override

View file

@ -29,15 +29,13 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
private int nextUseCounter; private int nextUseCounter;
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound); this.storage.writeToNBT(compound);
super.readFromNBT(compound);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound); this.storage.readFromNBT(compound);
super.writeToNBT(compound);
} }
@Override @Override

View file

@ -16,15 +16,13 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*; 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 EnergyStorage storage = new EnergyStorage(50000);
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME); public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
@ -104,19 +102,19 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.currentBurnTime = compound.getInteger("BurnTime"); this.currentBurnTime = compound.getInteger("BurnTime");
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound); this.tank.readFromNBT(compound);
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
compound.setInteger("BurnTime", this.currentBurnTime); compound.setInteger("BurnTime", this.currentBurnTime);
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound); this.tank.writeToNBT(compound);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
} }
@Override @Override
@ -186,26 +184,4 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
public FluidTankInfo[] getTankInfo(ForgeDirection from){ public FluidTankInfo[] getTankInfo(ForgeDirection from){
return new FluidTankInfo[]{this.tank.getInfo()}; 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);
}
} }

View file

@ -18,8 +18,6 @@ import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.ConfigValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; 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.WorldPos;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -32,7 +30,7 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList; 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_INPUT = 0;
public static final int SLOT_OIL_OUTPUT = 1; public static final int SLOT_OIL_OUTPUT = 1;
@ -182,19 +180,19 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.readFromNBT(compound); this.storage.readFromNBT(compound);
this.tank.readFromNBT(compound); this.tank.readFromNBT(compound);
this.currentWorkTimer = compound.getInteger("CurrentWorkTimer"); this.currentWorkTimer = compound.getInteger("CurrentWorkTimer");
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
this.storage.writeToNBT(compound); this.storage.writeToNBT(compound);
this.tank.writeToNBT(compound); this.tank.writeToNBT(compound);
compound.setInteger("CurrentWorkTimer", this.currentWorkTimer); compound.setInteger("CurrentWorkTimer", this.currentWorkTimer);
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
} }
@Override @Override
@ -264,25 +262,4 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
public FluidTankInfo[] getTankInfo(ForgeDirection from){ public FluidTankInfo[] getTankInfo(ForgeDirection from){
return new FluidTankInfo[]{this.tank.getInfo()}; 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);
}
} }

View file

@ -10,6 +10,8 @@
package ellpeck.actuallyadditions.tile; package ellpeck.actuallyadditions.tile;
import net.minecraft.nbt.NBTTagCompound;
public class TileEntityPhantomBooster extends TileEntityBase{ public class TileEntityPhantomBooster extends TileEntityBase{
@Override @Override
@ -17,4 +19,13 @@ public class TileEntityPhantomBooster extends TileEntityBase{
return false; return false;
} }
@Override
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
}
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
}
} }

View file

@ -138,8 +138,20 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.writeSyncableNBT(compound, sync);
compound.setInteger("Time", currentTime);
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
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readSyncableNBT(compound, sync);
int x = compound.getInteger("XCoordOfTileStored"); int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored"); int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored"); int z = compound.getInteger("ZCoordOfTileStored");
@ -150,18 +162,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
} }
} }
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("Time", currentTime);
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 isItemValidForSlot(int i, ItemStack stack){ public boolean isItemValidForSlot(int i, ItemStack stack){
return !this.isBreaker; return !this.isBreaker;

View file

@ -120,8 +120,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
int x = compound.getInteger("XCoordOfTileStored"); int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored"); int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored"); int z = compound.getInteger("ZCoordOfTileStored");
@ -133,8 +133,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
if(this.hasBoundPosition()){ if(this.hasBoundPosition()){
compound.setInteger("XCoordOfTileStored", boundPosition.getX()); compound.setInteger("XCoordOfTileStored", boundPosition.getX());
compound.setInteger("YCoordOfTileStored", boundPosition.getY()); compound.setInteger("YCoordOfTileStored", boundPosition.getY());

View file

@ -12,8 +12,6 @@ package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.network.gui.IButtonReactor; import ellpeck.actuallyadditions.network.gui.IButtonReactor;
import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient;
import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient;
import ellpeck.actuallyadditions.util.WorldUtil; import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -23,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
import java.util.ArrayList; 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; public static final int WHITELIST_START = 6;
@ -77,15 +75,15 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.writeSyncableNBT(compound, sync);
this.isWhitelist = compound.getBoolean("Whitelist"); compound.setBoolean("Whitelist", this.isWhitelist);
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.readSyncableNBT(compound, sync);
compound.setBoolean("Whitelist", this.isWhitelist); this.isWhitelist = compound.getBoolean("Whitelist");
} }
@Override @Override
@ -107,19 +105,4 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
public void onButtonPressed(int buttonID, EntityPlayer player){ public void onButtonPressed(int buttonID, EntityPlayer player){
this.isWhitelist = !this.isWhitelist; 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);
}
} }

View file

@ -13,14 +13,12 @@ package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.network.gui.IStringReactor; 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.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import java.util.Objects; import java.util.Objects;
public class TileEntitySmileyCloud extends TileEntityBase implements IPacketSyncerToClient, IStringReactor{ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReactor{
public String name; public String name;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@ -30,19 +28,17 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IPacketSync
private String nameBefore; private String nameBefore;
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound);
this.name = compound.getString("Name");
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
if(this.name != null){ if(this.name != null){
compound.setString("Name", this.name); compound.setString("Name", this.name);
} }
} }
@Override
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
this.name = compound.getString("Name");
}
@Override @Override
public void updateEntity(){ public void updateEntity(){
if(!worldObj.isRemote){ if(!worldObj.isRemote){
@ -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 @Override
public void onTextReceived(String text, int textID, EntityPlayer player){ public void onTextReceived(String text, int textID, EntityPlayer player){
this.name = text; this.name = text;

View file

@ -15,13 +15,11 @@ import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemSpecialDrop; import ellpeck.actuallyadditions.items.ItemSpecialDrop;
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
import ellpeck.actuallyadditions.network.gui.IButtonReactor; 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.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor, IPacketSyncerToClient{ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor{
public short amount; public short amount;
private short lastAmount; private short lastAmount;
@ -56,14 +54,14 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readSyncableNBT(NBTTagCompound compound, boolean sync){
super.readFromNBT(compound); super.readSyncableNBT(compound, sync);
this.amount = compound.getShort("Amount"); this.amount = compound.getShort("Amount");
} }
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
super.writeToNBT(compound); super.writeSyncableNBT(compound, sync);
compound.setShort("Amount", this.amount); compound.setShort("Amount", this.amount);
} }
@ -150,19 +148,4 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
} }
return 0; 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);
}
} }

View file

@ -34,7 +34,7 @@ public class PersistentServerData implements IExtendedEntityProperties{
public void saveNBTData(NBTTagCompound aComp){ public void saveNBTData(NBTTagCompound aComp){
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
compound.setBoolean("BookGotten", bookGottenAlready); compound.setBoolean("BookGotten", this.bookGottenAlready);
aComp.setTag(ModUtil.MOD_ID, compound); aComp.setTag(ModUtil.MOD_ID, compound);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB