mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #1530 from MellowArpeggiation/master
Fix grate placement and rendering issues
This commit is contained in:
commit
6a4552a858
@ -109,13 +109,15 @@ public class BlockGrate extends Block implements ITooltipProvider {
|
||||
|
||||
if(meta == 0) {
|
||||
// Check that the block below can fit a grate above it
|
||||
AxisAlignedBB bb = world.getBlock(x, y - 1, z).getCollisionBoundingBoxFromPool(world, x, y - 1, z);
|
||||
if(bb == null || (int) ((bb.maxY - (y - 1)) * 100) < 90) {
|
||||
Block block = world.getBlock(x, y - 1, z);
|
||||
AxisAlignedBB otherBB = block.getSelectedBoundingBoxFromPool(world, x, y - 1, z);
|
||||
if(!block.isAir(world, x, y + 1, z) && (otherBB == null || otherBB.maxY - (double)y < -0.05)) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 9, 3);
|
||||
}
|
||||
} else if(meta == 7) {
|
||||
AxisAlignedBB bb = world.getBlock(x, y + 1, z).getCollisionBoundingBoxFromPool(world, x, y + 1, z);
|
||||
if(bb == null || (int) ((bb.minY - (y + 1)) * 100) > 10) {
|
||||
Block block = world.getBlock(x, y + 1, z);
|
||||
AxisAlignedBB otherBB = block.getSelectedBoundingBoxFromPool(world, x, y + 1, z);
|
||||
if(!block.isAir(world, x, y + 1, z) && (otherBB == null || otherBB.minY - (double)(y + 1) > 0.05)) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 8, 3);
|
||||
}
|
||||
}
|
||||
@ -131,15 +133,11 @@ public class BlockGrate extends Block implements ITooltipProvider {
|
||||
boolean breakIt = false;
|
||||
|
||||
if(meta == 9) {
|
||||
AxisAlignedBB bb = world.getBlock(x, y - 1, z).getCollisionBoundingBoxFromPool(world, x, y - 1, z);
|
||||
if(bb != null && (int) ((bb.maxY - (y - 1)) * 100) >= 90) {
|
||||
breakIt = true;
|
||||
}
|
||||
AxisAlignedBB otherBB = world.getBlock(x, y - 1, z).getSelectedBoundingBoxFromPool(world, x, y - 1, z);
|
||||
breakIt = !(otherBB == null || otherBB.maxY - (double)y < -0.05);
|
||||
} else if(meta == 8) {
|
||||
AxisAlignedBB bb = world.getBlock(x, y + 1, z).getCollisionBoundingBoxFromPool(world, x, y + 1, z);
|
||||
if(bb != null && (int) ((bb.minY - (y + 1)) * 100) <= 10) {
|
||||
breakIt = true;
|
||||
}
|
||||
AxisAlignedBB otherBB = world.getBlock(x, y + 1, z).getSelectedBoundingBoxFromPool(world, x, y + 1, z);
|
||||
breakIt = !(otherBB == null || otherBB.minY - (double)(y + 1) > 0.05);
|
||||
}
|
||||
|
||||
if(breakIt) {
|
||||
|
||||
@ -23,6 +23,13 @@ public class RenderGrate implements ISimpleBlockRenderingHandler {
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
|
||||
float fy = ((BlockGrate)block).getY(meta);
|
||||
if(fy < 0) {
|
||||
fy++;
|
||||
y--;
|
||||
} else if(fy >= 1) {
|
||||
fy--;
|
||||
y++;
|
||||
}
|
||||
|
||||
renderer.setRenderBounds(0.0D, fy, 0D, 1D, fy + 0.125D, 1D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user