mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Changed NBT saving system and thus removing some unnecessary interfaces
This commit is contained in:
parent
8461ffea03
commit
794032870a
42 changed files with 464 additions and 656 deletions
|
@ -11,7 +11,8 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -28,17 +29,19 @@ import net.minecraft.inventory.Container;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity{
|
||||
|
@ -112,9 +115,10 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IRedstoneToggle){
|
||||
if(!world.isRemote){
|
||||
((IRedstoneToggle)tile).toggle(!((IRedstoneToggle)tile).isPulseMode());
|
||||
if(tile instanceof TileEntityBase){
|
||||
TileEntityBase base = (TileEntityBase)tile;
|
||||
if(!world.isRemote && base.isRedstoneToggle()){
|
||||
base.isPulseMode = !base.isPulseMode;
|
||||
tile.markDirty();
|
||||
|
||||
if(tile instanceof TileEntityBase){
|
||||
|
@ -141,8 +145,11 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
((IRedstoneToggle)tile).activateOnPulse();
|
||||
if(tile instanceof TileEntityBase){
|
||||
TileEntityBase base = (TileEntityBase)tile;
|
||||
if(base.isRedstoneToggle() && base.isPulseMode){
|
||||
base.activateOnPulse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,16 +163,17 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile instanceof TileEntityBase){
|
||||
TileEntityBase base = (TileEntityBase)tile;
|
||||
boolean powered = world.isBlockIndirectlyGettingPowered(pos) > 0;
|
||||
boolean wasPowered = ((TileEntityBase)tile).isRedstonePowered;
|
||||
boolean wasPowered = base.isRedstonePowered;
|
||||
if(powered && !wasPowered){
|
||||
if(tile instanceof IRedstoneToggle && ((IRedstoneToggle)tile).isPulseMode()){
|
||||
if(base.isRedstoneToggle() && base.isPulseMode){
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||
}
|
||||
((TileEntityBase)tile).setRedstonePowered(true);
|
||||
base.setRedstonePowered(true);
|
||||
}
|
||||
else if(!powered && wasPowered){
|
||||
((TileEntityBase)tile).setRedstonePowered(false);
|
||||
base.setRedstonePowered(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,31 +190,12 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack){
|
||||
if(stack.getTagCompound() != null){
|
||||
if(stack.hasTagCompound()){
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
((IEnergySaver)tile).setEnergy(stack.getTagCompound().getInteger("Energy"));
|
||||
stack.getTagCompound().removeTag("Energy");
|
||||
}
|
||||
|
||||
if(tile instanceof IFluidSaver){
|
||||
int amount = stack.getTagCompound().getInteger("FluidAmount");
|
||||
stack.getTagCompound().removeTag("FluidAmount");
|
||||
|
||||
if(amount > 0){
|
||||
FluidStack[] fluids = new FluidStack[amount];
|
||||
|
||||
for(int i = 0; i < amount; i++){
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Fluid"+i);
|
||||
stack.getTagCompound().removeTag("Fluid"+i);
|
||||
if(compound != null){
|
||||
fluids[i] = FluidStack.loadFluidStackFromNBT(compound);
|
||||
}
|
||||
}
|
||||
|
||||
((IFluidSaver)tile).setFluids(fluids);
|
||||
}
|
||||
if(tile instanceof TileEntityBase){
|
||||
TileEntityBase base = (TileEntityBase)tile;
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
|
||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,36 +235,31 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if(tile != null){
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(state, Util.RANDOM, fortune), 1, this.damageDropped(state));
|
||||
if(tile instanceof TileEntityBase){
|
||||
TileEntityBase base = (TileEntityBase)tile;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
|
||||
if(tile instanceof IEnergySaver){
|
||||
int energy = ((IEnergySaver)tile).getEnergy();
|
||||
if(energy > 0){
|
||||
if(stack.getTagCompound() == null){
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
//Remove unnecessarily saved default values to avoid unstackability
|
||||
List<String> keysToRemove = new ArrayList<String>();
|
||||
for(String key : data.getKeySet()){
|
||||
NBTBase tag = data.getTag(key);
|
||||
//Remove only ints because they are the most common ones
|
||||
//Add else if below here to remove more types
|
||||
if(tag instanceof NBTTagInt){
|
||||
if(((NBTTagInt)tag).getInt() == 0){
|
||||
keysToRemove.add(key);
|
||||
}
|
||||
stack.getTagCompound().setInteger("Energy", energy);
|
||||
}
|
||||
}
|
||||
for(String key : keysToRemove){
|
||||
data.removeTag(key);
|
||||
}
|
||||
|
||||
if(tile instanceof IFluidSaver){
|
||||
FluidStack[] fluids = ((IFluidSaver)tile).getFluids();
|
||||
|
||||
if(fluids != null && fluids.length > 0){
|
||||
if(stack.getTagCompound() == null){
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
stack.getTagCompound().setInteger("FluidAmount", fluids.length);
|
||||
for(int i = 0; i < fluids.length; i++){
|
||||
if(fluids[i] != null && fluids[i].amount > 0){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
fluids[i].writeToNBT(compound);
|
||||
stack.getTagCompound().setTag("Fluid"+i, compound);
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(state, Util.RANDOM, fortune), 1, this.damageDropped(state));
|
||||
if(!data.hasNoTags()){
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setTag("Data", data);
|
||||
}
|
||||
|
||||
drops.add(stack);
|
||||
|
|
|
@ -12,7 +12,7 @@ package de.ellpeck.actuallyadditions.mod.event;
|
|||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.IRedstoneToggle;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
|
@ -61,18 +61,21 @@ public class HudEvent{
|
|||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(tileHit instanceof IRedstoneToggle){
|
||||
profiler.startSection("RedstoneToggleHudDisplay");
|
||||
if(tileHit instanceof TileEntityBase){
|
||||
TileEntityBase base = (TileEntityBase)tileHit;
|
||||
if(base.isRedstoneToggle()){
|
||||
profiler.startSection("RedstoneToggleHudDisplay");
|
||||
|
||||
String strg = "Redstone Mode: "+TextFormatting.DARK_RED+(((IRedstoneToggle)tileHit).isPulseMode() ? "Pulse" : "Deactivation")+TextFormatting.RESET;
|
||||
font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
String strg = "Redstone Mode: "+TextFormatting.DARK_RED+(base.isPulseMode ? "Pulse" : "Deactivation")+TextFormatting.RESET;
|
||||
font.drawStringWithShadow(strg, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
|
||||
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
||||
String expl = TextFormatting.GREEN+"Right-Click to toggle!";
|
||||
font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){
|
||||
String expl = TextFormatting.GREEN+"Right-Click to toggle!";
|
||||
font.drawStringWithShadow(expl, event.getResolution().getScaledWidth()/2+5, event.getResolution().getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
}
|
||||
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
if(tileHit instanceof IEnergyDisplay){
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* This file ("IEnergySaver.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://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
public interface IEnergySaver{
|
||||
|
||||
int getEnergy();
|
||||
|
||||
void setEnergy(int energy);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* This file ("IFluidSaver.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://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IFluidSaver{
|
||||
|
||||
FluidStack[] getFluids();
|
||||
|
||||
void setFluids(FluidStack[] fluids);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* This file ("IRedstoneToggle.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://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.tile;
|
||||
|
||||
public interface IRedstoneToggle{
|
||||
|
||||
void toggle(boolean to);
|
||||
|
||||
boolean isPulseMode();
|
||||
|
||||
void activateOnPulse();
|
||||
}
|
|
@ -30,13 +30,12 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver, IRedstoneToggle, IEnergyDisplay, IAtomicReconstructor{
|
||||
public class TileEntityAtomicReconstructor extends TileEntityInventoryBase implements IEnergyReceiver, IEnergyDisplay, IAtomicReconstructor{
|
||||
|
||||
public static final int ENERGY_USE = 1000;
|
||||
public final EnergyStorage storage = new EnergyStorage(300000);
|
||||
public int counter;
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
private int oldEnergy;
|
||||
|
||||
public TileEntityAtomicReconstructor(){
|
||||
|
@ -51,10 +50,12 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
compound.setInteger("Counter", this.counter);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
compound.setInteger("Counter", this.counter);
|
||||
}
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -64,10 +65,12 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
this.counter = compound.getInteger("Counter");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
this.counter = compound.getInteger("Counter");
|
||||
}
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -75,7 +78,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.isRedstonePowered && !this.activateOnceWithSignal){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
if(this.currentTime > 0){
|
||||
this.currentTime--;
|
||||
if(this.currentTime <= 0){
|
||||
|
@ -198,11 +201,6 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMaxEnergy(){
|
||||
|
@ -210,13 +208,8 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public void toggle(boolean to){
|
||||
this.activateOnceWithSignal = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPulseMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,6 +40,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
|||
public static boolean teslaLoaded;
|
||||
public final String name;
|
||||
public boolean isRedstonePowered;
|
||||
public boolean isPulseMode;
|
||||
protected int ticksElapsed;
|
||||
|
||||
public TileEntityBase(String name){
|
||||
|
@ -113,14 +114,14 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
|||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.readSyncableNBT(compound, false);
|
||||
this.readSyncableNBT(compound, NBTType.SAVE_TILE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound){
|
||||
compound = super.writeToNBT(compound);
|
||||
this.writeSyncableNBT(compound, false);
|
||||
this.writeSyncableNBT(compound, NBTType.SAVE_TILE);
|
||||
return compound;
|
||||
}
|
||||
|
||||
|
@ -148,13 +149,13 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
|||
}
|
||||
|
||||
public void receiveSyncCompound(NBTTagCompound compound){
|
||||
this.readSyncableNBT(compound, true);
|
||||
this.readSyncableNBT(compound, NBTType.SYNC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag(){
|
||||
NBTTagCompound tag = super.getUpdateTag();
|
||||
this.writeSyncableNBT(tag, true);
|
||||
this.writeSyncableNBT(tag, NBTType.SYNC);
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
@ -163,21 +164,21 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
|||
this.receiveSyncCompound(compound);
|
||||
}
|
||||
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
if(!isForSync){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type == NBTType.SAVE_TILE){
|
||||
compound.setBoolean("Redstone", this.isRedstonePowered);
|
||||
}
|
||||
if(this instanceof IRedstoneToggle){
|
||||
compound.setBoolean("IsPulseMode", ((IRedstoneToggle)this).isPulseMode());
|
||||
if(this.isRedstoneToggle() && (type != NBTType.SAVE_BLOCK || this.isPulseMode)){
|
||||
compound.setBoolean("IsPulseMode", this.isPulseMode);
|
||||
}
|
||||
}
|
||||
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
if(!isForSync){
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type == NBTType.SAVE_TILE){
|
||||
this.isRedstonePowered = compound.getBoolean("Redstone");
|
||||
}
|
||||
if(this instanceof IRedstoneToggle){
|
||||
((IRedstoneToggle)this).toggle(compound.getBoolean("IsPulseMode"));
|
||||
if(this.isRedstoneToggle()){
|
||||
this.isPulseMode = compound.getBoolean("IsPulseMode");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,4 +259,18 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
|||
public IFluidHandler getFluidHandler(EnumFacing facing){
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isRedstoneToggle(){
|
||||
return false;
|
||||
}
|
||||
|
||||
public void activateOnPulse(){
|
||||
|
||||
}
|
||||
|
||||
public enum NBTType{
|
||||
SAVE_TILE,
|
||||
SYNC,
|
||||
SAVE_BLOCK
|
||||
}
|
||||
}
|
|
@ -23,19 +23,23 @@ public class TileEntityBookletStand extends TileEntityBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.writeSyncableNBT(compound, isForSync);
|
||||
compound.setTag("SavedEntry", this.assignedEntry.writeToNBT());
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setTag("SavedEntry", this.assignedEntry.writeToNBT());
|
||||
|
||||
if(this.assignedPlayer != null){
|
||||
compound.setString("Player", this.assignedPlayer);
|
||||
if(this.assignedPlayer != null){
|
||||
compound.setString("Player", this.assignedPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.readSyncableNBT(compound, isForSync);
|
||||
this.assignedEntry = EntrySet.readFromNBT(compound.getCompoundTag("SavedEntry"));
|
||||
this.assignedPlayer = compound.getString("Player");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.assignedEntry = EntrySet.readFromNBT(compound.getCompoundTag("SavedEntry"));
|
||||
this.assignedPlayer = compound.getString("Player");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,11 +26,10 @@ import net.minecraftforge.event.ForgeEventFactory;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityBreaker extends TileEntityInventoryBase implements IRedstoneToggle{
|
||||
public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||
|
||||
public boolean isPlacer;
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityBreaker(int slots, String name){
|
||||
super(slots, name);
|
||||
|
@ -42,22 +41,26 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.isRedstonePowered && !this.activateOnceWithSignal){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
if(this.currentTime > 0){
|
||||
this.currentTime--;
|
||||
if(this.currentTime <= 0){
|
||||
|
@ -117,13 +120,8 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst
|
|||
}
|
||||
|
||||
@Override
|
||||
public void toggle(boolean to){
|
||||
this.activateOnceWithSignal = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPulseMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver, IFluidSaver, net.minecraftforge.fluids.IFluidHandler{
|
||||
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, net.minecraftforge.fluids.IFluidHandler{
|
||||
|
||||
public static final int PRODUCE = 80;
|
||||
public static final int ENERGY_USE = 35;
|
||||
|
@ -62,19 +62,23 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
}
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
super.writeSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
}
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,26 +153,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getFluids(){
|
||||
return new FluidStack[]{this.tank.getFluid()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluids(FluidStack[] fluids){
|
||||
this.tank.setFluid(fluids[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getFluidHandler(EnumFacing facing){
|
||||
return facing != EnumFacing.UP ? this.tank : null;
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider, IEnergySaver{
|
||||
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider{
|
||||
|
||||
public static final int PRODUCE = 30;
|
||||
public final EnergyStorage storage = new EnergyStorage(60000);
|
||||
|
@ -44,19 +44,23 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||
}
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
super.writeSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||
}
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,14 +131,4 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, IEnergyReceiver, IFluidSaver, IEnergySaver, net.minecraftforge.fluids.IFluidHandler{
|
||||
public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, IEnergyReceiver, net.minecraftforge.fluids.IFluidHandler{
|
||||
|
||||
public static final int SLOT_COFFEE_BEANS = 0;
|
||||
public static final int SLOT_INPUT = 1;
|
||||
|
@ -85,21 +85,25 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
compound.setInteger("Cache", this.coffeeCacheAmount);
|
||||
compound.setInteger("Time", this.brewTime);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("Cache", this.coffeeCacheAmount);
|
||||
compound.setInteger("Time", this.brewTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
this.coffeeCacheAmount = compound.getInteger("Cache");
|
||||
this.brewTime = compound.getInteger("Time");
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.coffeeCacheAmount = compound.getInteger("Cache");
|
||||
this.brewTime = compound.getInteger("Time");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -218,26 +222,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getFluids(){
|
||||
return new FluidStack[]{this.tank.getFluid()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluids(FluidStack[] fluids){
|
||||
this.tank.setFluid(fluids[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank getFluidHandler(EnumFacing facing){
|
||||
return facing != EnumFacing.DOWN ? this.tank : null;
|
||||
|
|
|
@ -36,9 +36,11 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("ConversionTime", this.conversionTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("ConversionTime", this.conversionTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,9 +49,11 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.conversionTime = compound.getInteger("ConversionTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.conversionTime = compound.getInteger("ConversionTime");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,38 +28,41 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver, IRedstoneToggle{
|
||||
public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int RANGE = 8;
|
||||
public static final int ENERGY_USE = 5;
|
||||
public final EnergyStorage storage = new EnergyStorage(10000);
|
||||
private int lastEnergy;
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityDirectionalBreaker(){
|
||||
super(9, "directionalBreaker");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.isRedstonePowered && !this.activateOnceWithSignal){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
if(this.currentTime > 0){
|
||||
this.currentTime--;
|
||||
if(this.currentTime <= 0){
|
||||
|
@ -144,24 +147,10 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle(boolean to){
|
||||
this.activateOnceWithSignal = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPulseMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -74,14 +74,14 @@ public class TileEntityDisplayStand extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.writeSyncableNBT(compound, isForSync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.readSyncableNBT(compound, isForSync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,32 +16,35 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public class TileEntityDropper extends TileEntityInventoryBase implements IRedstoneToggle{
|
||||
public class TileEntityDropper extends TileEntityInventoryBase{
|
||||
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityDropper(){
|
||||
super(9, "dropper");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.isRedstonePowered && !this.activateOnceWithSignal){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
if(this.currentTime > 0){
|
||||
this.currentTime--;
|
||||
if(this.currentTime <= 0){
|
||||
|
@ -95,13 +98,8 @@ public class TileEntityDropper extends TileEntityInventoryBase implements IRedst
|
|||
}
|
||||
|
||||
@Override
|
||||
public void toggle(boolean to){
|
||||
this.activateOnceWithSignal = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPulseMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityEnergizer extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver{
|
||||
public class TileEntityEnergizer extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public final EnergyStorage storage = new EnergyStorage(500000);
|
||||
private int lastEnergy;
|
||||
|
@ -29,15 +29,15 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
super.writeSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,14 +104,4 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityEnervator extends TileEntityInventoryBase implements IEnergyProvider, IEnergySaver{
|
||||
public class TileEntityEnervator extends TileEntityInventoryBase implements IEnergyProvider{
|
||||
|
||||
public final EnergyStorage storage = new EnergyStorage(500000);
|
||||
private int lastEnergy;
|
||||
|
@ -29,15 +29,15 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
super.writeSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,14 +104,4 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
public boolean canExtractItem(int slot, ItemStack stack, EnumFacing side){
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,19 +41,19 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
compound.setInteger("Timer", this.currentTimer);
|
||||
if(sync){
|
||||
if(type == NBTType.SYNC){
|
||||
compound.setInteger("Animals", this.currentAnimalAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.currentTimer = compound.getInteger("Timer");
|
||||
if(sync){
|
||||
if(type == NBTType.SYNC){
|
||||
this.currentAnimalAmount = compound.getInteger("Animals");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import net.minecraftforge.fluids.capability.templates.FluidHandlerFluidMap;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityFermentingBarrel extends TileEntityBase implements IFluidSaver, net.minecraftforge.fluids.IFluidHandler{
|
||||
public class TileEntityFermentingBarrel extends TileEntityBase implements net.minecraftforge.fluids.IFluidHandler{
|
||||
|
||||
private static final int PROCESS_TIME = 100;
|
||||
public final FluidTank canolaTank = new FluidTank(2*Util.BUCKET){
|
||||
|
@ -51,21 +51,21 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IFluid
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
this.canolaTank.writeToNBT(compound);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.oilTank.writeToNBT(tag);
|
||||
compound.setTag("OilTank", tag);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
super.writeSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
this.canolaTank.readFromNBT(compound);
|
||||
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
|
||||
super.readSyncableNBT(compound, sync);
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,18 +122,6 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IFluid
|
|||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getFluids(){
|
||||
return new FluidStack[]{this.oilTank.getFluid(), this.canolaTank.getFluid()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluids(FluidStack[] fluids){
|
||||
this.oilTank.setFluid(fluids[0]);
|
||||
this.canolaTank.setFluid(fluids[1]);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill){
|
||||
IFluidHandler handler = this.getFluidHandler(from);
|
||||
|
|
|
@ -25,12 +25,11 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityFireworkBox extends TileEntityBase implements IEnergyReceiver, IRedstoneToggle, IEnergyDisplay, IEnergySaver{
|
||||
public class TileEntityFireworkBox extends TileEntityBase implements IEnergyReceiver, IEnergyDisplay{
|
||||
|
||||
public static final int USE_PER_SHOT = 300;
|
||||
public final EnergyStorage storage = new EnergyStorage(20000);
|
||||
private int timeUntilNextFirework;
|
||||
private boolean activateOnceWithSignal;
|
||||
private int oldEnergy;
|
||||
|
||||
public TileEntityFireworkBox(){
|
||||
|
@ -94,21 +93,21 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.isRedstonePowered && !this.activateOnceWithSignal){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
if(this.timeUntilNextFirework > 0){
|
||||
this.timeUntilNextFirework--;
|
||||
if(this.timeUntilNextFirework <= 0){
|
||||
|
@ -155,13 +154,8 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
|
|||
}
|
||||
|
||||
@Override
|
||||
public void toggle(boolean to){
|
||||
this.activateOnceWithSignal = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPulseMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -174,11 +168,6 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
|
|||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMaxEnergy(){
|
||||
|
|
|
@ -37,15 +37,19 @@ public class TileEntityFishingNet extends TileEntityBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityFluidCollector extends TileEntityBase implements IFluidSaver, IRedstoneToggle, net.minecraftforge.fluids.IFluidHandler{
|
||||
public class TileEntityFluidCollector extends TileEntityBase implements net.minecraftforge.fluids.IFluidHandler{
|
||||
|
||||
public final FluidTank tank = new FluidTank(8*Util.BUCKET){
|
||||
@Override
|
||||
|
@ -42,7 +42,6 @@ public class TileEntityFluidCollector extends TileEntityBase implements IFluidSa
|
|||
public boolean isPlacer;
|
||||
private int lastTankAmount;
|
||||
private int currentTime;
|
||||
private boolean activateOnceWithSignal;
|
||||
|
||||
public TileEntityFluidCollector(String name){
|
||||
super(name);
|
||||
|
@ -54,13 +53,8 @@ public class TileEntityFluidCollector extends TileEntityBase implements IFluidSa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void toggle(boolean to){
|
||||
this.activateOnceWithSignal = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPulseMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,16 +109,20 @@ public class TileEntityFluidCollector extends TileEntityBase implements IFluidSa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
this.tank.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
this.tank.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -132,7 +130,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements IFluidSa
|
|||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!this.worldObj.isRemote){
|
||||
if(!this.isRedstonePowered && !this.activateOnceWithSignal){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
if(this.currentTime > 0){
|
||||
this.currentTime--;
|
||||
if(this.currentTime <= 0){
|
||||
|
@ -155,16 +153,6 @@ public class TileEntityFluidCollector extends TileEntityBase implements IFluidSa
|
|||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getFluids(){
|
||||
return new FluidStack[]{this.tank.getFluid()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluids(FluidStack[] fluids){
|
||||
this.tank.setFluid(fluids[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill){
|
||||
IFluidHandler handler = this.getFluidHandler(from);
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver{
|
||||
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_INPUT_1 = 0;
|
||||
public static final int SLOT_OUTPUT_1 = 1;
|
||||
|
@ -40,18 +40,22 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||
}
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
||||
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
||||
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
||||
}
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -191,14 +195,4 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyProvider, IEnergySaver, IEnergyDisplay{
|
||||
public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyProvider, IEnergyDisplay{
|
||||
|
||||
public static final int PRODUCE = 8;
|
||||
public final EnergyStorage storage = new EnergyStorage(30000);
|
||||
|
@ -50,14 +50,14 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -93,11 +93,6 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
|
|||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMaxEnergy(){
|
||||
|
|
|
@ -29,15 +29,19 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.writeSyncableNBT(compound, isForSync);
|
||||
this.timeUntilNextFert = compound.getInteger("Time");
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.timeUntilNextFert = compound.getInteger("Time");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.readSyncableNBT(compound, isForSync);
|
||||
compound.setInteger("Time", this.timeUntilNextFert);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("Time", this.timeUntilNextFert);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver{
|
||||
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_INPUT_1 = 0;
|
||||
public static final int SLOT_OUTPUT_1_1 = 1;
|
||||
|
@ -74,19 +74,23 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||
}
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
super.writeSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||
}
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -263,14 +267,4 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileEntityHeatCollector extends TileEntityBase implements IEnergyProvider, IEnergySaver, IEnergyDisplay{
|
||||
public class TileEntityHeatCollector extends TileEntityBase implements IEnergyProvider, IEnergyDisplay{
|
||||
|
||||
public static final int ENERGY_PRODUCE = 40;
|
||||
public static final int BLOCKS_NEEDED = 4;
|
||||
|
@ -37,14 +37,14 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.writeSyncableNBT(compound, isForSync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.readSyncableNBT(compound, isForSync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -104,11 +104,6 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
|
|||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMaxEnergy(){
|
||||
|
|
|
@ -354,29 +354,33 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
compound.setInteger("SideToPull", this.sideToPull);
|
||||
compound.setInteger("SlotToPull", this.slotToPullStart);
|
||||
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
|
||||
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
|
||||
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("SideToPut", this.sideToPut);
|
||||
compound.setInteger("SlotToPut", this.slotToPutStart);
|
||||
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
|
||||
compound.setInteger("SideToPull", this.sideToPull);
|
||||
compound.setInteger("SlotToPull", this.slotToPullStart);
|
||||
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
|
||||
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
|
||||
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.sideToPut = compound.getInteger("SideToPut");
|
||||
this.slotToPutStart = compound.getInteger("SlotToPut");
|
||||
this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
|
||||
this.sideToPull = compound.getInteger("SideToPull");
|
||||
this.slotToPullStart = compound.getInteger("SlotToPull");
|
||||
this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
|
||||
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
|
||||
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.sideToPut = compound.getInteger("SideToPut");
|
||||
this.slotToPutStart = compound.getInteger("SlotToPut");
|
||||
this.slotToPutEnd = compound.getInteger("SlotToPutEnd");
|
||||
this.sideToPull = compound.getInteger("SideToPull");
|
||||
this.slotToPullStart = compound.getInteger("SlotToPull");
|
||||
this.slotToPullEnd = compound.getInteger("SlotToPullEnd");
|
||||
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
|
||||
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
|
||||
}
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -68,9 +68,9 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.writeSyncableNBT(compound, isForSync);
|
||||
if(!isForSync || this.shouldSyncSlots()){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type == NBTType.SAVE_TILE || (type == NBTType.SYNC && this.shouldSyncSlots())){
|
||||
saveSlots(this.slots, compound);
|
||||
}
|
||||
}
|
||||
|
@ -80,9 +80,9 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.readSyncableNBT(compound, isForSync);
|
||||
if(!isForSync || this.shouldSyncSlots()){
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type == NBTType.SAVE_TILE || (type == NBTType.SYNC && this.shouldSyncSlots())){
|
||||
loadSlots(this.slots, compound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraft.util.EnumFacing;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityItemRepairer extends TileEntityInventoryBase implements IEnergyReceiver, IEnergySaver{
|
||||
public class TileEntityItemRepairer extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_INPUT = 0;
|
||||
public static final int SLOT_OUTPUT = 1;
|
||||
|
@ -56,16 +56,20 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||
}
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||
}
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -147,14 +151,4 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
public boolean canConnectEnergy(EnumFacing from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,9 +194,9 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.writeSyncableNBT(compound, isForSync);
|
||||
if(!isForSync){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type == NBTType.SAVE_TILE){
|
||||
TileEntityInventoryBase.saveSlots(this.slots, compound);
|
||||
}
|
||||
compound.setBoolean("LeftWhitelist", this.isLeftWhitelist);
|
||||
|
@ -204,9 +204,9 @@ public class TileEntityLaserRelayItemWhitelist extends TileEntityLaserRelayItem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
super.readSyncableNBT(compound, isForSync);
|
||||
if(!isForSync){
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type == NBTType.SAVE_TILE){
|
||||
TileEntityInventoryBase.loadSlots(this.slots, compound);
|
||||
}
|
||||
this.isLeftWhitelist = compound.getBoolean("LeftWhitelist");
|
||||
|
|
|
@ -23,7 +23,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityLavaFactoryController extends TileEntityBase implements IEnergyReceiver, IEnergySaver, IEnergyDisplay{
|
||||
public class TileEntityLavaFactoryController extends TileEntityBase implements IEnergyReceiver, IEnergyDisplay{
|
||||
|
||||
public static final int NOT_MULTI = 0;
|
||||
public static final int HAS_LAVA = 1;
|
||||
|
@ -38,17 +38,21 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
compound.setInteger("WorkTime", this.currentWorkTime);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("WorkTime", this.currentWorkTime);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.currentWorkTime = compound.getInteger("WorkTime");
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentWorkTime = compound.getInteger("WorkTime");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,11 +123,6 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I
|
|||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMaxEnergy(){
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyProvider, IEnergySaver, IEnergyDisplay{
|
||||
public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyProvider, IEnergyDisplay{
|
||||
|
||||
public static final int RANGE = 7;
|
||||
public static final int ENERGY_PRODUCED = 300;
|
||||
|
@ -39,14 +39,14 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
|
@ -128,11 +128,6 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr
|
|||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMaxEnergy(){
|
||||
|
|
|
@ -35,13 +35,13 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyReceiver, IButtonReactor, IEnergySaver, IEnergyDisplay{
|
||||
public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyReceiver, IButtonReactor, IEnergyDisplay{
|
||||
|
||||
public static final int ENERGY_USE_PER_BLOCK = 1000;
|
||||
public static final int DEFAULT_RANGE = 2;
|
||||
public final EnergyStorage storage = new EnergyStorage(200000);
|
||||
public int layerAt = -1;
|
||||
public boolean onlyMineOres = true;
|
||||
public boolean onlyMineOres;
|
||||
private int oldLayerAt;
|
||||
private int oldEnergy;
|
||||
|
||||
|
@ -50,18 +50,24 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
this.storage.writeToNBT(compound);
|
||||
compound.setInteger("Layer", this.layerAt);
|
||||
compound.setBoolean("OnlyOres", this.onlyMineOres);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("Layer", this.layerAt);
|
||||
}
|
||||
if(type != NBTType.SAVE_BLOCK || this.onlyMineOres){
|
||||
compound.setBoolean("OnlyOres", this.onlyMineOres);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.storage.readFromNBT(compound);
|
||||
this.layerAt = compound.getInteger("Layer");
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.layerAt = compound.getInteger("Layer");
|
||||
}
|
||||
this.onlyMineOres = compound.getBoolean("OnlyOres");
|
||||
}
|
||||
|
||||
|
@ -232,11 +238,6 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR
|
|||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getMaxEnergy(){
|
||||
|
|
|
@ -22,7 +22,7 @@ import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityOilGenerator extends TileEntityBase implements IEnergyProvider, IEnergySaver, IFluidSaver, net.minecraftforge.fluids.IFluidHandler{
|
||||
public class TileEntityOilGenerator extends TileEntityBase implements IEnergyProvider, net.minecraftforge.fluids.IFluidHandler{
|
||||
|
||||
public static final int ENERGY_PRODUCED = 76;
|
||||
private static final int BURN_TIME = 100;
|
||||
|
@ -63,19 +63,23 @@ public class TileEntityOilGenerator extends TileEntityBase implements IEnergyPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
}
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
super.writeSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
}
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readSyncableNBT(compound, sync);
|
||||
super.readSyncableNBT(compound, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -134,26 +138,6 @@ public class TileEntityOilGenerator extends TileEntityBase implements IEnergyPro
|
|||
return facing != EnumFacing.DOWN ? this.tank : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy(){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(int energy){
|
||||
this.storage.setEnergyStored(energy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack[] getFluids(){
|
||||
return new FluidStack[]{this.tank.getFluid()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluids(FluidStack[] fluids){
|
||||
this.tank.setFluid(fluids[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill){
|
||||
IFluidHandler handler = this.getFluidHandler(from);
|
||||
|
|
|
@ -29,14 +29,13 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile, IRedstoneToggle{
|
||||
public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements IPhantomTile{
|
||||
|
||||
public static final int RANGE = 3;
|
||||
public BlockPos boundPosition;
|
||||
public int currentTime;
|
||||
public int range;
|
||||
public boolean isBreaker;
|
||||
private boolean activateOnceWithSignal;
|
||||
private int oldRange;
|
||||
|
||||
public TileEntityPhantomPlacer(int slots, String name){
|
||||
|
@ -49,26 +48,30 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("Range", this.range);
|
||||
if(this.boundPosition != null){
|
||||
compound.setInteger("XCoordOfTileStored", this.boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", this.boundPosition.getY());
|
||||
compound.setInteger("ZCoordOfTileStored", this.boundPosition.getZ());
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("Range", this.range);
|
||||
if(this.boundPosition != null){
|
||||
compound.setInteger("XCoordOfTileStored", this.boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", this.boundPosition.getY());
|
||||
compound.setInteger("ZCoordOfTileStored", this.boundPosition.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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");
|
||||
this.range = compound.getInteger("Range");
|
||||
if(!(x == 0 && y == 0 && z == 0)){
|
||||
this.boundPosition = new BlockPos(x, y, z);
|
||||
this.markDirty();
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
int x = compound.getInteger("XCoordOfTileStored");
|
||||
int y = compound.getInteger("YCoordOfTileStored");
|
||||
int z = compound.getInteger("ZCoordOfTileStored");
|
||||
this.range = compound.getInteger("Range");
|
||||
if(!(x == 0 && y == 0 && z == 0)){
|
||||
this.boundPosition = new BlockPos(x, y, z);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +86,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
if(this.isBoundThingInRange()){
|
||||
if(!this.isRedstonePowered && !this.activateOnceWithSignal){
|
||||
if(!this.isRedstonePowered && !this.isPulseMode){
|
||||
if(this.currentTime > 0){
|
||||
this.currentTime--;
|
||||
if(this.currentTime <= 0){
|
||||
|
@ -207,13 +210,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void toggle(boolean to){
|
||||
this.activateOnceWithSignal = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPulseMode(){
|
||||
return this.activateOnceWithSignal;
|
||||
public boolean isRedstoneToggle(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -57,26 +57,30 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setInteger("Range", this.range);
|
||||
if(this.boundPosition != null){
|
||||
compound.setInteger("XCoordOfTileStored", this.boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", this.boundPosition.getY());
|
||||
compound.setInteger("ZCoordOfTileStored", this.boundPosition.getZ());
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setInteger("Range", this.range);
|
||||
if(this.boundPosition != null){
|
||||
compound.setInteger("XCoordOfTileStored", this.boundPosition.getX());
|
||||
compound.setInteger("YCoordOfTileStored", this.boundPosition.getY());
|
||||
compound.setInteger("ZCoordOfTileStored", this.boundPosition.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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");
|
||||
this.range = compound.getInteger("Range");
|
||||
if(!(x == 0 && y == 0 && z == 0)){
|
||||
this.boundPosition = new BlockPos(x, y, z);
|
||||
this.markDirty();
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
int x = compound.getInteger("XCoordOfTileStored");
|
||||
int y = compound.getInteger("YCoordOfTileStored");
|
||||
int z = compound.getInteger("ZCoordOfTileStored");
|
||||
this.range = compound.getInteger("Range");
|
||||
if(!(x == 0 && y == 0 && z == 0)){
|
||||
this.boundPosition = new BlockPos(x, y, z);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,17 +76,17 @@ public class TileEntityPlayerInterface extends TileEntityInventoryBase implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
this.storage.writeToNBT(compound);
|
||||
if(this.connectedPlayer != null){
|
||||
if(this.connectedPlayer != null && type != NBTType.SAVE_BLOCK){
|
||||
compound.setUniqueId("Player", this.connectedPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
this.storage.readFromNBT(compound);
|
||||
if(compound.hasKey("PlayerLeast")){
|
||||
if(compound.hasKey("PlayerLeast") && type != NBTType.SAVE_BLOCK){
|
||||
this.connectedPlayer = compound.getUniqueId("Player");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,15 +33,19 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
compound.setBoolean("Whitelist", this.isWhitelist);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
compound.setBoolean("Whitelist", this.isWhitelist);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.isWhitelist = compound.getBoolean("Whitelist");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.isWhitelist = compound.getBoolean("Whitelist");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,17 +25,19 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
if(this.name != null){
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
if(this.name != null && type != NBTType.SAVE_BLOCK){
|
||||
compound.setString("Name", this.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
this.name = compound.getString("Name");
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
if(type != NBTType.SAVE_BLOCK){
|
||||
this.name = compound.getString("Name");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -98,14 +98,14 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.writeSyncableNBT(compound, sync);
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.writeSyncableNBT(compound, type);
|
||||
compound.setShort("Amount", this.amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readSyncableNBT(NBTTagCompound compound, boolean sync){
|
||||
super.readSyncableNBT(compound, sync);
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type){
|
||||
super.readSyncableNBT(compound, type);
|
||||
this.amount = compound.getShort("Amount");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue