Fixed everything.

Just, everything works now.
Promise.
No, actually, no promise.
This commit is contained in:
Ellpeck 2016-07-06 21:56:15 +02:00
parent 3cacb98968
commit 232c23669a
14 changed files with 30 additions and 13 deletions

View file

@ -92,6 +92,8 @@ public class BlockInputter extends BlockContainerBase{
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
super.neighborChanged(state, world, pos, block);
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityInputter){

View file

@ -35,6 +35,8 @@ public class BlockItemViewer extends BlockContainerBase{
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
super.neighborChanged(state, world, pos, block);
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityItemViewer){

View file

@ -118,6 +118,8 @@ public class BlockLaserRelay extends BlockContainerBase{
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
super.neighborChanged(state, world, pos, block);
if(!world.isRemote){
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileEntityLaserRelay){

View file

@ -156,6 +156,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn){
super.neighborChanged(state, worldIn, pos, blockIn);
this.updateRedstoneState(worldIn, pos);
}

View file

@ -108,7 +108,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
Lens currentLens = this.getLens();
int distance = currentLens.getDistance();
for(int i = 0; i < distance; i++){
BlockPos hitBlock = this.pos.offset(sideToManipulate, i);
BlockPos hitBlock = this.pos.offset(sideToManipulate, i+1);
if(currentLens.invoke(this.worldObj.getBlockState(hitBlock), hitBlock, this)){
shootLaser(this.worldObj, this.getX(), this.getY(), this.getZ(), hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens);

View file

@ -157,11 +157,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
}
}
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState){
return !(oldState.getBlock().isAssociatedBlock(newState.getBlock()));
}
public void receiveSyncCompound(NBTTagCompound compound){
this.readSyncableNBT(compound, NBTType.SYNC);
}
@ -175,9 +170,15 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
@Override
public void handleUpdateTag(NBTTagCompound compound){
super.handleUpdateTag(compound);
this.receiveSyncCompound(compound);
}
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState){
return !oldState.getBlock().isAssociatedBlock(newState.getBlock());
}
public void writeSyncableNBT(NBTTagCompound compound, NBTType type){
if(type == NBTType.SAVE_TILE){
compound.setBoolean("Redstone", this.isRedstonePowered);

View file

@ -82,7 +82,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
IBlockState state = this.worldObj.getBlockState(this.pos);
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state));
BlockPos coordsBlock = this.pos.offset(sideToManipulate, 0);
BlockPos coordsBlock = this.pos.offset(sideToManipulate);
IBlockState stateToBreak = this.worldObj.getBlockState(coordsBlock);
Block blockToBreak = stateToBreak.getBlock();
if(!this.isPlacer && blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(stateToBreak, this.worldObj, coordsBlock) > -1.0F){

View file

@ -86,7 +86,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(state.getBlock().getMetaFromState(state));
for(int i = 0; i < RANGE; i++){
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i);
BlockPos coordsBlock = this.pos.offset(sideToManipulate, i+1);
Block blockToBreak = this.worldObj.getBlockState(coordsBlock).getBlock();
if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(this.worldObj.getBlockState(coordsBlock), this.worldObj, this.pos) > -1.0F){
List<ItemStack> drops = blockToBreak.getDrops(this.worldObj, coordsBlock, this.worldObj.getBlockState(coordsBlock), 0);

View file

@ -106,6 +106,8 @@ public class TileEntityFireworkBox extends TileEntityBase implements IEnergyRece
@Override
public void updateEntity(){
super.updateEntity();
if(!this.worldObj.isRemote){
if(!this.isRedstonePowered && !this.isPulseMode){
if(this.timeUntilNextFirework > 0){

View file

@ -65,7 +65,7 @@ public class TileEntityFluidCollector extends TileEntityBase implements net.mine
IBlockState state = this.worldObj.getBlockState(this.pos);
Block block = state.getBlock();
EnumFacing sideToManipulate = WorldUtil.getDirectionByPistonRotation(block.getMetaFromState(state));
BlockPos coordsBlock = this.pos.offset(sideToManipulate, 0);
BlockPos coordsBlock = this.pos.offset(sideToManipulate);
IBlockState stateToBreak = this.worldObj.getBlockState(coordsBlock);
Block blockToBreak = stateToBreak.getBlock();

View file

@ -80,7 +80,7 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
public boolean hasBlockAbove(){
for(int y = 1; y <= this.worldObj.getHeight(); y++){
BlockPos offset = this.pos.down(y);
BlockPos offset = this.pos.up(y);
IBlockState state = this.worldObj.getBlockState(offset);
if(!state.getBlock().isAir(state, this.worldObj, offset)){
return true;

View file

@ -76,8 +76,8 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{
public BlockPos blockToFertilize(){
for(int i = this.pos.getY()-1; i > 0; i--){
BlockPos offset = new BlockPos(this.pos.getX(), i, this.pos.getZ());
Block block = this.worldObj.getBlockState(this.pos).getBlock();
if(block != null && !(this.worldObj.isAirBlock(offset))){
Block block = this.worldObj.getBlockState(offset).getBlock();
if(block != null && !this.worldObj.isAirBlock(offset)){
if((block instanceof IGrowable || block instanceof IPlantable) && !(block instanceof BlockGrass)){
return offset;
}

View file

@ -114,7 +114,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
this.boundPosBefore = this.boundPosition;
this.boundBlockBefore = this.boundPosition == null ? null : this.worldObj.getBlockState(this.boundPosition).getBlock();
this.worldObj.notifyNeighborsOfStateChange(this.pos, this.worldObj.getBlockState(this.boundPosition).getBlock());
if(this.boundPosition != null){
this.worldObj.notifyNeighborsOfStateChange(this.pos, this.worldObj.getBlockState(this.boundPosition).getBlock());
}
this.sendUpdate();
this.markDirty();

View file

@ -25,6 +25,7 @@ public class TileEntityPlayerInterface extends TileEntityInventoryBase implement
public static final int DEFAULT_RANGE = 32;
public UUID connectedPlayer;
private final EnergyStorage storage = new EnergyStorage(30000);
private int oldEnergy;
private int range;
public TileEntityPlayerInterface(){
@ -72,6 +73,10 @@ public class TileEntityPlayerInterface extends TileEntityInventoryBase implement
this.markDirty();
this.sendUpdate();
}
if(this.storage.getEnergyStored() != this.oldEnergy && this.sendUpdateWithInterval()){
this.oldEnergy = this.storage.getEnergyStored();
}
}
}