From ebf9f31d9d2aa36791bfb9269ccc71342768ad94 Mon Sep 17 00:00:00 2001 From: Matt Caughey Date: Fri, 22 Jan 2016 03:41:57 -0500 Subject: [PATCH] Added jar block (Still needs work) --- .../biomesoplenty/api/block/BOPBlocks.java | 1 + .../common/block/BlockBOPFruit.java | 1 + .../common/block/BlockBOPJar.java | 95 ++++++++++++++++++ .../biomesoplenty/common/init/ModBlocks.java | 1 + .../common/item/ItemJarFilled.java | 2 +- .../biomesoplenty/blockstates/jar_block.json | 5 + .../assets/biomesoplenty/lang/en_US.lang | 1 + .../biomesoplenty/models/block/jar.json | 67 ++++++++++++ .../biomesoplenty/models/item/jar_block.json | 10 ++ .../textures/blocks/jar_bottom.png | Bin 0 -> 212 bytes .../textures/blocks/jar_bottom_side.png | Bin 0 -> 211 bytes .../textures/blocks/jar_main_bottom.png | Bin 0 -> 209 bytes .../textures/blocks/jar_main_side.png | Bin 0 -> 259 bytes .../textures/blocks/jar_main_top.png | Bin 0 -> 205 bytes .../textures/blocks/jar_opening_side.png | Bin 0 -> 239 bytes .../textures/blocks/jar_opening_top.png | Bin 0 -> 212 bytes .../textures/blocks/jar_stopper_side.png | Bin 0 -> 253 bytes .../textures/blocks/jar_stopper_top.png | Bin 0 -> 262 bytes 18 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 src/main/java/biomesoplenty/common/block/BlockBOPJar.java create mode 100644 src/main/resources/assets/biomesoplenty/blockstates/jar_block.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/jar.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/jar_block.json create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_bottom.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_bottom_side.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_main_bottom.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_main_side.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_main_top.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_opening_side.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_opening_top.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_stopper_side.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/jar_stopper_top.png diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index adb863d3c..6a032d2a0 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -138,6 +138,7 @@ public class BOPBlocks public static Block double_plant; public static Block honey_block; + public static Block jar_block; public static Block honey; public static Fluid honey_fluid; diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPFruit.java b/src/main/java/biomesoplenty/common/block/BlockBOPFruit.java index 183fefbe3..9b9959ae1 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPFruit.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPFruit.java @@ -67,6 +67,7 @@ public class BlockBOPFruit extends BlockBOPDecoration this.setStepSound(Block.soundTypeGrass); this.setBlockBoundsByRadiusAndHeight(0.25F, 0.25F, true); this.setDefaultState( this.blockState.getBaseState().withProperty(VARIANT, FruitType.APPLE) ); + this.setCreativeTab(null); } // map from state to meta and vice verca diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPJar.java b/src/main/java/biomesoplenty/common/block/BlockBOPJar.java new file mode 100644 index 000000000..f93813905 --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPJar.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * Copyright 2014-2016, the Biomes O' Plenty Team + * + * This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. + * + * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. + ******************************************************************************/ + +package biomesoplenty.common.block; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import biomesoplenty.api.block.BOPBlocks; +import biomesoplenty.api.block.IBOPBlock; +import biomesoplenty.api.item.BOPItems; +import biomesoplenty.common.block.BlockBOPHalfOtherSlab.SlabType; +import biomesoplenty.common.item.ItemBOPBlock; +import biomesoplenty.common.item.ItemJarFilled; + +public class BlockBOPJar extends Block implements IBOPBlock +{ + + // implement IBOPBlock + @Override + public Class getItemClass() { return ItemBOPBlock.class; } + @Override + public int getItemRenderColor(IBlockState state, int tintIndex) { return this.getRenderColor(state); } + @Override + public IProperty[] getPresetProperties() { return new IProperty[] {}; } + @Override + public IProperty[] getNonRenderingProperties() { return null; } + @Override + public String getStateName(IBlockState state) {return "";} + + + public BlockBOPJar() { + // use rock as default material + this(Material.glass); + } + + public BlockBOPJar(Material material) + { + super(material); + // set some defaults + this.setHardness(1.0F); + this.setStepSound(Block.soundTypeGlass); + this.setCreativeTab(null); + } + + @Override + public boolean isOpaqueCube() + { + return false; + } + + // not full cube + @Override + public boolean isFullCube() + { + return false; + } + + @Override + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) + { + List ret = new ArrayList(); + + //Drop two of the corresponding half slab for this block + ret.add(new ItemStack(BOPItems.jar_filled, 1, ItemJarFilled.JarContents.TERRARIUM.ordinal())); + + return ret; + } + + @Override + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT; + } + +} \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index dadddb0ea..a7f290b3d 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -221,6 +221,7 @@ public class ModBlocks double_plant = registerBlock( new BlockBOPDoublePlant(), "double_plant" ); honey_block = registerBlock( new BlockBOPHoney(), "honey_block" ); + jar_block = registerBlock( new BlockBOPJar(), "jar_block" ); // fluids diff --git a/src/main/java/biomesoplenty/common/item/ItemJarFilled.java b/src/main/java/biomesoplenty/common/item/ItemJarFilled.java index c7ab3dcb5..10a0c8333 100644 --- a/src/main/java/biomesoplenty/common/item/ItemJarFilled.java +++ b/src/main/java/biomesoplenty/common/item/ItemJarFilled.java @@ -170,7 +170,7 @@ public class ItemJarFilled extends Item double distZ = hitZ - player.posZ; double a = 0.9D; Vec3 releasePoint = new Vec3(player.posX + a * distX, player.posY + (double)player.getEyeHeight() + a * distY, player.posZ + a * distZ); - return this.releasePixie(stack, world, player, releasePoint); + return this.releasePixie(stack, world, player, releasePoint); // TODO: are you supposed to be able to pour out honey? How much should you get? Why don't we just use buckets? case HONEY: case POISON: case TERRARIUM: default: diff --git a/src/main/resources/assets/biomesoplenty/blockstates/jar_block.json b/src/main/resources/assets/biomesoplenty/blockstates/jar_block.json new file mode 100644 index 000000000..7e1e9dd75 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/jar_block.json @@ -0,0 +1,5 @@ +{ + "variants": { + "normal": { "model": "biomesoplenty:jar" } + } +} diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index 65a553292..cc4b0c58d 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -277,6 +277,7 @@ tile.jacaranda_fence.name=Jacaranda Fence tile.jacaranda_fence_gate.name=Jacaranda Fence Gate tile.jacaranda_wood_slab.name=Jacaranda Wood Slab tile.jacaranda_stairs.name=Jacaranda Wood Stairs +tile.jar_block.name=Terrarium Jar Block tile.leaves_0.yellow_autumn_leaves.name=Yellow Autumn Leaves tile.leaves_0.orange_autumn_leaves.name=Orange Autumn Leaves tile.leaves_0.bamboo_leaves.name=Bamboo Leaves diff --git a/src/main/resources/assets/biomesoplenty/models/block/jar.json b/src/main/resources/assets/biomesoplenty/models/block/jar.json new file mode 100644 index 000000000..95966d3e4 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/jar.json @@ -0,0 +1,67 @@ +{ + "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)", + "ambientocclusion": false, + "textures": { + "0": "biomesoplenty:blocks/jar_main_side", + "1": "biomesoplenty:blocks/jar_main_top", + "2": "biomesoplenty:blocks/jar_main_bottom", + "3": "biomesoplenty:blocks/jar_opening_side", + "4": "biomesoplenty:blocks/jar_opening_top", + "5": "biomesoplenty:blocks/jar_bottom_side", + "6": "biomesoplenty:blocks/jar_bottom", + "7": "biomesoplenty:blocks/jar_stopper_side", + "8": "biomesoplenty:blocks/jar_stopper_top" + }, + "elements": [ + { + "name": "Jar", + "from": [ 4.0, 1.0, 4.0 ], + "to": [ 13.0, 9.0, 13.0 ], + "faces": { + "north": { "texture": "#0", "uv": [ 4.0, 7.0, 13.0, 15.0 ] }, + "east": { "texture": "#0", "uv": [ 4.0, 7.0, 13.0, 15.0 ] }, + "south": { "texture": "#0", "uv": [ 4.0, 7.0, 13.0, 15.0 ] }, + "west": { "texture": "#0", "uv": [ 4.0, 7.0, 13.0, 15.0 ] }, + "up": { "texture": "#1", "uv": [ 4.0, 4.0, 13.0, 13.0 ] }, + "down": { "texture": "#2", "uv": [ 4.0, 4.0, 13.0, 13.0 ] } + } + }, + { + "name": "Opening", + "from": [ 5.0, 9.0, 5.0 ], + "to": [ 12.0, 12.0, 12.0 ], + "faces": { + "north": { "texture": "#3", "uv": [ 5.0, 4.0, 12.0, 7.0 ] }, + "east": { "texture": "#3", "uv": [ 5.0, 4.0, 12.0, 7.0 ] }, + "south": { "texture": "#3", "uv": [ 5.0, 4.0, 12.0, 7.0 ] }, + "west": { "texture": "#3", "uv": [ 5.0, 4.0, 12.0, 7.0 ] }, + "up": { "texture": "#4", "uv": [ 5.0, 5.0, 12.0, 12.0 ] } + } + }, + { + "name": "Bottom", + "from": [ 5.0, 0.0, 5.0 ], + "to": [ 12.0, 1.0, 12.0 ], + "faces": { + "north": { "texture": "#5", "uv": [ 5.0, 16.0, 12.0, 15.0 ] }, + "east": { "texture": "#5", "uv": [ 5.0, 16.0, 12.0, 15.0 ] }, + "south": { "texture": "#5", "uv": [ 5.0, 16.0, 12.0, 15.0 ] }, + "west": { "texture": "#5", "uv": [ 5.0, 16.0, 12.0, 15.0 ] }, + "down": { "texture": "#6", "uv": [ 5.0, 5.0, 12.0, 12.0 ] } + } + }, + { + "name": "Stopper", + "from": [ 6.0, 10.0, 6.0 ], + "to": [ 11.0, 13.0, 11.0 ], + "faces": { + "north": { "texture": "#7", "uv": [ 6.0, 3.0, 11.0, 6.0 ] }, + "east": { "texture": "#7", "uv": [ 6.0, 3.0, 11.0, 6.0 ] }, + "south": { "texture": "#7", "uv": [ 6.0, 3.0, 11.0, 6.0 ] }, + "west": { "texture": "#7", "uv": [ 6.0, 3.0, 11.0, 6.0 ] }, + "up": { "texture": "#8", "uv": [ 6.0, 5.0, 11.0, 10.0 ] }, + "down": { "texture": "#8", "uv": [ 6.0, 5.0, 11.0, 10.0 ] } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/item/jar_block.json b/src/main/resources/assets/biomesoplenty/models/item/jar_block.json new file mode 100644 index 000000000..89780e016 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/jar_block.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/jar_block", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/jar_bottom.png b/src/main/resources/assets/biomesoplenty/textures/blocks/jar_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..14853559a6f04d95bf2c81b9bea84bde2dfdfa21 GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33 zJ0#LT=By}Z;C1rt33 zJPn_kda_wASJ=u r!{)}kxDmlU#`AlZwSM~k|0`M5RezN3ITE-XXdZ*7tDnm{r-UW|<%U4! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/jar_main_bottom.png b/src/main/resources/assets/biomesoplenty/textures/blocks/jar_main_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..dd7bcf6e47f9269981d6e8950b0f054b3845c14c GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmSN`?>!lvI6;>1s;*b z3=Dh+L6~vJ#O${~L5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33J^RW2OB^HXdQ`W5d#k#oh;(?4F0m1V-Zm)d5{;9YG wZx5RrGemU3e+A?A&kJ5}SB{Xle|jsU@`Gm~ex0{`fJQTTy85}Sb4q9e0L_9%YybcN literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/jar_main_side.png b/src/main/resources/assets/biomesoplenty/textures/blocks/jar_main_side.png new file mode 100644 index 0000000000000000000000000000000000000000..07fdad7bffe5ddc872c9d6636d24b7bf1373e3e7 GIT binary patch literal 259 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33 zJFS$5DWjc6E5-|P~dQxyJ&UEm3M~({2t1QWOxL6zBwBAsY&i$ZN!Yq z?kg@HzAXsi!lvI6;>1s;*b z3=DkxL735kHCP2GC{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXPIMM=Lb~d?djqe zV&T8^k|7_10>=S||Nkxawe)exuHh4(bm+v1Gx`#|J#21^TRS2i=j`5PKTY323M|6B sxbb3!0#LT=By}Z;C1rt33 zJ0#LT=By}Z;C1rt33 zJ0#LT=By}Z;C1rt33 zJ0#LT=By}Z;C1rt33 zJ5DWjM=L~rp9C%tEu1ZLEU=Vg>P~=EB%v5!OK`P=y!~CE&A*cHX zy!C%hvwyFro*lpRz=?*5jLOa-rmV+qTk`+f*1z@X4(@|LRnzZpl_^)W_|kCW=R2o@ wm+~^ftE0p1rY+k56y1=J0@22N?0<-!b#q?0^ym5YKqoMGy85}Sb4q9e0I-i)7XSbN literal 0 HcmV?d00001