mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
parent
807e090f1f
commit
1dcdd196eb
1 changed files with 23 additions and 0 deletions
|
@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
|
|||
import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -33,6 +34,7 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl
|
|||
private int rangeBefore;
|
||||
private BlockPos boundPosBefore;
|
||||
private Block boundBlockBefore;
|
||||
private int lastStrength;
|
||||
|
||||
public TileEntityPhantomface(String name){
|
||||
super(0, name);
|
||||
|
@ -93,6 +95,13 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl
|
|||
if(this.doesNeedUpdateSend()){
|
||||
this.onUpdateSent();
|
||||
}
|
||||
|
||||
int strength = this.getComparatorStrength();
|
||||
if(this.lastStrength != strength){
|
||||
this.lastStrength = strength;
|
||||
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(this.boundPosition != null){
|
||||
|
@ -193,4 +202,18 @@ public abstract class TileEntityPhantomface extends TileEntityInventoryBase impl
|
|||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorStrength(){
|
||||
if(this.isBoundThingInRange()){
|
||||
BlockPos pos = this.getBoundPosition();
|
||||
IBlockState state = this.world.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
|
||||
if(block.hasComparatorInputOverride(state)){
|
||||
return block.getComparatorInputOverride(state, this.world, pos);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue