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