what the fuc kis a boxcable
@ -767,6 +767,7 @@ public class ModBlocks {
|
||||
public static Block red_cable_classic;
|
||||
public static Block red_cable_paintable;
|
||||
public static Block red_cable_gauge;
|
||||
public static Block red_cable_box;
|
||||
public static Block red_connector;
|
||||
public static Block red_pylon;
|
||||
public static Block red_pylon_medium_wood;
|
||||
@ -1905,6 +1906,7 @@ public class ModBlocks {
|
||||
red_cable_classic = new BlockCable(Material.iron).setBlockName("red_cable_classic").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_cable_classic");
|
||||
red_cable_paintable = new BlockCablePaintable().setBlockName("red_cable_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
red_cable_gauge = new BlockCableGauge().setBlockName("red_cable_gauge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
red_cable_box = new PowerCableBox(Material.iron).setBlockName("red_cable_box").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box");
|
||||
red_connector = new ConnectorRedWire(Material.iron).setBlockName("red_connector").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_connector");
|
||||
red_pylon = new PylonRedWire(Material.iron).setBlockName("red_pylon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||
red_pylon_medium_wood = new PylonMedium(Material.wood).setBlockName("red_pylon_medium_wood").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":red_pylon");
|
||||
@ -2728,7 +2730,7 @@ public class ModBlocks {
|
||||
register(lightstone_bricks_stairs);
|
||||
register(stones_slab, ItemModSlab.class);
|
||||
register(stones_double_slab, ItemModSlab.class);
|
||||
|
||||
|
||||
register(brick_forgotten);
|
||||
|
||||
GameRegistry.registerBlock(concrete_slab, ItemModSlab.class, concrete_slab.getUnlocalizedName());
|
||||
@ -3193,6 +3195,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(red_cable_classic, red_cable_classic.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(red_cable_paintable, red_cable_paintable.getUnlocalizedName());
|
||||
register(red_cable_gauge);
|
||||
register(red_cable_box);
|
||||
GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(red_connector, ItemBlockBase.class, red_connector.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(red_pylon, ItemBlockBase.class, red_pylon.getUnlocalizedName());
|
||||
@ -3206,7 +3209,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(cable_detector, cable_detector.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(cable_diode, ItemBlockBase.class, cable_diode.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_detector, machine_detector.getUnlocalizedName());
|
||||
|
||||
|
||||
register(fluid_duct_neo);
|
||||
register(fluid_duct_box);
|
||||
register(fluid_duct_exhaust);
|
||||
|
||||
@ -4,10 +4,10 @@ import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.block.RenderBoxDuct;
|
||||
import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||
import com.hbm.util.i18n.I18nUtil;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
@ -130,11 +130,9 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
|
||||
return meta % 15;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return renderID;
|
||||
return RenderBoxDuct.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
295
src/main/java/com/hbm/blocks/network/PowerCableBox.java
Normal file
@ -0,0 +1,295 @@
|
||||
package com.hbm.blocks.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.block.RenderBoxDuct;
|
||||
import com.hbm.tileentity.network.TileEntityCableBaseNT;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PowerCableBox extends BlockContainer implements IBlockMulti {
|
||||
|
||||
@SideOnly(Side.CLIENT) public IIcon iconStraight;
|
||||
@SideOnly(Side.CLIENT) public IIcon[] iconEnd;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconCurveTL;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconCurveTR;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconCurveBL;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconCurveBR;
|
||||
@SideOnly(Side.CLIENT) public IIcon iconJunction;
|
||||
|
||||
public PowerCableBox(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityCableBaseNT();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
super.registerBlockIcons(iconRegister);
|
||||
|
||||
iconEnd = new IIcon[5];
|
||||
|
||||
iconStraight = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_" + "cable" + "_straight");
|
||||
for(int i = 0; i < 5; i++) iconEnd[i] = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_" + "cable" + "_end_" + i);
|
||||
iconCurveTL = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_" + "cable" + "_curve_tl");
|
||||
iconCurveTR = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_" + "cable" + "_curve_tr");
|
||||
iconCurveBL = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_" + "cable" + "_curve_bl");
|
||||
iconCurveBR = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_" + "cable" + "_curve_br");
|
||||
iconJunction = iconRegister.registerIcon(RefStrings.MODID + ":boxduct_" + "cable" + "_junction");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te);
|
||||
boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, te);
|
||||
boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te);
|
||||
|
||||
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
|
||||
int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0);
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if((mask & 0b001111) == 0 && mask > 0) {
|
||||
return (side == 4 || side == 5) ? iconEnd[meta] : iconStraight;
|
||||
} else if((mask & 0b111100) == 0 && mask > 0) {
|
||||
return (side == 2 || side == 3) ? iconEnd[meta] : iconStraight;
|
||||
} else if((mask & 0b110011) == 0 && mask > 0) {
|
||||
return (side == 0 || side == 1) ? iconEnd[meta] : iconStraight;
|
||||
} else if(count == 2) {
|
||||
|
||||
if(side == 0 && nY || side == 1 && pY || side == 2 && nZ || side == 3 && pZ || side == 4 && nX || side == 5 && pX)
|
||||
return iconEnd[meta];
|
||||
if(side == 1 && nY || side == 0 && pY || side == 3 && nZ || side == 2 && pZ || side == 5 && nX || side == 4 && pX)
|
||||
return iconStraight;
|
||||
|
||||
if(nY && pZ) return side == 4 ? iconCurveBR : iconCurveBL;
|
||||
if(nY && nZ) return side == 5 ? iconCurveBR : iconCurveBL;
|
||||
if(nY && pX) return side == 3 ? iconCurveBR : iconCurveBL;
|
||||
if(nY && nX) return side == 2 ? iconCurveBR : iconCurveBL;
|
||||
if(pY && pZ) return side == 4 ? iconCurveTR : iconCurveTL;
|
||||
if(pY && nZ) return side == 5 ? iconCurveTR : iconCurveTL;
|
||||
if(pY && pX) return side == 3 ? iconCurveTR : iconCurveTL;
|
||||
if(pY && nX) return side == 2 ? iconCurveTR : iconCurveTL;
|
||||
|
||||
if(pX && nZ) return side == 0 ? iconCurveTR : iconCurveTR;
|
||||
if(pX && pZ) return side == 0 ? iconCurveBR : iconCurveBR;
|
||||
if(nX && nZ) return side == 0 ? iconCurveTL : iconCurveTL;
|
||||
if(nX && pZ) return side == 0 ? iconCurveBL : iconCurveBL;
|
||||
|
||||
return iconJunction;
|
||||
}
|
||||
|
||||
return iconJunction;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for(int i = 0; i < 5; ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
public int damageDropped(int meta) {
|
||||
return meta % 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return RenderBoxDuct.renderID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB entityBounding, List list, Entity entity) {
|
||||
|
||||
List<AxisAlignedBB> bbs = new ArrayList<>();
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
double lower = 0.125D;
|
||||
double upper = 0.875D;
|
||||
double jLower = 0.0625D;
|
||||
double jUpper = 0.9375D;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
|
||||
if(meta > i) {
|
||||
lower += 0.0625D;
|
||||
upper -= 0.0625D;
|
||||
jLower += 0.0625D;
|
||||
jUpper -= 0.0625D;
|
||||
}
|
||||
}
|
||||
|
||||
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te);
|
||||
boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, te);
|
||||
boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te);
|
||||
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
|
||||
int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0);
|
||||
|
||||
if(mask == 0) {
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper));
|
||||
} else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) {
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + lower, z + lower, x + 1.0D, y + upper, z + upper));
|
||||
} else if(mask == 0b001000 || mask == 0b000100 || mask == 0b001100) {
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + 0.0D, z + lower, x + upper, y + 1.0D, z + upper));
|
||||
} else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) {
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + 1.0D));
|
||||
} else {
|
||||
|
||||
if(count != 2) {
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper));
|
||||
} else {
|
||||
bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + lower, x + upper, y + upper, z + upper));
|
||||
}
|
||||
|
||||
if(pX) bbs.add(AxisAlignedBB.getBoundingBox(x + upper, y + lower, z + lower, x + 1.0D, y + upper, z + upper));
|
||||
if(nX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + lower, z + lower, x + lower, y + upper, z + upper));
|
||||
if(pY) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + upper, z + lower, x + upper, y + 1.0D, z + upper));
|
||||
if(nY) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + 0.0D, z + lower, x + upper, y + lower, z + upper));
|
||||
if(pZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + upper, x + upper, y + upper, z + 1.0D));
|
||||
if(nZ) bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + lower));
|
||||
}
|
||||
|
||||
for(AxisAlignedBB bb : bbs) {
|
||||
if(entityBounding.intersectsWith(bb)) {
|
||||
list.add(bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
float lower = 0.125F;
|
||||
float upper = 0.875F;
|
||||
float jLower = 0.0625F;
|
||||
float jUpper = 0.9375F;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
|
||||
if(meta > i) {
|
||||
lower += 0.0625F;
|
||||
upper -= 0.0625F;
|
||||
jLower += 0.0625F;
|
||||
jUpper -= 0.0625F;
|
||||
}
|
||||
}
|
||||
|
||||
boolean nX = canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, te);
|
||||
boolean pY = canConnectTo(world, x, y, z, Library.POS_Y, te);
|
||||
boolean nZ = canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
||||
boolean pZ = canConnectTo(world, x, y, z, Library.POS_Z, te);
|
||||
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
|
||||
int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0);
|
||||
|
||||
if(mask == 0) {
|
||||
this.setBlockBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper);
|
||||
} else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) {
|
||||
this.setBlockBounds(0F, lower, lower, 1F, upper, upper);
|
||||
} else if(mask == 0b001000 || mask == 0b000100 || mask == 0b001100) {
|
||||
this.setBlockBounds(lower, 0F, lower, upper, 1F, upper);
|
||||
} else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) {
|
||||
this.setBlockBounds(lower, lower, 0F, upper, upper, 1F);
|
||||
} else {
|
||||
|
||||
if(count != 2) {
|
||||
this.setBlockBounds(
|
||||
nX ? 0F : jLower,
|
||||
nY ? 0F : jLower,
|
||||
nZ ? 0F : jLower,
|
||||
pX ? 1F : jUpper,
|
||||
pY ? 1F : jUpper,
|
||||
pZ ? 1F : jUpper);
|
||||
} else {
|
||||
this.setBlockBounds(
|
||||
nX ? 0F : lower,
|
||||
nY ? 0F : lower,
|
||||
nZ ? 0F : lower,
|
||||
pX ? 1F : upper,
|
||||
pY ? 1F : upper,
|
||||
pZ ? 1F : upper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir, TileEntity tile) {
|
||||
if(tile instanceof TileEntityCableBaseNT) {
|
||||
return Library.canConnect(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSubCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.hbm.render.block;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.network.FluidDuctBox;
|
||||
import com.hbm.blocks.network.PowerCableBox;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.lib.Library;
|
||||
@ -11,6 +12,7 @@ import com.hbm.tileentity.network.TileEntityPipeBaseNT;
|
||||
import com.hbm.util.ColorUtil;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@ -21,48 +23,80 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
FluidDuctBox duct = (FluidDuctBox) block;
|
||||
int type = duct.rectify(metadata);
|
||||
|
||||
float lower = 0.125F;
|
||||
float upper = 0.875F;
|
||||
|
||||
for(int i = 2; i < 13; i += 3) {
|
||||
|
||||
if(metadata > i) {
|
||||
lower += 0.0625F;
|
||||
upper -= 0.0625F;
|
||||
if(block instanceof FluidDuctBox) {
|
||||
FluidDuctBox duct = (FluidDuctBox) block;
|
||||
int type = duct.rectify(metadata);
|
||||
|
||||
float lower = 0.125F;
|
||||
float upper = 0.875F;
|
||||
|
||||
for(int i = 2; i < 13; i += 3) {
|
||||
|
||||
if(metadata > i) {
|
||||
lower += 0.0625F;
|
||||
upper -= 0.0625F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
renderer.setRenderBounds(lower, lower, 0.0F, upper, upper, 1.0F);
|
||||
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F); renderer.renderFaceYPos(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(0F, -1F, 0F); renderer.renderFaceYNeg(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(1F, 0F, 0F); renderer.renderFaceXPos(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(-1F, 0F, 0F); renderer.renderFaceXNeg(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(0F, 0F, 1F); renderer.renderFaceZPos(block, 0, 0, 0, duct.iconEnd[type]);
|
||||
tessellator.setNormal(0F, 0F, -1F); renderer.renderFaceZNeg(block, 0, 0, 0, duct.iconEnd[type]);
|
||||
tessellator.draw();
|
||||
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateSouth = 0;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
renderer.setRenderBounds(lower, lower, 0.0F, upper, upper, 1.0F);
|
||||
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F); renderer.renderFaceYPos(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(0F, -1F, 0F); renderer.renderFaceYNeg(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(1F, 0F, 0F); renderer.renderFaceXPos(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(-1F, 0F, 0F); renderer.renderFaceXNeg(block, 0, 0, 0, duct.iconStraight[type]);
|
||||
tessellator.setNormal(0F, 0F, 1F); renderer.renderFaceZPos(block, 0, 0, 0, duct.iconEnd[type]);
|
||||
tessellator.setNormal(0F, 0F, -1F); renderer.renderFaceZNeg(block, 0, 0, 0, duct.iconEnd[type]);
|
||||
tessellator.draw();
|
||||
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateSouth = 0;
|
||||
} else if(block instanceof PowerCableBox) {
|
||||
PowerCableBox cable = (PowerCableBox) block;
|
||||
|
||||
float lower = 0.125F;
|
||||
float upper = 0.875F;
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
|
||||
if(metadata > i) {
|
||||
lower += 0.0625F;
|
||||
upper -= 0.0625F;
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
|
||||
renderer.setRenderBounds(lower, lower, 0.0F, upper, upper, 1.0F);
|
||||
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0F, 1F, 0F); renderer.renderFaceYPos(block, 0, 0, 0, cable.iconStraight);
|
||||
tessellator.setNormal(0F, -1F, 0F); renderer.renderFaceYNeg(block, 0, 0, 0, cable.iconStraight);
|
||||
tessellator.setNormal(1F, 0F, 0F); renderer.renderFaceXPos(block, 0, 0, 0, cable.iconStraight);
|
||||
tessellator.setNormal(-1F, 0F, 0F); renderer.renderFaceXNeg(block, 0, 0, 0, cable.iconStraight);
|
||||
tessellator.setNormal(0F, 0F, 1F); renderer.renderFaceZPos(block, 0, 0, 0, cable.iconEnd[metadata]);
|
||||
tessellator.setNormal(0F, 0F, -1F); renderer.renderFaceZNeg(block, 0, 0, 0, cable.iconEnd[metadata]);
|
||||
tessellator.draw();
|
||||
|
||||
renderer.uvRotateNorth = 0;
|
||||
renderer.uvRotateSouth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
FluidType type = Fluids.NONE;
|
||||
|
||||
renderer = RenderBlocksNT.INSTANCE.setWorld(world);
|
||||
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
@ -75,42 +109,65 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler {
|
||||
boolean pZ = false;
|
||||
boolean nZ = false;
|
||||
|
||||
FluidDuctBox.cachedColor = 0xffffff;
|
||||
FluidDuctBox duct = (FluidDuctBox) block;
|
||||
|
||||
pX = duct.canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||
nX = duct.canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||
pY = duct.canConnectTo(world, x, y, z, Library.POS_Y, te);
|
||||
nY = duct.canConnectTo(world, x, y, z, Library.NEG_Y, te);
|
||||
pZ = duct.canConnectTo(world, x, y, z, Library.POS_Z, te);
|
||||
nZ = duct.canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
||||
|
||||
double lower = 0.125D;
|
||||
double upper = 0.875D;
|
||||
double jLower = lower;
|
||||
double jUpper = upper;
|
||||
|
||||
if(te instanceof TileEntityPipeBaseNT) {
|
||||
FluidDuctBox.cachedColor = 0xffffff;
|
||||
FluidDuctBox duct = (FluidDuctBox) block;
|
||||
|
||||
pX = duct.canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||
nX = duct.canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||
pY = duct.canConnectTo(world, x, y, z, Library.POS_Y, te);
|
||||
nY = duct.canConnectTo(world, x, y, z, Library.NEG_Y, te);
|
||||
pZ = duct.canConnectTo(world, x, y, z, Library.POS_Z, te);
|
||||
nZ = duct.canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
||||
|
||||
FluidType type = Fluids.NONE;
|
||||
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
|
||||
type = pipe.getType();
|
||||
if(meta % 3 == 2) {
|
||||
FluidDuctBox.cachedColor = ColorUtil.lightenColor(type.getColor(), 0.25D); //making very dark things not vantablack
|
||||
}
|
||||
|
||||
jLower = 0.0625D;
|
||||
jUpper = 0.9375D;
|
||||
|
||||
for(int i = 2; i < 13; i += 3) {
|
||||
|
||||
if(meta > i) {
|
||||
lower += 0.0625D;
|
||||
upper -= 0.0625D;
|
||||
jLower += 0.0625D;
|
||||
jUpper -= 0.0625D;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PowerCableBox cable = (PowerCableBox) block;
|
||||
|
||||
pX = cable.canConnectTo(world, x, y, z, Library.POS_X, te);
|
||||
nX = cable.canConnectTo(world, x, y, z, Library.NEG_X, te);
|
||||
pY = cable.canConnectTo(world, x, y, z, Library.POS_Y, te);
|
||||
nY = cable.canConnectTo(world, x, y, z, Library.NEG_Y, te);
|
||||
pZ = cable.canConnectTo(world, x, y, z, Library.POS_Z, te);
|
||||
nZ = cable.canConnectTo(world, x, y, z, Library.NEG_Z, te);
|
||||
|
||||
for(int i = 0; i < 5; i++) {
|
||||
|
||||
if(meta > i) {
|
||||
lower += 0.0625F;
|
||||
upper -= 0.0625F;
|
||||
jLower += 0.0625F;
|
||||
jUpper -= 0.0625F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
|
||||
int count = 0 + (pX ? 1 : 0) + (nX ? 1 : 0) + (pY ? 1 : 0) + (nY ? 1 : 0) + (pZ ? 1 : 0) + (nZ ? 1 : 0);
|
||||
|
||||
double lower = 0.125D;
|
||||
double upper = 0.875D;
|
||||
double jLower = 0.0625D;
|
||||
double jUpper = 0.9375D;
|
||||
|
||||
for(int i = 2; i < 13; i += 3) {
|
||||
|
||||
if(meta > i) {
|
||||
lower += 0.0625D;
|
||||
upper -= 0.0625D;
|
||||
jLower += 0.0625D;
|
||||
jUpper -= 0.0625D;
|
||||
}
|
||||
}
|
||||
|
||||
//Straight along X
|
||||
if((mask & 0b001111) == 0 && mask > 0) {
|
||||
renderer.uvRotateTop = 1;
|
||||
@ -119,39 +176,39 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler {
|
||||
renderer.uvRotateWest = 1;
|
||||
renderer.setRenderBounds(0.0D, lower, lower, 1.0D, upper, upper);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
|
||||
//Straight along Z
|
||||
} else if((mask & 0b111100) == 0 && mask > 0) {
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.setRenderBounds(lower, lower, 0.0D, upper, upper, 1.0D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
|
||||
//Straight along Y
|
||||
} else if((mask & 0b110011) == 0 && mask > 0) {
|
||||
renderer.setRenderBounds(lower, 0.0D, lower, upper, 1.0D, upper);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
|
||||
//Curve
|
||||
} else if(count == 2) {
|
||||
|
||||
|
||||
if(nY && (pX || nX)) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
}
|
||||
|
||||
|
||||
if(pY && (pX || nX)) {
|
||||
renderer.uvRotateTop = 1;
|
||||
renderer.uvRotateBottom = 1;
|
||||
}
|
||||
|
||||
|
||||
if(!nY && !pY) {
|
||||
renderer.uvRotateNorth = 1;
|
||||
renderer.uvRotateSouth = 2;
|
||||
renderer.uvRotateEast = 2;
|
||||
renderer.uvRotateWest = 1;
|
||||
}
|
||||
|
||||
|
||||
renderer.setRenderBounds(lower, lower, lower, upper, upper, upper);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
|
||||
@ -179,7 +236,7 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler {
|
||||
renderer.setRenderBounds(lower, lower, upper, upper, upper, 1.0D);
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
//Junction
|
||||
} else {
|
||||
renderer.setRenderBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper);
|
||||
@ -217,7 +274,7 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler {
|
||||
renderer.uvRotateSouth = 0;
|
||||
renderer.uvRotateEast = 0;
|
||||
renderer.uvRotateWest = 0;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -226,8 +283,11 @@ public class RenderBoxDuct implements ISimpleBlockRenderingHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public int getRenderId() {
|
||||
return FluidDuctBox.renderID;
|
||||
return renderID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6142,6 +6142,7 @@ tile.reactor_inserter.name=Reactor Fuel Inserter
|
||||
tile.rebar.name=Rebar
|
||||
tile.red_barrel.name=Explosive Barrel
|
||||
tile.red_cable.name=Red Copper Cable
|
||||
tile.red_cable_box.name=Red Copper Boxcable
|
||||
tile.red_cable_classic.name=Red Copper Cable (Classic)
|
||||
tile.red_cable_gauge.name=Power Gauge
|
||||
tile.red_cable_gauge.desc=Cable that displays how much power$moves within the network per tick.$Split networks connected by energy$storage blocks are considered as one shared network.
|
||||
|
||||
|
After Width: | Height: | Size: 304 B |
|
After Width: | Height: | Size: 302 B |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 313 B |
|
After Width: | Height: | Size: 499 B |
|
After Width: | Height: | Size: 435 B |
|
After Width: | Height: | Size: 436 B |
|
After Width: | Height: | Size: 432 B |
|
After Width: | Height: | Size: 413 B |
|
After Width: | Height: | Size: 331 B |
|
After Width: | Height: | Size: 239 B |