Updated to the latest MCP mappings, began work on fixing collision/selection boxes

This commit is contained in:
Adubbz 2016-03-17 20:41:51 +11:00
parent 985f635d68
commit e1bd50ecc0
30 changed files with 66 additions and 86 deletions

View file

@ -28,21 +28,22 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockBOPAsh extends BlockBOPGeneric
{
protected static final AxisAlignedBB COLLISION_BOX = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.875D, 1.0D);
public BlockBOPAsh()
{
super(Material.sand, SoundType.SAND);
this.setHardness(0.4F);
this.setHarvestLevel("shovel", 0);
this.setStepSound(SoundType.SAND);
this.setSoundType(SoundType.SAND);
}
// ash blocks are slightly lower
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
{
float heightOffset = 0.125F;
return new AxisAlignedBB((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), (double) (pos.getX() + 1), (double) ((float) (pos.getY() + 1) - heightOffset), (double) (pos.getZ() + 1));
return COLLISION_BOX;
}
@Override

View file

@ -30,7 +30,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockBOPBamboo extends BlockBOPDecoration
{
protected static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(0.1875D, 0.0D, 0.1875D, 0.8125D, 1.0D, 0.8125D);
// add properties
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
@Override
@ -41,8 +42,7 @@ public class BlockBOPBamboo extends BlockBOPDecoration
{
super(Material.wood);
this.setHardness(0.2F);
this.setStepSound(SoundType.WOOD);
//this.setBlockBoundsByRadiusAndHeight(0.1875F , 1.0F);
this.setSoundType(SoundType.WOOD);
this.setDefaultState(this.blockState.getBaseState().withProperty(AGE, Integer.valueOf(0)));
}
@ -54,8 +54,18 @@ public class BlockBOPBamboo extends BlockBOPDecoration
{
return direction == EnumFacing.UP && plantable.getPlant(world, pos.offset(direction)).getBlock() == this;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
return BOUNDING_BOX;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
{
return BOUNDING_BOX;
}
@Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state)

View file

@ -34,7 +34,7 @@ public class BlockBOPBiomeBlock extends BlockBOPGeneric
public BlockBOPBiomeBlock() {
super(Material.glass, SoundType.GLASS);
this.setHardness(0.6F);
this.setStepSound(SoundType.GLASS);
this.setSoundType(SoundType.GLASS);
}
// list of biomes which have an associated essence (possible drops when this block is broken)

View file

@ -84,7 +84,7 @@ public class BlockBOPBones extends Block implements IBOPBlock
// set some defaults
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setStepSound(SoundType.STONE);
this.setSoundType(SoundType.STONE);
this.setDefaultState(this.blockState.getBaseState().withProperty(AXIS, EnumFacing.Axis.Y).withProperty(VARIANT, BoneType.LARGE));
}
@ -120,70 +120,39 @@ public class BlockBOPBones extends Block implements IBOPBlock
return this.getMetaFromState(this.getDefaultState().withProperty(VARIANT, state.getValue(VARIANT)));
}
/* @Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos)
{
this.setBlockBoundsBasedOnState(worldIn, pos);
return super.getSelectedBoundingBox(worldIn, pos);
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{
this.setBlockBoundsBasedOnState(worldIn, pos);
return super.getCollisionBoundingBox(worldIn, pos, state);
}
// bounding box is a bit complex as it depends on both size and orientation
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos)
{
IBlockState state = world.getBlockState(pos);
if (state.getBlock() != this)
return;
float width;
double width = 1.0D;
switch ((BoneType) state.getValue(VARIANT))
{
case SMALL:
width = 0.25F;
width = 0.25D;
break;
case MEDIUM:
width = 0.625F;
break;
case LARGE:
width = 1F;
break;
default:
width = 1F;
width = 0.625D;
break;
}
float min = (1.0F - width) / 2F;
float max = 1.0F - min;
double min = (1.0D - width) / 2D;
double max = 1.0D - min;
switch ((EnumFacing.Axis) state.getValue(AXIS))
{
case X:
this.setBlockBounds(0F, min, min, 1.0F, max, max);
break;
return new AxisAlignedBB(0.0D, min, min, 1.0D, max, max);
case Y:
this.setBlockBounds(min, 0F, min, max, 1.0F, max);
break;
return new AxisAlignedBB(min, 0.0D, min, max, 1.0D, max);
case Z:
this.setBlockBounds(min, min, 0F, max, max, 1.0F);
break;
return new AxisAlignedBB(min, min, 0.0D, max, max, 1.0D);
}
}*/
return FULL_BLOCK_AABB;
}
@Override
public boolean isOpaqueCube(IBlockState state)

View file

@ -68,7 +68,7 @@ public class BlockBOPCoral extends BlockBOPDecoration
// set some defaults
this.setHardness(0.6F);
this.setStepSound(SoundType.SAND);
this.setSoundType(SoundType.SAND);
this.setDefaultState( this.blockState.getBaseState().withProperty(LEVEL, 15).withProperty(VARIANT, CoralType.PINK) );
}

View file

@ -46,7 +46,7 @@ public class BlockBOPCrystal extends Block implements IBOPBlock
this.setHardness(0.15F);
this.setResistance(5.0F);
this.setLightLevel(1.0F);
this.setStepSound(SoundType.GLASS);
this.setSoundType(SoundType.GLASS);
}
@Override

View file

@ -57,10 +57,17 @@ public class BlockBOPDecoration extends Block implements IBOPBlock
// set some defaults
this.setTickRandomly(true);
this.setHardness(0.0F);
this.setStepSound(SoundType.PLANT);
this.setSoundType(SoundType.PLANT);
this.setDefaultState(this.blockState.getBaseState());
}
// no collision box - you can walk straight through them
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos)
{
return NULL_AABB;
}
/* // utility function for setting the block bounds - typically decoration blocks are smaller than full block size
public void setBlockBoundsByRadiusAndHeight(float radius, float height)
@ -142,13 +149,6 @@ public class BlockBOPDecoration extends Block implements IBOPBlock
return true;
}
/* // no collision box - you can walk straight through them
@Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
return null;
}*/
// not opaque
@Override
public boolean isOpaqueCube(IBlockState state)

View file

@ -78,7 +78,7 @@ public class BlockBOPDirt extends Block implements IBOPBlock, ISustainsPlantType
this.setTickRandomly(true);
this.setHardness(0.5F);
this.setHarvestLevel("shovel", 0);
this.setStepSound(SoundType.GROUND);
this.setSoundType(SoundType.GROUND);
this.setDefaultState( this.blockState.getBaseState().withProperty(COARSE, Boolean.valueOf(false)).withProperty(VARIANT, BOPDirtType.LOAMY) );
}

View file

@ -94,7 +94,7 @@ public class BlockBOPDoubleWoodSlab extends BlockSlab implements IBOPBlock
super(Material.wood);
this.useNeighborBrightness = true;
this.setHardness(2.0F).setResistance(5.0F);
this.setStepSound(SoundType.WOOD);
this.setSoundType(SoundType.WOOD);
this.setHarvestLevel("axe", 0);
this.setDefaultState(this.blockState.getBaseState().withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));
}

View file

@ -89,7 +89,7 @@ public class BlockBOPFarmland extends BlockFarmland implements IBOPBlock
this.useNeighborBrightness = true;
this.setHardness(0.6F);
this.setHarvestLevel("shovel", 0);
this.setStepSound(SoundType.GROUND);
this.setSoundType(SoundType.GROUND);
this.setDefaultState(this.blockState.getBaseState().withProperty(MOISTURE, Integer.valueOf(0)));
}

View file

@ -64,7 +64,7 @@ public class BlockBOPFence extends BlockFence implements IBOPBlock
this.setHardness(2.0F);
this.setResistance(5.0F);
this.setStepSound(SoundType.WOOD);
this.setSoundType(SoundType.WOOD);
}
@Override

View file

@ -66,7 +66,7 @@ public class BlockBOPFenceGate extends BlockFenceGate implements IBOPBlock
this.setHardness(2.0F);
this.setResistance(5.0F);
this.setStepSound(SoundType.WOOD);
this.setSoundType(SoundType.WOOD);
}
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)

View file

@ -49,7 +49,7 @@ public class BlockBOPFlesh extends Block implements IBOPBlock
public BlockBOPFlesh() {
super(Material.sponge);
this.setHardness(0.4F);
this.setStepSound(SoundType.GROUND);
this.setSoundType(SoundType.GROUND);
}
@Override

View file

@ -51,7 +51,7 @@ public class BlockBOPGem extends Block implements IBOPBlock
// set some defaults
this.setHardness(5.0F);
this.setResistance(10.0F);
this.setStepSound(SoundType.METAL);
this.setSoundType(SoundType.METAL);
this.setHarvestLevel("pickaxe", 2);
this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, BOPGems.AMETHYST) );
}

View file

@ -61,7 +61,7 @@ public class BlockBOPGemOre extends Block implements IBOPBlock
// set some defaults
this.setHardness(3.0F);
this.setResistance(5.0F);
this.setStepSound(SoundType.STONE);
this.setSoundType(SoundType.STONE);
this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, BOPGems.AMETHYST) );
// all variants need pickaxe:2 to harvest, except amethyst which needs pickaxe:3

View file

@ -51,7 +51,7 @@ public class BlockBOPGeneric extends Block implements IBOPBlock, ISustainsPlantT
super(material);
// set some defaults
this.setHardness(1.0F);
this.setStepSound(soundType);
this.setSoundType(soundType);
}

View file

@ -96,7 +96,7 @@ public class BlockBOPGrass extends BlockGrass implements IBOPBlock, ISustainsPla
// set some defaults
this.setHardness(0.6F);
this.setHarvestLevel("shovel", 0);
this.setStepSound(SoundType.PLANT);
this.setSoundType(SoundType.PLANT);
this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)).withProperty(VARIANT, BOPGrassType.LOAMY));
}

View file

@ -119,7 +119,7 @@ public class BlockBOPHalfOtherSlab extends BlockSlab implements IBOPBlock
{
super(Material.rock);
this.useNeighborBrightness = true;
this.setStepSound(SoundType.STONE);
this.setSoundType(SoundType.STONE);
// TODO: should depend on variant really, but that's quite hard to achieve...
this.setHardness(2.0F).setResistance(7.0F);
this.setDefaultState(this.blockState.getBaseState().withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));

View file

@ -92,7 +92,7 @@ public class BlockBOPHalfWoodSlab extends BlockSlab implements IBOPBlock
super(Material.wood);
this.useNeighborBrightness = true;
this.setHardness(2.0F).setResistance(5.0F);
this.setStepSound(SoundType.WOOD);
this.setSoundType(SoundType.WOOD);
this.setHarvestLevel("axe", 0);
this.setDefaultState(this.blockState.getBaseState().withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM));
}

View file

@ -72,7 +72,7 @@ public class BlockBOPHive extends Block implements IBOPBlock
// set some defaults
this.setHardness(0.5F);
this.setStepSound(SoundType.PLANT);
this.setSoundType(SoundType.PLANT);
this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, HiveType.HIVE) );
}

View file

@ -39,7 +39,7 @@ public class BlockBOPHoney extends Block implements IBOPBlock
public BlockBOPHoney() {
super(Material.glass);
this.setHardness(0.5F);
this.setStepSound(SoundType.STONE);
this.setSoundType(SoundType.STONE);
}
@Override

View file

@ -68,7 +68,7 @@ public class BlockBOPLilypad extends BlockLilyPad implements IBOPBlock
public BlockBOPLilypad()
{
this.setStepSound(SoundType.PLANT);
this.setSoundType(SoundType.PLANT);
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, LilypadType.MEDIUM));
}

View file

@ -80,7 +80,7 @@ public class BlockBOPMud extends Block implements IBOPBlock, ISustainsPlantType
// set some defaults
this.setHardness(0.6F);
this.setStepSound(SoundType.SAND);
this.setSoundType(SoundType.SAND);
this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, MudType.MUD) );
}

View file

@ -82,7 +82,7 @@ public class BlockBOPPlanks extends Block implements IBOPBlock
super(Material.wood);
this.setDefaultState(this.blockState.getBaseState());
this.setHardness(2.0F).setResistance(5.0F);
this.setStepSound(SoundType.WOOD);
this.setSoundType(SoundType.WOOD);
this.setHarvestLevel("axe", 0);
}

View file

@ -73,7 +73,7 @@ public class BlockBOPSand extends BlockFalling implements IBOPBlock, ISustainsPl
// set some defaults
this.setHardness(0.6F);
this.setStepSound(SoundType.SAND);
this.setSoundType(SoundType.SAND);
this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, SandType.QUICKSAND) );
}

View file

@ -95,7 +95,7 @@ public class BlockBOPSapling extends BlockBOPDecoration implements IGrowable {
public BlockBOPSapling()
{
super();
this.setStepSound(SoundType.PLANT);
this.setSoundType(SoundType.PLANT);
//this.setBlockBoundsByRadiusAndHeight(0.4F, 0.8F);
this.setDefaultState(this.blockState.getBaseState().withProperty(STAGE, Integer.valueOf(0)));
}

View file

@ -87,7 +87,7 @@ public class BlockBOPSeaweed extends BlockBOPDecoration implements IBOPBlock
super(Material.water);
// set some defaults
this.setStepSound(SoundType.PLANT);
this.setSoundType(SoundType.PLANT);
this.setDefaultState( this.blockState.getBaseState().withProperty(LEVEL, 15).withProperty(POSITION, SeaweedPosition.SINGLE).withProperty(VARIANT, SeaweedType.KELP) );
}

View file

@ -70,7 +70,7 @@ public class BlockBOPStone extends Block implements IBOPBlock
super(Material.rock);
// set some defaults
this.setStepSound(SoundType.STONE);
this.setSoundType(SoundType.STONE);
this.setHarvestLevel("pickaxe", 1, this.getDefaultState().withProperty(VARIANT, StoneType.LIMESTONE));
this.setHarvestLevel("pickaxe", 2, this.getDefaultState().withProperty(VARIANT, StoneType.SILTSTONE));
this.setHarvestLevel("pickaxe", 3, this.getDefaultState().withProperty(VARIANT, StoneType.SHALE));

View file

@ -47,7 +47,7 @@ public class BlockBOPVine extends BlockVine implements IBOPBlock
public BlockBOPVine(boolean useGreyScaleTextures)
{
this.setStepSound(SoundType.PLANT);
this.setSoundType(SoundType.PLANT);
this.setHardness(0.2F);
this.useGreyScaleTextures = useGreyScaleTextures;
}

View file

@ -74,7 +74,7 @@ public class UseHoeEventHandler
{
event.current.damageItem(1, event.entityLiving);
}
event.world.playSound(event.entityPlayer, (double) ((float) pos.getX() + 0.5F), (double) ((float) pos.getY() + 0.5F), (double) ((float) pos.getZ() + 0.5F), block.getStepSound().getStepSound(), SoundCategory.BLOCKS, (state.getBlock().getStepSound().getVolume() + 1.0F) / 2.0F, state.getBlock().getStepSound().getPitch() * 0.8F);
event.world.playSound(event.entityPlayer, (double) ((float) pos.getX() + 0.5F), (double) ((float) pos.getY() + 0.5F), (double) ((float) pos.getZ() + 0.5F), block.getSoundType().getStepSound(), SoundCategory.BLOCKS, (state.getBlock().getSoundType().getVolume() + 1.0F) / 2.0F, state.getBlock().getSoundType().getPitch() * 0.8F);
event.entityPlayer.swingArm(PlayerUtil.getHandForItem(event.entityPlayer, event.current));
}
}