boxduct hitbox, tile mappings

This commit is contained in:
Boblet 2022-11-24 16:52:43 +01:00
parent dc6e8e6561
commit babe66c154
8 changed files with 90 additions and 29 deletions

View File

@ -790,6 +790,7 @@ public class ModBlocks {
public static Block fluid_duct_neo;
public static Block fluid_duct_box;
public static Block radio_torch_sender;
public static Block radio_torch_receiver;
public static Block conveyor;
//public static Block conveyor_classic;
@ -1979,6 +1980,7 @@ public class ModBlocks {
fluid_duct_neo = new FluidDuctStandard(Material.iron).setBlockName("fluid_duct_neo").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":pipe_neo");
fluid_duct_box = new FluidDuctBox(Material.iron).setBlockName("fluid_duct_box").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":fluid_duct_box");
radio_torch_sender = new RadioTorchSender().setBlockName("radio_torch_sender").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
radio_torch_receiver = new RadioTorchReceiver().setBlockName("radio_torch_receiver").setHardness(0.1F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
conveyor = new BlockConveyor().setBlockName("conveyor").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
//conveyor_classic = new BlockConveyorClassic().setBlockName("conveyor_classic").setHardness(2.0F).setResistance(2.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":conveyor");
@ -3161,6 +3163,7 @@ public class ModBlocks {
GameRegistry.registerBlock(fluid_duct_box, ItemBlockBase.class, fluid_duct_box.getUnlocalizedName());
GameRegistry.registerBlock(fluid_duct_solid, fluid_duct_solid.getUnlocalizedName());
GameRegistry.registerBlock(radio_torch_sender, radio_torch_sender.getUnlocalizedName());
GameRegistry.registerBlock(radio_torch_receiver, radio_torch_receiver.getUnlocalizedName());
GameRegistry.registerBlock(crane_extractor, crane_extractor.getUnlocalizedName());
GameRegistry.registerBlock(crane_inserter, crane_inserter.getUnlocalizedName());

View File

@ -179,7 +179,7 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
double lower = 0.125D;
double upper = 0.875D;
double jLower = 0.0625D;
double jUpper = 0.9375D; //TODO
double jUpper = 0.9375D;
int meta = world.getBlockMetadata(x, y, z);
for(int i = 2; i < 13; i += 3) {
@ -201,28 +201,23 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
if(mask == 0) {
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.6875D, y + 0.3125D, z + 0.3125D, x + 1.0D, y + 0.6875D, z + 0.6875D));
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + 0.3125D, z + 0.3125D, x + 0.3125D, y + 0.6875D, z + 0.6875D));
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.6875D, z + 0.3125D, x + 0.6875D, y + 1.0D, z + 0.6875D));
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.0D, z + 0.3125D, x + 0.6875D, y + 0.3125D, z + 0.6875D));
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.6875D, x + 0.6875D, y + 0.6875D, z + 1.0D));
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.0D, x + 0.6875D, y + 0.6875D, z + 0.3125D));
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 + 0.3125D, z + 0.3125D, x + 1.0D, y + 0.6875D, z + 0.6875D));
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 + 0.3125D, y + 0.0D, z + 0.3125D, x + 0.6875D, y + 1.0D, z + 0.6875D));
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 + 0.3125D, y + 0.3125D, z + 0.0D, x + 0.6875D, y + 0.6875D, z + 1.0D));
bbs.add(AxisAlignedBB.getBoundingBox(x + lower, y + lower, z + 0.0D, x + upper, y + upper, z + 1.0D));
} else {
bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.3125D, x + 0.6875D, y + 0.6875D, z + 0.6875D));
bbs.add(AxisAlignedBB.getBoundingBox(x + jLower, y + jLower, z + jLower, x + jUpper, y + jUpper, z + jUpper));
if(pX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.6875D, y + 0.3125D, z + 0.3125D, x + 1.0D, y + 0.6875D, z + 0.6875D));
if(nX) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.0D, y + 0.3125D, z + 0.3125D, x + 0.3125D, y + 0.6875D, z + 0.6875D));
if(pY) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.6875D, z + 0.3125D, x + 0.6875D, y + 1.0D, z + 0.6875D));
if(nY) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.0D, z + 0.3125D, x + 0.6875D, y + 0.3125D, z + 0.6875D));
if(pZ) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.6875D, x + 0.6875D, y + 0.6875D, z + 1.0D));
if(nZ) bbs.add(AxisAlignedBB.getBoundingBox(x + 0.3125D, y + 0.3125D, z + 0.0D, x + 0.6875D, y + 0.6875D, z + 0.3125D));
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));
}
}
@ -248,6 +243,22 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
TileEntityPipeBaseNT pipe = (TileEntityPipeBaseNT) te;
FluidType type = pipe.getType();
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 = 2; i < 13; i += 3) {
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, type);
boolean pX = canConnectTo(world, x, y, z, Library.POS_X, type);
boolean nY = canConnectTo(world, x, y, z, Library.NEG_Y, type);
@ -257,22 +268,22 @@ public class FluidDuctBox extends FluidDuctBase implements IBlockMulti, ILookOve
int mask = 0 + (pX ? 32 : 0) + (nX ? 16 : 0) + (pY ? 8 : 0) + (nY ? 4 : 0) + (pZ ? 2 : 0) + (nZ ? 1 : 0);
if(mask == 0) {
this.setBlockBounds(0F, 0F, 0F, 1F, 1F, 1F);
this.setBlockBounds(jLower, jLower, jLower, jUpper, jUpper, jUpper);
} else if(mask == 0b100000 || mask == 0b010000 || mask == 0b110000) {
this.setBlockBounds(0F, 0.3125F, 0.3125F, 1F, 0.6875F, 0.6875F);
this.setBlockBounds(0F, lower, lower, 1F, upper, upper);
} else if(mask == 0b001000 || mask == 0b000100 || mask == 0b001100) {
this.setBlockBounds(0.3125F, 0F, 0.3125F, 0.6875F, 1F, 0.6875F);
this.setBlockBounds(lower, 0F, lower, upper, 1F, upper);
} else if(mask == 0b000010 || mask == 0b000001 || mask == 0b000011) {
this.setBlockBounds(0.3125F, 0.3125F, 0F, 0.6875F, 0.6875F, 1F);
this.setBlockBounds(lower, lower, 0F, upper, upper, 1F);
} else {
this.setBlockBounds(
nX ? 0F : 0.3125F,
nY ? 0F : 0.3125F,
nZ ? 0F : 0.3125F,
pX ? 1F : 0.6875F,
pY ? 1F : 0.6875F,
pZ ? 1F : 0.6875F);
nX ? 0F : jLower,
nY ? 0F : jLower,
nZ ? 0F : jLower,
pX ? 1F : jUpper,
pY ? 1F : jUpper,
pZ ? 1F : jUpper);
}
}
}

View File

@ -0,0 +1,33 @@
package com.hbm.blocks.network;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.network.TileEntityRadioTorchReceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class RadioTorchReceiver extends RadioTorchBase {
@SideOnly(Side.CLIENT)
protected IIcon iconOn;
public RadioTorchReceiver() {
super();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":rtty_rec_off");
this.iconOn = iconRegister.registerIcon(RefStrings.MODID + ":rtty_rec_on");
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityRadioTorchReceiver();
}
}

View File

@ -1,6 +1,7 @@
package com.hbm.blocks.network;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.network.TileEntityRadioTorchSender;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -26,7 +27,7 @@ public class RadioTorchSender extends RadioTorchBase {
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return null;
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityRadioTorchSender();
}
}

View File

@ -331,6 +331,9 @@ public class TileMappings {
put(TileEntityCraneBoxer.class, "tileentity_boxer");
put(TileEntityCraneUnboxer.class, "tileentity_unboxer");
put(TileEntityCraneRouter.class, "tileentity_router");
put(TileEntityRadioTorchSender.class, "tileentity_rtty_sender");
put(TileEntityRadioTorchReceiver.class, "tileentity_rtty_rec");
}
private static void put(Class<? extends TileEntity> clazz, String... names) {

View File

@ -0,0 +1,5 @@
package com.hbm.tileentity.network;
public class TileEntityRadioTorchReceiver extends TileEntityRadioTorchBase {
}

View File

@ -0,0 +1,5 @@
package com.hbm.tileentity.network;
public class TileEntityRadioTorchSender extends TileEntityRadioTorchBase {
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB