Skip to content

Commit

Permalink
API for creation of wither-proof machines (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
KRP-byte authored Jul 10, 2021
1 parent 0b9a43f commit 984aa3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/gregtech/api/block/machines/BlockMachine.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,10 @@ public boolean supportsVisualConnections() {
protected Pair<TextureAtlasSprite, Integer> getParticleTexture(World world, BlockPos blockPos) {
return MetaTileEntityRenderer.INSTANCE.getParticleTexture(world, blockPos);
}

@Override
public boolean canEntityDestroy(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) {
MetaTileEntity metaTileEntity = getMetaTileEntity(world, pos);
return !((entity instanceof EntityWither || entity instanceof EntityWitherSkull) && metaTileEntity.getWitherProof());
}
}
4 changes: 4 additions & 0 deletions src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1229,4 +1229,8 @@ public float getBlockHardness() {
public float getBlockResistance() {
return 6.0f;
}

public boolean getWitherProof(){
return false;
}
}

0 comments on commit 984aa3e

Please sign in to comment.