Booklet stand model + bounding box

This commit is contained in:
Ellpeck 2016-05-26 14:59:48 +02:00
parent 796944d2ab
commit c6b0ea9f98
4 changed files with 64 additions and 435 deletions

View file

@ -21,22 +21,24 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
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.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -46,6 +48,13 @@ import javax.annotation.Nonnull;
@SuppressWarnings("deprecation")
public class BlockBookletStand extends BlockContainerBase implements IHudDisplay{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3);
private static final AxisAlignedBB AABB_1 = new AxisAlignedBB(0, 3*0.0625, 0, 1, 14*0.0625, 0.0625);
private static final AxisAlignedBB AABB_2 = new AxisAlignedBB(0, 3*0.0625, 0, 0.0625, 14*0.0625, 1);
private static final AxisAlignedBB AABB_3 = new AxisAlignedBB(1-0.0625, 3*0.0625, 0, 1, 14*0.0625, 1);
private static final AxisAlignedBB AABB_4 = new AxisAlignedBB(1, 3*0.0625, 1-0.0625, 0, 14*0.0625, 1);
public BlockBookletStand(String name){
super(Material.WOOD, name);
this.setHarvestLevel("axe", 0);
@ -54,6 +63,31 @@ public class BlockBookletStand extends BlockContainerBase implements IHudDisplay
this.setSoundType(SoundType.WOOD);
}
@SuppressWarnings("deprecation")
@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){
int meta = this.getMetaFromState(state);
switch(meta){
case 0:
return AABB_4;
case 1:
return AABB_1;
case 2:
return AABB_3;
case 3:
return AABB_2;
}
return super.getBoundingBox(state, source, pos);
}
@SuppressWarnings("deprecation")
@Override
public boolean isFullCube(IBlockState state){
return false;
}
@SuppressWarnings("deprecation")
@Override
public boolean isOpaqueCube(IBlockState state){
return false;
@ -132,4 +166,9 @@ public class BlockBookletStand extends BlockContainerBase implements IHudDisplay
minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg2, resolution.getScaledWidth()/2+25, resolution.getScaledHeight()/2+18, StringUtil.DECIMAL_COLOR_WHITE);
}
}
@Override
protected PropertyInteger getMetaProperty(){
return META;
}
}

View file

@ -8,10 +8,10 @@
"normal": [{}],
"inventory": [{}],
"meta": {
"0": { "y" : 180 },
"1": { "y" : 0 },
"2": { "y" : 90 },
"3": { "y" : 270 }
"0": { "y" : 270 },
"1": { "y" : 90 },
"2": { "y" : 180 },
"3": { "y" : 0 }
}
}
}

View file

@ -1,457 +1,47 @@
{
"ambientocclusion": false,
"textures": {
"particle": "actuallyadditions:blocks/models/modelCoffeeMachine",
"coffeeMachine": "actuallyadditions:blocks/models/modelCoffeeMachine"
"particle": "actuallyadditions:blocks/models/modelBookletStand",
"tex": "actuallyadditions:blocks/models/modelBookletStand"
},
"elements": [
{
"from": [3,0,1],
"to": [13,1,15],
"from": [0.01,3,0],
"to": [0.01,14,16],
"faces": {
"up": {
"uv": [2.1052632,0.26315784,2.7368422,1.5263159],
"texture": "#coffeeMachine"
},
"down": {
"uv": [2.999999,0.6842098,5.631579,2.68421],
"texture": "#coffeeMachine"
},
"west": {
"uv": [4.105262,1.3684217,5.052636,2.6315799],
"texture": "#coffeeMachine"
"uv": [9,0,13,2.5],
"texture": "#tex"
},
"east": {
"uv": [2.9473686,0.68421054,6.4210534,1.5263159],
"texture": "#coffeeMachine"
},
"north": {
"uv": [0,1.3400855,6.8,2.6],
"texture": "#coffeeMachine"
},
"south": {
"uv": [4.2105265,0.84210527,4.5263147,1.5263158],
"texture": "#coffeeMachine"
"uv": [9,0,13,2.5],
"texture": "#tex"
}
}
},
{
"from": [3,1,1],
"to": [13,10,7],
"from": [0.01,4,1],
"to": [1.01,13,15],
"faces": {
"up": {
"uv": [0.0,0.0,10.0,6.0],
"texture": "missingtexture"
"uv": [0.25,4.75,3.75,5],
"texture": "#tex"
},
"down": {
"uv": [0.0,0.0,10.0,6.0],
"texture": "missingtexture"
},
"west": {
"uv": [1.3684201,0.47368407,4.105262,1.5263153],
"texture": "#coffeeMachine"
"uv": [0.25,4.75,3.75,5],
"texture": "#tex"
},
"east": {
"uv": [1.5789478,0.31578958,5.157894,2.8421037],
"texture": "#coffeeMachine"
"uv": [0.25,5,4,7],
"texture": "#tex"
},
"north": {
"uv": [2,0,6,3],
"texture": "#coffeeMachine"
"uv": [0,5,0.25,7],
"texture": "#tex"
},
"south": {
"uv": [2,0,4,2],
"texture": "#coffeeMachine"
}
}
},
{
"from": [3,9,1],
"to": [13,11,12],
"faces": {
"up": {
"uv": [9.094739,1.0421052,10.568425,2.094737],
"texture": "#coffeeMachine"
},
"down": {
"uv": [2.3157897,0.21052635,6.000002,2.9999995],
"texture": "#coffeeMachine"
},
"west": {
"uv": [8.2,2.6,11.2,3],
"texture": "#coffeeMachine"
},
"east": {
"uv": [7.6,2.6,9,3],
"texture": "#coffeeMachine"
},
"north": {
"uv": [7.2,2.6,9,3],
"texture": "#coffeeMachine"
},
"south": {
"uv": [8.6,2.6,10,3],
"texture": "#coffeeMachine"
}
}
},
{
"from": [4,11,1],
"to": [12,14,9],
"faces": {
"up": {
"uv": [1.6,3,3.2,4.6],
"texture": "#coffeeMachine"
},
"down": {
"uv": [0.0,0.0,8.0,8.0],
"texture": "missingtexture"
},
"west": {
"uv": [10.315789,1,10.4,1.6842105],
"texture": "#coffeeMachine"
},
"east": {
"uv": [9.684211,1.4736842,10.736842,1.8947369],
"texture": "#coffeeMachine"
},
"north": {
"uv": [9.326308,1.1271291,10.957892,1.4631579],
"texture": "#coffeeMachine"
},
"south": {
"uv": [10.2,0.6,10.8,1.2],
"texture": "#coffeeMachine"
}
}
},
{
"from": [7,8,9.5],
"to": [9,9,11.5],
"faces": {
"up": {
"uv": [0.0,0.0,2.0,2.0],
"texture": "missingtexture"
},
"down": {
"uv": [9.684211,1.2631578,10.526316,1.8947369],
"texture": "#coffeeMachine"
},
"west": {
"uv": [9.7263155,1.2736838,10.357892,1.4842103],
"texture": "#coffeeMachine"
},
"east": {
"uv": [9.7263155,1.0526314,10.357892,2.1052628],
"texture": "#coffeeMachine"
},
"north": {
"uv": [10.105263,0.84210527,10.526316,1.8947369],
"texture": "#coffeeMachine"
},
"south": {
"uv": [10.105263,1.0526316,10.526316,1.6842105],
"texture": "#coffeeMachine"
}
}
},
{
"from": [6,1,9],
"to": [10,2,13],
"faces": {
"up": {
"uv": [7.368421,3.5789473,8,4.2],
"texture": "#coffeeMachine"
},
"down": {
"uv": [0.0,0.0,4.0,4.0],
"texture": "missingtexture"
},
"west": {
"uv": [6.947369,3.3684208,7.7894735,4.157895],
"texture": "#coffeeMachine"
},
"east": {
"uv": [7.3684196,3.2105274,7.999996,4],
"texture": "#coffeeMachine"
},
"north": {
"uv": [7.578948,3.5789473,8.210525,4.2105265],
"texture": "#coffeeMachine"
},
"south": {
"uv": [6.968419,3.210528,8.021048,4],
"texture": "#coffeeMachine"
}
}
},
{
"from": [6,2,8],
"to": [10,7,9],
"faces": {
"up": {
"uv": [7.105263,3.6315806,8.15789,4.2105265],
"texture": "#coffeeMachine"
},
"down": {
"uv": [7.38947,3.3789477,7.810521,4.1684194],
"texture": "#coffeeMachine"
},
"west": {
"uv": [7.368421,3.6315784,8,4],
"texture": "#coffeeMachine"
},
"east": {
"uv": [7.2105265,3.4210534,7.8,4],
"texture": "#coffeeMachine"
},
"north": {
"uv": [6.915793,3.221051,7.8,4],
"texture": "#coffeeMachine"
},
"south": {
"uv": [7.526315,3.421054,8,4],
"texture": "#coffeeMachine"
}
}
},
{
"from": [6,2,13],
"to": [10,7,14],
"faces": {
"up": {
"uv": [7.5789475,3.7894738,8,4],
"texture": "#coffeeMachine"
},
"down": {
"uv": [6.999999,3.6,7.631578,3.9684215],
"texture": "#coffeeMachine"
},
"west": {
"uv": [7.368421,3.5789473,8,4],
"texture": "#coffeeMachine"
},
"east": {
"uv": [7.7894735,3.368421,8,3.7894738],
"texture": "#coffeeMachine"
},
"north": {
"uv": [7.157894,3.4210515,7.8,4],
"texture": "#coffeeMachine"
},
"south": {
"uv": [7.2,3.8,8,4],
"texture": "#coffeeMachine"
}
}
},
{
"from": [5,2,9],
"to": [6,7,13],
"faces": {
"up": {
"uv": [7.2105265,3.157895,7.999999,3.9999993],
"texture": "#coffeeMachine"
},
"down": {
"uv": [6.7894745,3.578949,7.842106,4],
"texture": "#coffeeMachine"
},
"west": {
"uv": [6.7684236,3.789474,8.242098,4.000001],
"texture": "#coffeeMachine"
},
"east": {
"uv": [7.7368455,3.578947,8,4.2],
"texture": "#coffeeMachine"
},
"north": {
"uv": [7.526315,3.368423,8,4],
"texture": "#coffeeMachine"
},
"south": {
"uv": [7.5789504,3.3684218,8,4],
"texture": "#coffeeMachine"
}
}
},
{
"from": [10,2,9],
"to": [11,7,13],
"faces": {
"up": {
"uv": [7.1578946,3.5789473,7.7894735,4],
"texture": "#coffeeMachine"
},
"down": {
"uv": [7.368421,3.7894738,7.5789475,4],
"texture": "#coffeeMachine"
},
"west": {
"uv": [7.1578946,3.4210515,7.6,3.8],
"texture": "#coffeeMachine"
},
"east": {
"uv": [6.9789453,3.2210534,8.031565,4.0105267],
"texture": "#coffeeMachine"
},
"north": {
"uv": [7.3684235,3.421053,8.210532,3.9999993],
"texture": "#coffeeMachine"
},
"south": {
"uv": [7.421055,3.210527,7.999999,4],
"texture": "#coffeeMachine"
}
}
},
{
"from": [4,2,10],
"to": [5,3,12],
"faces": {
"up": {
"uv": [6.778949,3.1894736,7.4105287,3.821053],
"texture": "#coffeeMachine"
},
"down": {
"uv": [7.2105265,3.210527,7.7894735,4.1578965],
"texture": "#coffeeMachine"
},
"west": {
"uv": [6.9473686,3.5789473,7.5789475,4],
"texture": "#coffeeMachine"
},
"east": {
"uv": [0.0,0.0,2.0,1.0],
"texture": "missingtexture"
},
"north": {
"uv": [7.0000014,3.4210515,7.8,4],
"texture": "#coffeeMachine"
},
"south": {
"uv": [7.3684244,3.3684216,7.8,4],
"texture": "#coffeeMachine"
}
}
},
{
"from": [4,5,10],
"to": [5,6,12],
"faces": {
"up": {
"uv": [7.5789456,3.7894752,8.210522,4.2105274],
"texture": "#coffeeMachine"
},
"down": {
"uv": [7.5789475,3.7894738,8,4],
"texture": "#coffeeMachine"
},
"west": {
"uv": [6.8947353,3.5789483,7.5263157,3.9999993],
"texture": "#coffeeMachine"
},
"east": {
"uv": [0.0,0.0,2.0,1.0],
"texture": "missingtexture"
},
"north": {
"uv": [7.2105207,3.2105284,8.210525,4.2105293],
"texture": "#coffeeMachine"
},
"south": {
"uv": [7.5789475,3.7894752,8.210524,4.2105284],
"texture": "#coffeeMachine"
}
}
},
{
"from": [3,3,10],
"to": [4,5,12],
"faces": {
"up": {
"uv": [7.421055,3.4736857,8.000004,4.000002],
"texture": "#coffeeMachine"
},
"down": {
"uv": [7.368421,3.5789473,8,3.7894738],
"texture": "#coffeeMachine"
},
"west": {
"uv": [7.5789475,3.5789473,8,3.7894738],
"texture": "#coffeeMachine"
},
"east": {
"uv": [7.4736843,3.4736855,8.2105255,4.2105255],
"texture": "#coffeeMachine"
},
"north": {
"uv": [6.9684157,3.178948,7.3894744,4.021053],
"texture": "#coffeeMachine"
},
"south": {
"uv": [6.978949,3.5999997,7.610526,4.0210524],
"texture": "#coffeeMachine"
}
}
},
{
"from": [6,10.2,10.8],
"to": [7,11.2,11.8],
"faces": {
"up": {
"uv": [10.315789,2.4,10.4,2.6],
"texture": "#coffeeMachine"
},
"down": {
"uv": [0.0,0.0,1.0,1.0],
"texture": "missingtexture"
},
"west": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
},
"east": {
"uv": [9.4,2.4,9.6,2.6],
"texture": "#coffeeMachine"
},
"north": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
},
"south": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
}
}
},
{
"from": [9,10.2,10.8],
"to": [10,11.2,11.8],
"faces": {
"up": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
},
"down": {
"uv": [0.0,0.0,1.0,1.0],
"texture": "missingtexture"
},
"west": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
},
"east": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
},
"north": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
},
"south": {
"uv": [9.4,2.2,9.8,2.6],
"texture": "#coffeeMachine"
"uv": [0,5,0.25,7],
"texture": "#tex"
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B