mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
82 lines
2.8 KiB
Java
82 lines
2.8 KiB
Java
package com.hbm.blocks.machine;
|
|
|
|
import com.hbm.tileentity.TileEntityFluidDuct;
|
|
import com.hbm.tileentity.TileEntityGasDuct;
|
|
|
|
import net.minecraft.block.BlockContainer;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraft.world.World;
|
|
|
|
public class BlockFluidDuct extends BlockContainer {
|
|
|
|
public BlockFluidDuct(Material p_i45386_1_) {
|
|
super(p_i45386_1_);
|
|
float p = 1F/16F;
|
|
this.setBlockBounds(11 * p / 2, 11 * p / 2, 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2, 1 - 11 * p / 2);
|
|
this.useNeighborBrightness = true;
|
|
}
|
|
|
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
|
if(world.getTileEntity(x, y, z) instanceof TileEntityFluidDuct) {
|
|
TileEntityFluidDuct cable = (TileEntityFluidDuct)world.getTileEntity(x, y, z);
|
|
|
|
if(cable != null)
|
|
{
|
|
float p = 1F/16F;
|
|
float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0);
|
|
float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0);
|
|
float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0);
|
|
float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0);
|
|
float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0);
|
|
float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0);
|
|
|
|
this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
|
}
|
|
}
|
|
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
|
}
|
|
|
|
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
|
if(world.getTileEntity(x, y, z) instanceof TileEntityFluidDuct) {
|
|
TileEntityFluidDuct cable = (TileEntityFluidDuct)world.getTileEntity(x, y, z);
|
|
|
|
if(cable != null)
|
|
{
|
|
float p = 1F/16F;
|
|
float minX = 11 * p / 2 - (cable.connections[5] != null ? (11 * p / 2) : 0);
|
|
float minY = 11 * p / 2 - (cable.connections[1] != null ? (11 * p / 2) : 0);
|
|
float minZ = 11 * p / 2 - (cable.connections[2] != null ? (11 * p / 2) : 0);
|
|
float maxX = 1 - 11 * p / 2 + (cable.connections[3] != null ? (11 * p / 2) : 0);
|
|
float maxY = 1 - 11 * p / 2 + (cable.connections[0] != null ? (11 * p / 2) : 0);
|
|
float maxZ = 1 - 11 * p / 2 + (cable.connections[4] != null ? (11 * p / 2) : 0);
|
|
|
|
this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
|
return new TileEntityFluidDuct();
|
|
}
|
|
|
|
@Override
|
|
public int getRenderType(){
|
|
return -1;
|
|
}
|
|
|
|
@Override
|
|
public boolean isOpaqueCube() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean renderAsNormalBlock() {
|
|
return false;
|
|
}
|
|
|
|
}
|