mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 06:50:46 +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) {
|
if(meta == 0) {
|
||||||
// Check that the block below can fit a grate above it
|
// 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);
|
Block block = world.getBlock(x, y - 1, z);
|
||||||
if(bb == null || (int) ((bb.maxY - (y - 1)) * 100) < 90) {
|
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);
|
world.setBlockMetadataWithNotify(x, y, z, 9, 3);
|
||||||
}
|
}
|
||||||
} else if(meta == 7) {
|
} else if(meta == 7) {
|
||||||
AxisAlignedBB bb = world.getBlock(x, y + 1, z).getCollisionBoundingBoxFromPool(world, x, y + 1, z);
|
Block block = world.getBlock(x, y + 1, z);
|
||||||
if(bb == null || (int) ((bb.minY - (y + 1)) * 100) > 10) {
|
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);
|
world.setBlockMetadataWithNotify(x, y, z, 8, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,15 +133,11 @@ public class BlockGrate extends Block implements ITooltipProvider {
|
|||||||
boolean breakIt = false;
|
boolean breakIt = false;
|
||||||
|
|
||||||
if(meta == 9) {
|
if(meta == 9) {
|
||||||
AxisAlignedBB bb = world.getBlock(x, y - 1, z).getCollisionBoundingBoxFromPool(world, x, y - 1, z);
|
AxisAlignedBB otherBB = world.getBlock(x, y - 1, z).getSelectedBoundingBoxFromPool(world, x, y - 1, z);
|
||||||
if(bb != null && (int) ((bb.maxY - (y - 1)) * 100) >= 90) {
|
breakIt = !(otherBB == null || otherBB.maxY - (double)y < -0.05);
|
||||||
breakIt = true;
|
|
||||||
}
|
|
||||||
} else if(meta == 8) {
|
} else if(meta == 8) {
|
||||||
AxisAlignedBB bb = world.getBlock(x, y + 1, z).getCollisionBoundingBoxFromPool(world, x, y + 1, z);
|
AxisAlignedBB otherBB = world.getBlock(x, y + 1, z).getSelectedBoundingBoxFromPool(world, x, y + 1, z);
|
||||||
if(bb != null && (int) ((bb.minY - (y + 1)) * 100) <= 10) {
|
breakIt = !(otherBB == null || otherBB.minY - (double)(y + 1) > 0.05);
|
||||||
breakIt = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(breakIt) {
|
if(breakIt) {
|
||||||
|
|||||||
@ -23,6 +23,13 @@ public class RenderGrate implements ISimpleBlockRenderingHandler {
|
|||||||
tessellator.setColorOpaque_F(1, 1, 1);
|
tessellator.setColorOpaque_F(1, 1, 1);
|
||||||
|
|
||||||
float fy = ((BlockGrate)block).getY(meta);
|
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.setRenderBounds(0.0D, fy, 0D, 1D, fy + 0.125D, 1D);
|
||||||
renderer.renderStandardBlock(block, x, y, z);
|
renderer.renderStandardBlock(block, x, y, z);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user