Fixed most bounding boxes

This commit is contained in:
Ellpeck 2016-05-02 17:09:23 +02:00
parent 5aa63f2822
commit 1757f38bd1
14 changed files with 77 additions and 56 deletions

View file

@ -26,13 +26,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
//TODO Fix bounding box
public class BlockCoffeeMachine extends BlockContainerBase{ public class BlockCoffeeMachine extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1-0.0625*2, 1-0.0625, 1-0.0625);
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
public BlockCoffeeMachine(String name){ public BlockCoffeeMachine(String name){
@ -43,6 +46,11 @@ public class BlockCoffeeMachine extends BlockContainerBase{
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
} }
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB;
}
@Override @Override
public boolean isFullCube(IBlockState state){ public boolean isFullCube(IBlockState state){
return false; return false;

View file

@ -28,16 +28,28 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class BlockCompost extends BlockContainerBase implements IHudDisplay{ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0, 0.0625, 1-0.0625, 11*0.0625, 1-0.0625);
protected static final AxisAlignedBB AABB_LEGS = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.3125D, 1.0D);
protected static final AxisAlignedBB AABB_WALL_NORTH = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
protected static final AxisAlignedBB AABB_WALL_SOUTH = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
protected static final AxisAlignedBB AABB_WALL_EAST = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
protected static final AxisAlignedBB AABB_WALL_WEST = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
public BlockCompost(String name){ public BlockCompost(String name){
super(Material.WOOD, name); super(Material.WOOD, name);
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
@ -48,27 +60,19 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
//this.setBlockBoundsForItemRender(); //this.setBlockBoundsForItemRender();
} }
//TODO Fix bounding box
/*@Override
public void setBlockBoundsForItemRender(){
float f = 1.0F/16.0F;
this.setBlockBounds(f, 0.0F, f, 1.0F-f, 11*f, 1.0F-f);
}
@Override @Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); return AABB;
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); }
float f = 0.125F, y = 0.7F;
this.setBlockBounds(0.0F, 0.0F, 0.0F, f, y, 1.0F); @Override
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn){
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, y, f); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_LEGS);
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_WEST);
this.setBlockBounds(1.0F-f, 0.0F, 0.0F, 1.0F, y, 1.0F); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_NORTH);
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_EAST);
this.setBlockBounds(0.0F, 0.0F, 1.0F-f, 1.0F, y, 1.0F); addCollisionBoxToList(pos, entityBox, collidingBoxes, AABB_WALL_SOUTH);
super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); }
this.setBlockBoundsForItemRender();
}*/
@Override @Override
public boolean isOpaqueCube(IBlockState state){ public boolean isOpaqueCube(IBlockState state){

View file

@ -18,18 +18,26 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFishingNet extends BlockContainerBase{ public class BlockFishingNet extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 0.0625, 1);
public BlockFishingNet(String name){ public BlockFishingNet(String name){
super(Material.WOOD, name); super(Material.WOOD, name);
this.setHarvestLevel("axe", 0); this.setHarvestLevel("axe", 0);
this.setHardness(0.5F); this.setHardness(0.5F);
this.setResistance(3.0F); this.setResistance(3.0F);
this.setSoundType(SoundType.WOOD); this.setSoundType(SoundType.WOOD);
//TODO Fix block bounds }
//this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F);
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB;
} }
@Override @Override

View file

@ -18,19 +18,27 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFurnaceSolar extends BlockContainerBase{ public class BlockFurnaceSolar extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(0, 0, 0, 1, 6*0.0625, 1);
public BlockFurnaceSolar(String name){ public BlockFurnaceSolar(String name){
super(Material.ROCK, name); super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
}
//TODO Block bounds @Override
//this.setBlockBounds(0F, 0F, 0F, 1F, 6F/16F, 1F); public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return AABB;
} }
@Override @Override

View file

@ -22,10 +22,11 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
//TODO Fix bounding box
public class BlockLaserRelay extends BlockContainerBase{ public class BlockLaserRelay extends BlockContainerBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5);

View file

@ -18,20 +18,26 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockPhantomBooster extends BlockContainerBase{ public class BlockPhantomBooster extends BlockContainerBase{
private static final AxisAlignedBB AABB = new AxisAlignedBB(2*0.0625, 0, 2*0.0625, 1-2*0.0625, 1, 1-2*0.0625);
public BlockPhantomBooster(String name){ public BlockPhantomBooster(String name){
super(Material.ROCK, name); super(Material.ROCK, name);
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.5F); this.setHardness(1.5F);
this.setResistance(10.0F); this.setResistance(10.0F);
this.setSoundType(SoundType.STONE); this.setSoundType(SoundType.STONE);
}
//TODO Fix block bounds @Override
//float f = 1F/16F; public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
//this.setBlockBounds(2*f, 0F, 2*f, 1-2*f, 1F, 1-2*f); return AABB;
} }
@Override @Override

View file

@ -87,6 +87,7 @@ public class BlockSlabs extends BlockBase{
return this.getStateFromMeta(meta); return this.getStateFromMeta(meta);
} }
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
return state.getValue(META) == 1 ? AABB_TOP_HALF : AABB_BOTTOM_HALF; return state.getValue(META) == 1 ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
} }
@ -114,6 +115,7 @@ public class BlockSlabs extends BlockBase{
this.setMaxDamage(0); this.setMaxDamage(0);
} }
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
if(stack.stackSize != 0 && playerIn.canPlayerEdit(pos.offset(facing), facing, stack)){ if(stack.stackSize != 0 && playerIn.canPlayerEdit(pos.offset(facing), facing, stack)){
IBlockState state = worldIn.getBlockState(pos); IBlockState state = worldIn.getBlockState(pos);
@ -141,6 +143,7 @@ public class BlockSlabs extends BlockBase{
} }
} }
@Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack){ public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack){
IBlockState state = worldIn.getBlockState(pos); IBlockState state = worldIn.getBlockState(pos);

View file

@ -57,32 +57,6 @@ public class BlockSmileyCloud extends BlockContainerBase{
return false; return false;
} }
//TODO Fix bounding box
/*@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){
int meta = PosUtil.getMetadata(pos, world);
float f = 0.0625F;
if(meta == 1){
this.setBlockBounds(0F, 0F, 0F, 1F, 1F-f*3F, 1F-f*2F);
}
if(meta == 3){
this.setBlockBounds(0F, 0F, 0F, 1F-f*2F, 1F-f*3F, 1F);
}
if(meta == 0){
this.setBlockBounds(0F, 0F, f*2F, 1F, 1F-f*3F, 1F);
}
if(meta == 2){
this.setBlockBounds(f*2F, 0F, 0F, 1F, 1F-f*3F, 1F);
}
}
@Override
public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){
this.setBlockBoundsBasedOnState(world, pos);
super.addCollisionBoxesToList(world, pos, state, axis, list, entity);
}*/
@Override @Override
public boolean isOpaqueCube(IBlockState state){ public boolean isOpaqueCube(IBlockState state){
return false; return false;

View file

@ -77,11 +77,13 @@ public class BlockWallAA extends BlockBase{
return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side); return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side);
} }
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
state = this.getActualState(state, source, pos); state = this.getActualState(state, source, pos);
return field_185751_g[figureOutSomeWallStuff(state)]; return field_185751_g[figureOutSomeWallStuff(state)];
} }
@Override
public AxisAlignedBB getSelectedBoundingBox(IBlockState blockState, World worldIn, BlockPos pos){ public AxisAlignedBB getSelectedBoundingBox(IBlockState blockState, World worldIn, BlockPos pos){
blockState = this.getActualState(blockState, worldIn, pos); blockState = this.getActualState(blockState, worldIn, pos);
return field_185750_B[figureOutSomeWallStuff(blockState)]; return field_185750_B[figureOutSomeWallStuff(blockState)];

View file

@ -51,6 +51,7 @@ public class ItemAllToolAA extends ItemToolAA implements IColorProvidingItem{
this.color = color; this.color = color;
} }
@Override
protected void registerRendering(){ protected void registerRendering(){
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID, "itemPaxel")); ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ResourceLocation(ModUtil.MOD_ID, "itemPaxel"));
ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID, "itemPaxel")); ActuallyAdditions.proxy.addRenderVariant(this, new ResourceLocation(ModUtil.MOD_ID, "itemPaxel"));

View file

@ -34,6 +34,7 @@ public class ItemAxeAA extends ItemToolAA{
super(6.0F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON); super(6.0F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
} }
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state){ public float getStrVsBlock(ItemStack stack, IBlockState state){
Material material = state.getMaterial(); Material material = state.getMaterial();
return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;

View file

@ -214,6 +214,7 @@ public class ItemDrill extends ItemEnergy{
return EnumRarity.EPIC; return EnumRarity.EPIC;
} }
@Override
public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){ public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){
Multimap<String, AttributeModifier> map = super.getAttributeModifiers(slot, stack); Multimap<String, AttributeModifier> map = super.getAttributeModifiers(slot, stack);

View file

@ -34,6 +34,7 @@ public class ItemPickaxeAA extends ItemToolAA{
super(1.0F, -2.8F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON); super(1.0F, -2.8F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
} }
@Override
public boolean canHarvestBlock(IBlockState blockIn){ public boolean canHarvestBlock(IBlockState blockIn){
Block block = blockIn.getBlock(); Block block = blockIn.getBlock();
@ -74,6 +75,7 @@ public class ItemPickaxeAA extends ItemToolAA{
} }
} }
@Override
public float getStrVsBlock(ItemStack stack, IBlockState state){ public float getStrVsBlock(ItemStack stack, IBlockState state){
Material material = state.getMaterial(); Material material = state.getMaterial();
return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;

View file

@ -43,11 +43,13 @@ public class ItemShovelAA extends ItemToolAA{
super(1.5F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON); super(1.5F, -3.0F, material, repairItem, unlocalizedName, rarity, EFFECTIVE_ON);
} }
@Override
public boolean canHarvestBlock(IBlockState blockIn){ public boolean canHarvestBlock(IBlockState blockIn){
Block block = blockIn.getBlock(); Block block = blockIn.getBlock();
return block == Blocks.SNOW_LAYER || block == Blocks.SNOW; return block == Blocks.SNOW_LAYER || block == Blocks.SNOW;
} }
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
return Items.IRON_HOE.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ); return Items.IRON_HOE.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
} }