|
6 | 6 | import net.minecraft.entity.player.EntityPlayer; |
7 | 7 | import net.minecraft.util.AxisAlignedBB; |
8 | 8 | import net.minecraft.util.MathHelper; |
| 9 | +import net.minecraft.world.IBlockAccess; |
9 | 10 | import net.minecraft.world.World; |
10 | 11 | import net.minecraftforge.common.util.ForgeDirection; |
11 | 12 |
|
@@ -109,6 +110,34 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World worldIn, int x, int y |
109 | 110 | return AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); |
110 | 111 | } |
111 | 112 |
|
| 113 | + public void setBlockBoundsBasedOnState(IBlockAccess worldIn, int x, int y, int z) { |
| 114 | + int meta = worldIn.getBlockMetadata(x, y, z); |
| 115 | + |
| 116 | + float minY = 0; |
| 117 | + float maxY = 1.0F; |
| 118 | + float minX = 0.0F; |
| 119 | + float maxX = 1.0F; |
| 120 | + float thickness = 0.01F; |
| 121 | + |
| 122 | + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); |
| 123 | + |
| 124 | + // From BlockSign |
| 125 | + switch (meta) { |
| 126 | + case 2: |
| 127 | + this.setBlockBounds(minX, minY, 1.0F - thickness, maxX, maxY, 1.0F); |
| 128 | + break; |
| 129 | + case 3: |
| 130 | + this.setBlockBounds(minX, minY, 0.0F, maxX, maxY, thickness); |
| 131 | + break; |
| 132 | + case 4: |
| 133 | + this.setBlockBounds(1.0F - thickness, minY, minX, 1.0F, maxY, maxX); |
| 134 | + break; |
| 135 | + case 5: |
| 136 | + this.setBlockBounds(0.0F, minY, minX, thickness, maxY, maxX); |
| 137 | + break; |
| 138 | + } |
| 139 | + } |
| 140 | + |
112 | 141 | @Override |
113 | 142 | public boolean renderAsNormalBlock() { |
114 | 143 | return false; |
|
0 commit comments