From e34ff058bee9c8220bcaf76a8c2af38987310da7 Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Thu, 26 Mar 2015 14:08:55 +0000 Subject: [PATCH 1/6] Allow BOPBlock instances to specify their own item class --- src/main/java/biomesoplenty/api/block/BOPBlock.java | 7 +++++++ src/main/java/biomesoplenty/common/init/ModBlocks.java | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/biomesoplenty/api/block/BOPBlock.java b/src/main/java/biomesoplenty/api/block/BOPBlock.java index 50ccd0e37..0a8ecdf51 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlock.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlock.java @@ -13,6 +13,7 @@ import java.util.Set; import com.google.common.collect.ImmutableSet; +import biomesoplenty.common.item.ItemBlockWithVariants; import biomesoplenty.common.util.block.BlockStateUtils; import biomesoplenty.common.util.inventory.CreativeTabBOP; import net.minecraft.block.Block; @@ -22,6 +23,7 @@ import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -36,6 +38,11 @@ public abstract class BOPBlock extends Block this.setCreativeTab(CreativeTabBOP.instance); } + + // get the item class to use when registering this block + public Class getItemClass() { + return ItemBlockWithVariants.class; + } @Override @SideOnly(Side.CLIENT) diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index 6146d7ae6..e5aa92b4c 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -10,11 +10,8 @@ package biomesoplenty.common.init; import static biomesoplenty.api.block.BOPBlocks.*; -import java.util.Set; - import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; import biomesoplenty.api.block.BOPBlock; @@ -39,7 +36,6 @@ import biomesoplenty.common.block.BlockMud; import biomesoplenty.common.block.BlockTurnip; import biomesoplenty.common.block.BlockFlesh; import biomesoplenty.common.handler.GuiEventHandler; -import biomesoplenty.common.item.ItemBlockWithVariants; import biomesoplenty.common.util.block.BlockStateUtils; import biomesoplenty.core.BiomesOPlenty; @@ -78,7 +74,7 @@ public class ModBlocks if (block.hasPresetProperties()) { - GameRegistry.registerBlock(block, ItemBlockWithVariants.class, name); + GameRegistry.registerBlock(block, block.getItemClass(), name); for (IBlockState state : block.presetStates) { From f55f08680c032206e326aa48a1faf46cca6da261 Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Thu, 26 Mar 2015 14:40:42 +0000 Subject: [PATCH 2/6] Add waterlily variants --- .../biomesoplenty/api/block/BOPBlocks.java | 1 + .../common/block/BlockBOPLilypad.java | 194 ++++++++++++++++++ .../biomesoplenty/common/init/ModBlocks.java | 2 + .../common/item/ItemBOPLilypad.java | 87 ++++++++ .../biomesoplenty/blockstates/waterlily.json | 22 ++ .../models/block/lily_medium.json | 16 ++ .../models/block/lily_small.json | 16 ++ .../biomesoplenty/models/block/lily_tiny.json | 16 ++ .../models/item/lily_medium.json | 18 ++ .../biomesoplenty/models/item/lily_small.json | 18 ++ .../biomesoplenty/models/item/lily_tiny.json | 18 ++ .../textures/blocks/lily_medium.png | Bin 0 -> 269 bytes .../textures/blocks/lily_small.png | Bin 0 -> 247 bytes .../textures/blocks/lily_tiny.png | Bin 0 -> 266 bytes 14 files changed, 408 insertions(+) create mode 100644 src/main/java/biomesoplenty/common/block/BlockBOPLilypad.java create mode 100644 src/main/java/biomesoplenty/common/item/ItemBOPLilypad.java create mode 100644 src/main/resources/assets/biomesoplenty/blockstates/waterlily.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/lily_medium.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/lily_small.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/lily_tiny.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/lily_medium.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/lily_small.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/lily_tiny.json create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/lily_medium.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/lily_small.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/lily_tiny.png diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index eb87edbc2..bb43608c2 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -32,4 +32,5 @@ public class BOPBlocks public static Block turnip_block; public static Block flesh; public static Block grass; + public static Block waterlily; } diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPLilypad.java b/src/main/java/biomesoplenty/common/block/BlockBOPLilypad.java new file mode 100644 index 000000000..b718e03ed --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPLilypad.java @@ -0,0 +1,194 @@ +/******************************************************************************* + * Copyright 2014, 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.List; + +import biomesoplenty.api.block.BOPPlant; +import biomesoplenty.common.item.ItemBOPLilypad; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.item.ItemBlock; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.EnumPlantType; +import net.minecraftforge.common.IPlantable; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class BlockBOPLilypad extends BOPPlant implements IPlantable +{ + + public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", LilypadType.class); + + public BlockBOPLilypad() + { + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, LilypadType.MEDIUM)); + float f = 0.5F; + float f1 = 0.015625F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); + } + + // need to use a custom item class because of the unique way lilies are placed + @Override + public Class getItemClass() { + return ItemBOPLilypad.class; + } + + // lilies should always be in the centre of the water block + @Override + public Block.EnumOffsetType getOffsetType() + { + return Block.EnumOffsetType.NONE; + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + // only one property to worry about, the variant, so just map [0 => MEDIUM, 1 => SMALL, 2 => TINY] + return this.getDefaultState().withProperty(VARIANT_PROP, LilypadType.values()[meta]); + } + + @Override + public int getMetaFromState(IBlockState state) + { + // only one property to worry about, the variant, so just map [0 => MEDIUM, 1 => SMALL, 2 => TINY] + return ((LilypadType) state.getValue(VARIANT_PROP)).ordinal(); + } + + @Override + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] { VARIANT_PROP }); + } + + @Override + public IProperty[] getPresetProperties() + { + return new IProperty[] { VARIANT_PROP }; + } + + @Override + public String getStateName(IBlockState state, boolean fullName) + { + return ((LilypadType) state.getValue(VARIANT_PROP)).getName(); + } + + // copied from vanilla BlockLilyPad + // boats can go through lily pads + @Override + public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) + { + if (collidingEntity == null || !(collidingEntity instanceof EntityBoat)) + { + super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + } + } + + // copied from vanilla BlockLilyPad + @Override + public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) + { + return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ); + } + + // copied from vanilla BlockLilyPad + @Override + @SideOnly(Side.CLIENT) + public int getBlockColor() + { + return 7455580; + } + + // copied from vanilla BlockLilyPad + @Override + @SideOnly(Side.CLIENT) + public int getRenderColor(IBlockState state) + { + return 7455580; + } + + // copied from vanilla BlockLilyPad + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return 2129968; + } + + public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + { + + Boolean y1 = super.canPlaceBlockAt(worldIn, pos); + Boolean y2 = worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + + return y1 && y2; + //return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this); + } + + @Override + public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) + { + if (pos.getY() >= 0 && pos.getY() < 256) + { + IBlockState iblockstate1 = worldIn.getBlockState(pos.down()); + return iblockstate1.getBlock().getMaterial() == Material.water && ((Integer)iblockstate1.getValue(BlockLiquid.LEVEL)).intValue() == 0; + } + else + { + return false; + } + } + + @Override + // This will stop it being placed on anything except water + public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) { + return EnumPlantType.Water; + } + + + // enum representing the 3 variants of lily + public static enum LilypadType implements IStringSerializable + { + MEDIUM, SMALL, TINY; + + @Override + public String getName() + { + return "lily_" + this.name().toLowerCase(); + } + + @Override + public String toString() + { + return getName(); + } + } + + + // TODO: copied from BlockBush - not sure exactly what this does... investigate further - possibly put into base class + @Override + public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos) + { + IBlockState state = world.getBlockState(pos); + if (state.getBlock() != this) return getDefaultState(); + return state; + } + +} \ 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 e5aa92b4c..870b05ef2 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -19,6 +19,7 @@ import biomesoplenty.common.block.BlockAsh; import biomesoplenty.common.block.BlockBOPFlower; import biomesoplenty.common.block.BlockBOPFlower2; import biomesoplenty.common.block.BlockBOPGrass; +import biomesoplenty.common.block.BlockBOPLilypad; import biomesoplenty.common.block.BlockBOPLog; import biomesoplenty.common.block.BlockBOPLog2; import biomesoplenty.common.block.BlockBOPLog3; @@ -63,6 +64,7 @@ public class ModBlocks turnip_block = registerBlock(new BlockTurnip(), "turnip_block"); flesh = registerBlock(new BlockFlesh(), "flesh"); grass = registerBlock(new BlockBOPGrass(), "grass"); + waterlily = registerBlock(new BlockBOPLilypad(), "waterlily"); } private static Block registerBlock(BOPBlock block, String name) diff --git a/src/main/java/biomesoplenty/common/item/ItemBOPLilypad.java b/src/main/java/biomesoplenty/common/item/ItemBOPLilypad.java new file mode 100644 index 000000000..b65b8da9e --- /dev/null +++ b/src/main/java/biomesoplenty/common/item/ItemBOPLilypad.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright 2014, 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.item; + +import biomesoplenty.api.block.BOPBlocks; +import net.minecraft.block.Block; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.StatList; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; + +public class ItemBOPLilypad extends ItemBlockWithVariants { + + public ItemBOPLilypad(Block block) { + super(block); + } + + // The code for right clicking needs to be overridden to handle the unique way lilies are placed - on top of the water + // (usually when you point the cursor at water the picked block is whatever is underneath the water - when placing lilies the water itself has to be picked) + // The below is copied from vanille BlockLilyPad + @Override + public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + { + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, true); + + if (movingobjectposition == null) + { + return itemStackIn; + } + else + { + if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + BlockPos blockpos = movingobjectposition.getBlockPos(); + + if (!worldIn.isBlockModifiable(playerIn, blockpos)) + { + return itemStackIn; + } + + if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.sideHit), movingobjectposition.sideHit, itemStackIn)) + { + return itemStackIn; + } + + BlockPos blockpos1 = blockpos.up(); + IBlockState iblockstate = worldIn.getBlockState(blockpos); + + if (iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1)) + { + // special case for handling block placement with water lilies + net.minecraftforge.common.util.BlockSnapshot blocksnapshot = net.minecraftforge.common.util.BlockSnapshot.getBlockSnapshot(worldIn, blockpos1); + + worldIn.setBlockState(blockpos1, BOPBlocks.waterlily.getStateFromMeta(itemStackIn.getMetadata())); + if (net.minecraftforge.event.ForgeEventFactory.onPlayerBlockPlace(playerIn, blocksnapshot, net.minecraft.util.EnumFacing.UP).isCanceled()) + { + blocksnapshot.restore(true, false); + return itemStackIn; + } + + if (!playerIn.capabilities.isCreativeMode) + { + --itemStackIn.stackSize; + } + + playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]); + } + } + + return itemStackIn; + } + } + + +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/blockstates/waterlily.json b/src/main/resources/assets/biomesoplenty/blockstates/waterlily.json new file mode 100644 index 000000000..26fa7c889 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/waterlily.json @@ -0,0 +1,22 @@ +{ + "variants": { + "variant=lily_medium": [ + { "model": "biomesoplenty:lily_medium" }, + { "model": "biomesoplenty:lily_medium", "y": 90 }, + { "model": "biomesoplenty:lily_medium", "y": 180 }, + { "model": "biomesoplenty:lily_medium", "y": 270 } + ], + "variant=lily_small": [ + { "model": "biomesoplenty:lily_small" }, + { "model": "biomesoplenty:lily_small", "y": 90 }, + { "model": "biomesoplenty:lily_small", "y": 180 }, + { "model": "biomesoplenty:lily_small", "y": 270 } + ], + "variant=lily_tiny": [ + { "model": "biomesoplenty:lily_tiny" }, + { "model": "biomesoplenty:lily_tiny", "y": 90 }, + { "model": "biomesoplenty:lily_tiny", "y": 180 }, + { "model": "biomesoplenty:lily_tiny", "y": 270 } + ] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/lily_medium.json b/src/main/resources/assets/biomesoplenty/models/block/lily_medium.json new file mode 100644 index 000000000..31f733604 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/lily_medium.json @@ -0,0 +1,16 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "blocks/waterlily", + "texture": "biomesoplenty:blocks/lily_medium" + }, + "elements": [ + { "from": [ 0, 0.25, 0 ], + "to": [ 16, 0.25, 16 ], + "faces": { + "down": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "tintindex": 0 }, + "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 } + } + } + ] +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/lily_small.json b/src/main/resources/assets/biomesoplenty/models/block/lily_small.json new file mode 100644 index 000000000..4a809e5c2 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/lily_small.json @@ -0,0 +1,16 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "blocks/waterlily", + "texture": "biomesoplenty:blocks/lily_small" + }, + "elements": [ + { "from": [ 0, 0.25, 0 ], + "to": [ 16, 0.25, 16 ], + "faces": { + "down": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "tintindex": 0 }, + "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/lily_tiny.json b/src/main/resources/assets/biomesoplenty/models/block/lily_tiny.json new file mode 100644 index 000000000..d544d3efe --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/lily_tiny.json @@ -0,0 +1,16 @@ +{ + "ambientocclusion": false, + "textures": { + "particle": "blocks/waterlily", + "texture": "biomesoplenty:blocks/lily_tiny" + }, + "elements": [ + { "from": [ 0, 0.25, 0 ], + "to": [ 16, 0.25, 16 ], + "faces": { + "down": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "tintindex": 0 }, + "up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 } + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/item/lily_medium.json b/src/main/resources/assets/biomesoplenty/models/item/lily_medium.json new file mode 100644 index 000000000..ebdc737d3 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/lily_medium.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:blocks/lily_medium" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/lily_small.json b/src/main/resources/assets/biomesoplenty/models/item/lily_small.json new file mode 100644 index 000000000..d80c348f1 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/lily_small.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:blocks/lily_small" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/lily_tiny.json b/src/main/resources/assets/biomesoplenty/models/item/lily_tiny.json new file mode 100644 index 000000000..d59b3aa41 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/lily_tiny.json @@ -0,0 +1,18 @@ +{ + "parent": "builtin/generated", + "textures": { + "layer0": "biomesoplenty:blocks/lily_tiny" + }, + "display": { + "thirdperson": { + "rotation": [ -90, 0, 0 ], + "translation": [ 0, 1, -3 ], + "scale": [ 0.55, 0.55, 0.55 ] + }, + "firstperson": { + "rotation": [ 0, -135, 25 ], + "translation": [ 0, 4, 2 ], + "scale": [ 1.7, 1.7, 1.7 ] + } + } +} diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/lily_medium.png b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_medium.png new file mode 100644 index 0000000000000000000000000000000000000000..759cd831d4f2417c116b925fc3292fdf45c31ece GIT binary patch literal 269 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=4@yqg0@pZci7- z5DWji6AZZ;3`Cr*cUkP%xq~zB5wA^a`-gw*D|-J-iMVwukf&vlXPoPI->=#1)f-iL zA7$KO-#_zFFI z9jy*T$~Y^Yaay%Fghj(;{~}L~!!n2e@P}1~Yq$&KUi|;$4y$TtwPVR=!x*5m7(8A5 KT-G@yGywo@AYH2f literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/lily_small.png b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_small.png new file mode 100644 index 0000000000000000000000000000000000000000..0beac97bfec1c34c756f9f2b9eb19262851462fb GIT binary patch literal 247 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=4@yqg0@pQcoAh z5DWk01-t=bzxtax*#dYUEfo9zbIz87CLF@)93jf98+jy}c^DD}W?MKna3x43vQ2!( zrNTUcmoZyqg(OQuSHdiZ85YqO8LyZA^$IZyH)vH3WRO lF-|$k;~~rwEN)=Hz|hznpJTql?K{u`44$rjF6*2UngEHbN__wT literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/lily_tiny.png b/src/main/resources/assets/biomesoplenty/textures/blocks/lily_tiny.png new file mode 100644 index 0000000000000000000000000000000000000000..f8ad4320d040ee024d526d630207e87c22423d24 GIT binary patch literal 266 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=4@yqg0@p4o?@y z5DWjaL5^Gv20XXxPP(zZT@%Y|6;aVkG!Uzo!$6o+LBDkW&acB?Dp Date: Thu, 26 Mar 2015 20:48:25 +0000 Subject: [PATCH 3/6] Add lily labels --- src/main/resources/assets/biomesoplenty/lang/en_US.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index beeb396ff..e44e00ee7 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -126,6 +126,10 @@ tile.stone.polished_shale.name=Polished Shale tile.turnip_block.name=Turnip +tile.waterlily.lily_medium.name=Medium Lily Pad +tile.waterlily.lily_small.name=Small Lily Pad +tile.waterlily.lily_tiny.name=Tiny Lily Pad + item.fleshchunk.name=Chunk of Flesh item.mudball.name=Mud Ball item.turnip.name=Turnip From 10da2ae8b9625cc7e69b5b7796f5d106e0261c9f Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Thu, 26 Mar 2015 20:53:02 +0000 Subject: [PATCH 4/6] Add loamy/silty/sandy grass blocks --- .../common/block/BlockBOPGrass.java | 354 ++++++++++++++---- .../biomesoplenty/blockstates/grass.json | 5 +- .../assets/biomesoplenty/lang/en_US.lang | 3 + .../models/block/loamy_grass_block.json | 10 + .../models/block/sandy_grass_block.json | 10 + .../models/block/silty_grass_block.json | 10 + .../models/item/loamy_grass_block.json | 10 + .../models/item/sandy_grass_block.json | 10 + .../models/item/silty_grass_block.json | 10 + .../textures/blocks/dirt_loamy.png | Bin 0 -> 335 bytes .../textures/blocks/dirt_sandy.png | Bin 0 -> 339 bytes .../textures/blocks/dirt_silty.png | Bin 0 -> 339 bytes .../textures/blocks/grass_loamy_side.png | Bin 0 -> 339 bytes .../blocks/grass_loamy_side_snowed.png | Bin 0 -> 338 bytes .../textures/blocks/grass_sandy_side.png | Bin 0 -> 343 bytes .../blocks/grass_sandy_side_snowed.png | Bin 0 -> 344 bytes .../textures/blocks/grass_side_overlay.png | Bin 0 -> 219 bytes .../textures/blocks/grass_silty_side.png | Bin 0 -> 343 bytes .../blocks/grass_silty_side_snowed.png | Bin 0 -> 343 bytes .../textures/blocks/grass_top.png | Bin 0 -> 560 bytes 20 files changed, 343 insertions(+), 79 deletions(-) create mode 100644 src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/silty_grass_block.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/loamy_grass_block.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/sandy_grass_block.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/silty_grass_block.json create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/dirt_loamy.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/dirt_sandy.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/dirt_silty.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_loamy_side_snowed.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side_snowed.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_side_overlay.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side_snowed.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/grass_top.png diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java index c46a5017c..40d8404cb 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java @@ -11,8 +11,13 @@ package biomesoplenty.common.block; import java.util.Random; import biomesoplenty.api.block.BOPBlock; +import biomesoplenty.api.block.BOPBlocks; import net.minecraft.block.Block; +import net.minecraft.block.BlockBush; import net.minecraft.block.BlockDirt; +import net.minecraft.block.BlockLiquid; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; @@ -26,12 +31,17 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.IStringSerializable; +import net.minecraft.world.ColorizerGrass; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeColorHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class BlockBOPGrass extends BOPBlock +// TODO: add snowiness? +public class BlockBOPGrass extends BOPBlock implements IGrowable { public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", BOPGrassType.class); @@ -40,7 +50,7 @@ public class BlockBOPGrass extends BOPBlock super(Material.grass); this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, BOPGrassType.SPECTRALMOSS)); this.setHardness(0.6F); - this.setHarvestLevel("shovel", 0); // TODO: this means that ONLY a shovel can harvest this block... correct? + this.setHarvestLevel("shovel", 0); // TODO: I think this just determines which tool speeds up digging - need to investigate more this.setStepSound(Block.soundTypeGrass); this.setTickRandomly(true); } @@ -48,14 +58,14 @@ public class BlockBOPGrass extends BOPBlock @Override public IBlockState getStateFromMeta(int meta) { - // only one property to worry about, the variant, so just map [0 => SPECTRALMOSS, 1 => SMOLDERINGGRASS] + // only one property to worry about, the variant, so just map according to integer index in BOPGrassType return this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.values()[meta]); } @Override public int getMetaFromState(IBlockState state) { - // only one property to worry about, the variant, so just map [0 => SPECTRALMOSS, 1 => SMOLDERINGGRASS] + // only one property to worry about, the variant, so just map according to integer index in BOPGrassType return ((BOPGrassType) state.getValue(VARIANT_PROP)).ordinal(); } @@ -77,21 +87,88 @@ public class BlockBOPGrass extends BOPBlock return ((BOPGrassType) state.getValue(VARIANT_PROP)).getName(); } + @Override + @SideOnly(Side.CLIENT) + public int getBlockColor() + { + return ColorizerGrass.getGrassColor(0.5D, 1.0D); + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderColor(IBlockState state) + { + return this.getBlockColor(); + } + + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess worldIn, BlockPos pos, int renderPass) + { + return BiomeColorHelper.getGrassColorAtPos(worldIn, pos); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumWorldBlockLayer getBlockLayer() + { + return EnumWorldBlockLayer.CUTOUT_MIPPED; + } + + @Override + public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + { + + IBlockState state = world.getBlockState(pos); + net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); + + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + // smoldering grass supports no plants + case SMOLDERING: + return false; + + default: + switch (plantType) + { + // support desert and plains plants + case Desert: case Plains: return true; + // support cave plants + case Cave: return isSideSolid(world, pos, EnumFacing.UP); + // support beach plants if there's water alongside + case Beach: + return ( + world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water || + world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water || + world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water || + world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water + ); + // don't support nether plants, water plants, or crops (require farmland), or anything else by default + default: + return false; + } + } + } + + @Override public boolean isFireSource(World world, BlockPos pos, EnumFacing side) { IBlockState state = world.getBlockState(pos); switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - // spectralmoss burns from below in the end + // spectral moss burns from below in the end // TODO: 1.7 code had dimension=-1 here - check -1 corresponds to end case SPECTRALMOSS: if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && side == EnumFacing.UP) {return true;} break; - // smolderinggrass always burns - case SMOLDERINGGRASS: + // smoldering grass always burns + case SMOLDERING: return false; + + default: + break; } return super.isFireSource(world, pos, side); } @@ -102,7 +179,7 @@ public class BlockBOPGrass extends BOPBlock IBlockState state = this.getStateFromMeta(meta); switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - // spectralmoss makes a hideous noise and throws a big fuss of particles around when placed in the nether + // spectral moss makes a hideous noise and throws a big fuss of particles around when placed in the nether case SPECTRALMOSS: if (world.provider instanceof net.minecraft.world.WorldProviderHell) { @@ -115,7 +192,7 @@ public class BlockBOPGrass extends BOPBlock } break; - case SMOLDERINGGRASS: + default: break; } return state; @@ -126,11 +203,9 @@ public class BlockBOPGrass extends BOPBlock public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - case SPECTRALMOSS: - break; - - // smolderinggrass throws up random flame and smoke particles - case SMOLDERINGGRASS: + + // smoldering grass throws up random flame and smoke particles + case SMOLDERING: if (rand.nextInt(4)==0) { worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D); @@ -140,6 +215,10 @@ public class BlockBOPGrass extends BOPBlock worldIn.spawnParticle(EnumParticleTypes.FLAME, (double)((float)pos.getX() + rand.nextFloat()), (double)((float)pos.getY() + 1.1F), (double)((float)pos.getZ() + rand.nextFloat()), 0.0D, 0.0D, 0.0D); } break; + + default: + break; + } super.randomDisplayTick(worldIn, pos, state, rand); } @@ -151,58 +230,169 @@ public class BlockBOPGrass extends BOPBlock { case SPECTRALMOSS: // spectral moss in the nether catches on fire and turns to smoldering grass - // elsewhere it should behave like grass spreading to nearby end_stone blocks if (world.provider instanceof net.minecraft.world.WorldProviderHell) { world.setBlockState(pos.up(), Blocks.fire.getDefaultState()); // might need to set fire AGE value... not sure - world.setBlockState(pos, this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.SMOLDERINGGRASS)); + world.setBlockState(pos, this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.SMOLDERING)); + } + break; + + default: + break; + } + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + case SMOLDERING: + // smoldering grass doesn't spread to nearby dirt + break; + + default: + // the other BOP grass types all do + this.spreadGrass(world, pos, state, rand, 4, 1, 3, 1); + break; + } + + } + + // spread grass to suitable nearby grass blocks + // tries - number of times to try and spread to a random nearby block + // xzSpread - how far can the grass spread in the x and z directions + // downSpread - how far can the grass spread downwards + // upSpread - how far can the grass spread upwards + // TODO: let grass spread across different dirt types? onto vanilla dirt too (and vice verca)? + @SideOnly(Side.CLIENT) + public void spreadGrass(World world, BlockPos pos, IBlockState state, Random rand, int tries, int xzSpread, int downSpread, int upSpread) + { + // the type of grass which is spreading + BOPGrassType grassType = (BOPGrassType)state.getValue(VARIANT_PROP); + // the type of dirt this grass grows on + IBlockState dirtBlockState = grassType.getDirtBlockState(); + + // if this block is covered, then turn it back to dirt (IE kill the grass) + if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getBlock().getLightOpacity(world, pos.up()) > 2) + { + world.setBlockState(pos, dirtBlockState); + } + else + { + // if there's enough light from above, spread the grass randomly to nearby blocks of the correct dirt type + if (world.getLightFromNeighbors(pos.up()) >= 9) + { + for (int i = 0; i < tries; ++i) + { + // pick a random nearby position, and get the block, block state, and block above + BlockPos pos1 = pos.add(rand.nextInt(xzSpread * 2 + 1) - xzSpread, rand.nextInt(downSpread + upSpread + 1) - downSpread, rand.nextInt(xzSpread * 2 + 1) - xzSpread); + IBlockState iblockstate1 = world.getBlockState(pos1); + Block block1 = iblockstate1.getBlock(); + Block blockAbove = world.getBlockState(pos1.up()).getBlock(); + + // see if the randomly chosen nearby block is the right type for this grass (same block and meta as dirtBlockState) + // TODO: is it ok to just compare the equality of the states? IE iblockstate1==dirtBlockState ? + if (block1==grassType.getDirtBlock() && block1.getMetaFromState(iblockstate1)==grassType.getDirtBlockMeta()) + { + // if there's enough light and it isn't covered, turn the block to the relevant grass block + if (world.getLightFromNeighbors(pos1.up()) >= 4 && blockAbove.getLightOpacity(world, pos1.up()) <= 2) + { + world.setBlockState(pos1, this.getDefaultState().withProperty(VARIANT_PROP, grassType)); + } + } + } + } + } + + } + + + @Override + public boolean canGrow(World worldIn, BlockPos pos, IBlockState state, boolean isClient) { + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + case SPECTRALMOSS: case SMOLDERING: + return false; + default: + return true; + } + } + + @Override + public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, IBlockState state) { + switch ((BOPGrassType) state.getValue(VARIANT_PROP)) + { + case SPECTRALMOSS: case SMOLDERING: + return false; + default: + return true; + } + } + + // This is called when bonemeal is applied on the block + // The algorithm is functionally exactly the same as in the vanilla BlockGrass grow function, but has been rewritten to make its behavior clearer + @Override + public void grow(World worldIn, Random rand, BlockPos pos, IBlockState state) { + + BlockPos startPos = pos.up(); + BlockPos currPos; + + // 128 looks like a lot of tries, but many locations will be duplicated and many tries will be abandoned because the random walk hits a snag + for (int i = 0; i < 128; i++) { + + // go on a random walk away from the start position - abandon if we hit a block which can't spread the growth + // note walkLength increases gradually with i - so we attempt walks of different lengths + int walkLength = i / 16; + currPos = startPos; + boolean walkOk = true; + for (int j = 0; j < walkLength; j++) + { + // shift a random distance + currPos = currPos.add(rand.nextInt(3) - 1, (rand.nextInt(3) - 1) * rand.nextInt(3) / 2, rand.nextInt(3) - 1); + if (worldIn.getBlockState(currPos.down()).getBlock() != BOPBlocks.grass || worldIn.getBlockState(currPos).getBlock().isNormalCube()) + { + // this block can't spread the growth + walkOk = false; + break; + } + } + + // try and grow something at currPos + if (walkOk && worldIn.isAirBlock(currPos)) { + if (rand.nextInt(8)==0) { + // with 1/8 probability, plant a flower + worldIn.getBiomeGenForCoords(currPos).plantFlower(worldIn, rand, currPos); } else { - // if this block is covered, then turn it back to end_stone (IE kill the moss) - if (world.getLightFromNeighbors(pos.up()) < 4 && world.getBlockState(pos.up()).getBlock().getLightOpacity(world, pos.up()) > 2) + // otherwise plant tall grass + IBlockState tallgrassState = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, BlockTallGrass.EnumType.GRASS); + if (Blocks.tallgrass.canBlockStay(worldIn, currPos, tallgrassState)) { - world.setBlockState(pos, Blocks.end_stone.getDefaultState()); - } - else - { - // if there's enough light from above, spread the moss randomly to nearby end_stone blocks - if (world.getLightFromNeighbors(pos.up()) >= 9) - { - for (int i = 0; i < 4; ++i) // try 4 times - { - // pick a random nearby position - BlockPos pos1 = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); - Block blockAbove = world.getBlockState(pos1.up()).getBlock(); - IBlockState iblockstate1 = world.getBlockState(pos1); - // if there's enough light and it isn't covered, turn it to moss - if (iblockstate1.getBlock() == Blocks.end_stone && world.getLightFromNeighbors(pos1.up()) >= 4 && blockAbove.getLightOpacity(world, pos1.up()) <= 2) - { - world.setBlockState(pos1, this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.SPECTRALMOSS) ); - } - } - } + worldIn.setBlockState(currPos, tallgrassState); } } - break; - - case SMOLDERINGGRASS: - break; - } + } + } } + /* TODO: don't understand the intention here.. grass turns to dirt when a plant grows??? + @Override + public void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) + { + world.setBlock(x, y, z, BOPCBlocks.newBopDirt, world.getBlockMetadata(x, y, z) * 2, 2); + } + */ + + @Override public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { float heightOffset = 0.0F; switch ((BOPGrassType) state.getValue(VARIANT_PROP)) { - case SPECTRALMOSS: + // smoldering grass is a tiny bit lower than usual + case SMOLDERING: + heightOffset = 0.02F; break; - // smoldering grass is a tiny bit lower than usual - case SMOLDERINGGRASS: - heightOffset = 0.02F; + default: break; } 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)); @@ -212,14 +402,15 @@ public class BlockBOPGrass extends BOPBlock public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) { switch ((BOPGrassType) state.getValue(VARIANT_PROP)) - { - case SPECTRALMOSS: - break; - + { // smoldering grass sets you on fire for 2 seconds - case SMOLDERINGGRASS: + case SMOLDERING: entity.setFire(2); break; + + default: + break; + } } @@ -227,39 +418,21 @@ public class BlockBOPGrass extends BOPBlock @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - switch ((BOPGrassType) state.getValue(VARIANT_PROP)) - { - case SPECTRALMOSS: - return Item.getItemFromBlock(Blocks.end_stone); - - case SMOLDERINGGRASS: - return Item.getItemFromBlock(Blocks.dirt); - } - return super.getItemDropped(state, rand, fortune); + return Item.getItemFromBlock( ((BOPGrassType) state.getValue(VARIANT_PROP)).getDirtBlock() ); } // goes hand in hand with getItemDropped() above to determine precisely what is dropped @Override public int damageDropped(IBlockState state) { - switch ((BOPGrassType) state.getValue(VARIANT_PROP)) - { - // end stone doesn't have any variants - case SPECTRALMOSS: - return 0; - - // make sure dirt item dropped is plain dirt (not any other variant) - case SMOLDERINGGRASS: - return BlockDirt.DirtType.DIRT.getMetadata(); - } - return super.damageDropped(state); + return ((BOPGrassType) state.getValue(VARIANT_PROP)).getDirtBlockMeta(); } - // enum representing the 2 variants of grass + // enum representing the variants of grass public static enum BOPGrassType implements IStringSerializable { - SPECTRALMOSS, SMOLDERINGGRASS; + SPECTRALMOSS, SMOLDERING, LOAMY, SANDY, SILTY; @Override public String getName() @@ -267,11 +440,10 @@ public class BlockBOPGrass extends BOPBlock switch(this) { case SPECTRALMOSS: - return "spectral_moss"; - case SMOLDERINGGRASS: - return "smoldering_grass_block"; + return "spectral_moss"; + default: + return this.name().toLowerCase() + "_grass_block"; } - return this.name().toLowerCase(); } @Override @@ -279,6 +451,32 @@ public class BlockBOPGrass extends BOPBlock { return getName(); } + + // get the blockstate which corresponds to the type of dirt which this grass variant grows on + // this is used to determine what drops when you break the grass block, and also which nearby blocks this grass can spread to + public IBlockState getDirtBlockState() + { + switch(this) + { + case SPECTRALMOSS: + return Blocks.end_stone.getDefaultState(); + case LOAMY: // TODO: + case SANDY: // TODO: + case SILTY: // TODO: + case SMOLDERING: default: + return Blocks.dirt.getStateFromMeta(BlockDirt.DirtType.DIRT.getMetadata()); + } + } + + public Block getDirtBlock() + { + return this.getDirtBlockState().getBlock(); + } + + public int getDirtBlockMeta() + { + return this.getDirtBlock().getMetaFromState(this.getDirtBlockState()); + } } } \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/blockstates/grass.json b/src/main/resources/assets/biomesoplenty/blockstates/grass.json index 27e749c0f..112ee0b52 100644 --- a/src/main/resources/assets/biomesoplenty/blockstates/grass.json +++ b/src/main/resources/assets/biomesoplenty/blockstates/grass.json @@ -1,6 +1,9 @@ { "variants": { "variant=smoldering_grass_block": { "model": "biomesoplenty:smoldering_grass_block" }, - "variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" } + "variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" }, + "variant=loamy_grass_block": { "model": "biomesoplenty:loamy_grass_block" }, + "variant=sandy_grass_block": { "model": "biomesoplenty:sandy_grass_block" }, + "variant=silty_grass_block": { "model": "biomesoplenty:silty_grass_block" } } } diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index e44e00ee7..62d43bf2b 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -13,6 +13,9 @@ tile.bone_segment.large.name=Large Bone Segment tile.grass.spectral_moss.name=Spectral Moss tile.grass.smoldering_grass_block.name=Smoldering Grass Block +tile.grass.loamy_grass_block.name=Loamy Grass Block +tile.grass.sandy_grass_block.name=Sandy Grass Block +tile.grass.silty_grass_block.name=Silty Grass Block tile.coral.pink.name=Pink Coral tile.coral.orange.name=Orange Coral diff --git a/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block.json new file mode 100644 index 000000000..5d5d5552c --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "block/grass", + "textures": { + "particle": "biomesoplenty:blocks/dirt_loamy", + "bottom": "biomesoplenty:blocks/dirt_loamy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_loamy_side", + "overlay": "biomesoplenty:blocks/grass_side_overlay" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block.json new file mode 100644 index 000000000..93f8d1395 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "block/grass", + "textures": { + "particle": "biomesoplenty:blocks/dirt_sandy", + "bottom": "biomesoplenty:blocks/dirt_sandy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_sandy_side", + "overlay": "biomesoplenty:blocks/grass_side_overlay" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block.json b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block.json new file mode 100644 index 000000000..d917b3f7d --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "block/grass", + "textures": { + "particle": "biomesoplenty:blocks/dirt_silty", + "bottom": "biomesoplenty:blocks/dirt_silty", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_silty_side", + "overlay": "biomesoplenty:blocks/grass_side_overlay" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/item/loamy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/item/loamy_grass_block.json new file mode 100644 index 000000000..5e4f7a1ea --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/loamy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/loamy_grass_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/models/item/sandy_grass_block.json b/src/main/resources/assets/biomesoplenty/models/item/sandy_grass_block.json new file mode 100644 index 000000000..7c39a819e --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/sandy_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/sandy_grass_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/models/item/silty_grass_block.json b/src/main/resources/assets/biomesoplenty/models/item/silty_grass_block.json new file mode 100644 index 000000000..19b1465b4 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/silty_grass_block.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/silty_grass_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/dirt_loamy.png b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_loamy.png new file mode 100644 index 0000000000000000000000000000000000000000..afc8e2e8053cc1d6796be6844b965152b0c068b7 GIT binary patch literal 335 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXWa8_dH_((Sx*!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXWa8_dH_((MNb#U z5DWj*iFh_5_D#60_A`H`Fy-twZlykh8R#C3_` gUExII`=@@fo|;{e7Q1b~KhSdwp00i_>zopr00Y2**Z=?k literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_silty.png b/src/main/resources/assets/biomesoplenty/textures/blocks/dirt_silty.png new file mode 100644 index 0000000000000000000000000000000000000000..4be6c4b82954fbb57118e527ed2798a598420a48 GIT binary patch literal 339 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXWa8_dH_((MNb#U z5DWj*iMD))3?!VZ_sK2DHfJl7aMZaO8F^#Zcdj`-;d@VTI&Nxu`+mRA{J&r8?j3ks z#MB%!-E!aiBm56p9^Brhsmphe#=yu%}bUf+S z*H1eR+641*ED7XXkhz<&Adl&nVrIFIheC1B*U6<0dmZOqH$7t@Rs2U@;i2RH2;CR4 z<%@mTn^@w0Y!=$UcIf&Q$0+5@`K2p9S!lvI6;>1s;*b z3=Dh+L6~vJ#O${~L5ULAh?3y^w370~qEv>0#LT=By}Z;C1rt33J>#Bd(*uBNE_%8+ zhFJJ-ow$+fkb{8BXG_gX%LO)yxLmr``IBS6{U^TrhUIP>3^&}odGq9*cd0*48~Z>0 z*0$gFFZ;D>x09l0vLmPU<^<2#`m<_IHowiC>BWpso<9zgD$-Q5@W?d{V40crQ*n-! z;lW1c^(xm(b6LI#KX*)R5_zK1^^5aqXBGRTnX-`^cfFa)nelCR+T4rlgLr=}d!3-d z-=@50b-yTw?}0y7l@`87&gS1S{wd~nb&W%eU;89errm5arE>PKTi`Kg&Yq~k!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXWa8_dH_((1y2{p z5DWj*35G(=20Sc(Ww@$VUCA`cyPSGR`O~8>nH3C?X>$(?JQGlV={HUD_4}V&-uqQN zc(7OJz^Q`_%L-qJ8m?%ZGTFoL%~emu*6r84wrFvNm+bZtQ+yh@zNTaS^SP5UMH&jZ zW*wBPoHKFKt*H!cV(hcef1bnk!t+>en@LfhE!$kJ1$PhHTr>{7;ah0jki*K!|Lf?i zh3j`oZ;NB!^Dt3WfVKWIm*%qxf49%G`Tya-*#%NN_L>EYh$&vX?e*=EVb_OdMdk-F getA-wDN^nF@89U}iE&>P3G^F-r>mdKI;Vst0J(#MvH$=8 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side.png new file mode 100644 index 0000000000000000000000000000000000000000..6c17c8fb18a160d9e323719fd32c6dbe2cbee100 GIT binary patch literal 343 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>#Bd(*uBNu6nvS zhFJJ-ooL8+$bpCD^V*swE7e>(hAEnvFIIeJii$hb-1O|ooNs&+GCH1A?7jEq=Jbd9 z=WTj#bN~DHMLwe5$ZK6f-04j@DYGA~IXnIGx^D*#zul$Z@Mnj-m$Tkc7WS2E*}4=i z>)5vhtE*WQJec}q*Sg*Vb&qUT_)KV;;}U4U&?fM`gVAPX?Xc;4jTq0?U0-ATD|D6P z{Sw)pCkG2!%D--7TF5ygUY&n==Z>Gf^L_TU2AgUNJbxUr$t~f!LU8lj>!Ko^lP8C3 m=kZ*cddu5u-TLR5cjnnY{-^YzPOS;(K?YA(KbLh*2~7ZUl8xX1 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side_snowed.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_sandy_side_snowed.png new file mode 100644 index 0000000000000000000000000000000000000000..b43de25850bc69ea8b0c0c371c1e9e54e34f0ca6 GIT binary patch literal 344 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Ea{HEjtmSN`?>!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXWa8_dH_((HBT4E z5DWj*2^&S590Xj}>&`MzGg-oc3c?f_4iXxbP_9bLOl|47w+GT%F){ZsYL<&a79gXQ)>#bP0l+XkK&<%z~ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_side_overlay.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_side_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..fc3fa9d727b3b8d66bcedd4a3ff057b89b3b9377 GIT binary patch literal 219 zcmV<103`p3P)6I!Nu zI;ORT*!P_m?)!$6l0Q)HoMTT4*LB5l9JsEFYiXJy&vTA{===VwK?=yT+?SV^zdXRi Vczl&7)+PV|002ovPDHLkV1ku5TnqpJ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side.png b/src/main/resources/assets/biomesoplenty/textures/blocks/grass_silty_side.png new file mode 100644 index 0000000000000000000000000000000000000000..5114d319bbe5e583f65e3eaa78b2b71d3e04efac GIT binary patch literal 343 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>#Bd(*uBNu6nvS zhFJJ-ow$*&$w9#7r=4BHv~!2zynA`~uI-iGyZ=Fd;=QBgl72opDv@PnWixKu?%Hqj z_=0}^kK32)685G}i8;7uS!UD;v!ju-_1k0LHtzoYHH6{k&mB|SV!Al_f}(jv9G6Ab zaV+=qDM&c3eX??1IMeUW&kKwkxr&5b-?n^m*~@(LOy8P_*l(v;Om4?+K9>=`k}dag zslg=n!-Ds&9_MONOQ@S`Ge_;w)%-g~KgImEMm1W`vw!lvI6;>1s;*b z3=DjSK$uZf!>a)(C{f}XQ4*Y=R#Ki=l*&+$n3-3imzP?iV4`QBXWa8_dH_((RZkbk z5DWj*35G&V4gxIiYi$~)oROaqmFkq2mE`tL{14YoPW}tae#!7HX-h3DPs{KB^wakJ zue%)lGG|URt$D+f@M3qEV6&8mWyg~vVRJ=-DvlSbL``kc-Zjr(Oz~;q?hlIl=9POb z3uHK^xq_|wNuirpRydPHluVADZ?Mz?RmtsAmrhuIlPFoyP{sb)<$Oq@`O&Kkn?zM? zGQ?N6ZF`k>BTDu|+wQ3jB7c0fm&|b9cE9SwpTo@I%~=n=-SP>HXo*;_eY5+x#-Z{y ko`zz}otaA}EPTK3&BN{4?0#3PfF5MnJC=}8J zv-|z7b5;sF3}>C>1NIICKE7TrnZl0ogeHsw8QL_1h<1j;1Rw`G(-?#g41*1YAbr1I z3xz_`jW;x6;(rg&30)#gsQADch=huFo?#Y=M1+ohGJw&JJyQf74p=Lc(Hahib;dh) znn)!~VMU*#k(iQ5kSJmZ=j495TuKTx$Ylda;GMwfzd#XMJ&L4_kkE+J1c?hnG16N( yEF4rx9#hfG{@H>z05dwG5;T%S-EWC!Q4gw0000 Date: Thu, 26 Mar 2015 22:20:31 +0000 Subject: [PATCH 5/6] Add new dirt variants loamy/sandy/silty and link to corresponding grass variants --- .../biomesoplenty/api/block/BOPBlocks.java | 1 + .../common/block/BlockBOPDirt.java | 114 ++++++++++++++++++ .../common/block/BlockBOPGrass.java | 11 +- .../biomesoplenty/common/init/ModBlocks.java | 5 +- .../common/item/ItemBlockWithVariants.java | 16 +++ .../biomesoplenty/blockstates/dirt.json | 7 ++ .../assets/biomesoplenty/lang/en_US.lang | 5 + .../models/block/loamy_dirt.json | 6 + .../models/block/sandy_dirt.json | 6 + .../models/block/silty_dirt.json | 6 + .../biomesoplenty/models/item/loamy_dirt.json | 10 ++ .../biomesoplenty/models/item/sandy_dirt.json | 10 ++ .../biomesoplenty/models/item/silty_dirt.json | 10 ++ 13 files changed, 200 insertions(+), 7 deletions(-) create mode 100644 src/main/java/biomesoplenty/common/block/BlockBOPDirt.java create mode 100644 src/main/resources/assets/biomesoplenty/blockstates/dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/loamy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/sandy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/silty_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/loamy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/sandy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/silty_dirt.json diff --git a/src/main/java/biomesoplenty/api/block/BOPBlocks.java b/src/main/java/biomesoplenty/api/block/BOPBlocks.java index bb43608c2..bb2efd089 100644 --- a/src/main/java/biomesoplenty/api/block/BOPBlocks.java +++ b/src/main/java/biomesoplenty/api/block/BOPBlocks.java @@ -33,4 +33,5 @@ public class BOPBlocks public static Block flesh; public static Block grass; public static Block waterlily; + public static Block dirt; } diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java new file mode 100644 index 000000000..4bb90fa8e --- /dev/null +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java @@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright 2014, 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 net.minecraft.block.Block; +import net.minecraft.block.BlockDirt; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.IStringSerializable; +import biomesoplenty.api.block.BOPBlock; +import biomesoplenty.api.block.BOPBlocks; + +public class BlockBOPDirt extends BOPBlock +{ + + public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", BOPDirtType.class); + + public BlockBOPDirt() { + super(Material.ground); + this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, BOPDirtType.LOAMY)); + this.setHardness(0.5F); + this.setHarvestLevel("shovel", 0); + this.setStepSound(Block.soundTypeGravel); + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + // only one property to worry about, the variant, so just map according to integer index in BOPDirtType + return this.getDefaultState().withProperty(VARIANT_PROP, BOPDirtType.values()[meta]); + } + + @Override + public int getMetaFromState(IBlockState state) + { + // only one property to worry about, the variant, so just map according to integer index in BOPDirtType + return ((BOPDirtType) state.getValue(VARIANT_PROP)).ordinal(); + } + + @Override + protected BlockState createBlockState() + { + return new BlockState(this, new IProperty[] { VARIANT_PROP }); + } + + @Override + public IProperty[] getPresetProperties() + { + return new IProperty[] { VARIANT_PROP }; + } + + @Override + public String getStateName(IBlockState state, boolean fullName) + { + return ((BOPDirtType) state.getValue(VARIANT_PROP)).getName(); + } + + + + // enum representing the variants of grass + public static enum BOPDirtType implements IStringSerializable + { + LOAMY, SANDY, SILTY; + + @Override + public String getName() + { + return this.name().toLowerCase() + "_dirt"; + } + + @Override + public String toString() + { + return getName(); + } + + // get the blockstate which corresponds to the type of grass which grows on this dirt + public IBlockState getGrassBlockState() + { + switch(this) + { + case LOAMY: + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.LOAMY); + case SANDY: + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.SANDY); + case SILTY: + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.SILTY); + default: + return Blocks.grass.getStateFromMeta(BlockDirt.DirtType.DIRT.getMetadata()); + } + } + + public Block getGrassBlock() + { + return this.getGrassBlockState().getBlock(); + } + + public int getGrassBlockMeta() + { + return this.getGrassBlock().getMetaFromState(this.getGrassBlockState()); + } + } + +} diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java index 40d8404cb..d0ce9e358 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java @@ -13,9 +13,7 @@ import java.util.Random; import biomesoplenty.api.block.BOPBlock; import biomesoplenty.api.block.BOPBlocks; import net.minecraft.block.Block; -import net.minecraft.block.BlockBush; import net.minecraft.block.BlockDirt; -import net.minecraft.block.BlockLiquid; import net.minecraft.block.BlockTallGrass; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; @@ -460,9 +458,12 @@ public class BlockBOPGrass extends BOPBlock implements IGrowable { case SPECTRALMOSS: return Blocks.end_stone.getDefaultState(); - case LOAMY: // TODO: - case SANDY: // TODO: - case SILTY: // TODO: + case LOAMY: + return BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT_PROP, BlockBOPDirt.BOPDirtType.LOAMY); + case SANDY: + return BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT_PROP, BlockBOPDirt.BOPDirtType.SANDY); + case SILTY: + return BOPBlocks.dirt.getDefaultState().withProperty(BlockBOPDirt.VARIANT_PROP, BlockBOPDirt.BOPDirtType.SILTY); case SMOLDERING: default: return Blocks.dirt.getStateFromMeta(BlockDirt.DirtType.DIRT.getMetadata()); } diff --git a/src/main/java/biomesoplenty/common/init/ModBlocks.java b/src/main/java/biomesoplenty/common/init/ModBlocks.java index 870b05ef2..25ca5f5b4 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -9,13 +9,13 @@ package biomesoplenty.common.init; import static biomesoplenty.api.block.BOPBlocks.*; - import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; import biomesoplenty.api.block.BOPBlock; import biomesoplenty.common.block.BlockAsh; +import biomesoplenty.common.block.BlockBOPDirt; import biomesoplenty.common.block.BlockBOPFlower; import biomesoplenty.common.block.BlockBOPFlower2; import biomesoplenty.common.block.BlockBOPGrass; @@ -65,8 +65,9 @@ public class ModBlocks flesh = registerBlock(new BlockFlesh(), "flesh"); grass = registerBlock(new BlockBOPGrass(), "grass"); waterlily = registerBlock(new BlockBOPLilypad(), "waterlily"); + dirt = registerBlock(new BlockBOPDirt(), "dirt"); } - + private static Block registerBlock(BOPBlock block, String name) { if (block.presetStates == null) diff --git a/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java b/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java index 705f201e1..2e13a3805 100644 --- a/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java +++ b/src/main/java/biomesoplenty/common/item/ItemBlockWithVariants.java @@ -9,9 +9,12 @@ package biomesoplenty.common.item; import biomesoplenty.api.block.BOPBlock; +import biomesoplenty.common.block.BlockBOPGrass; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public class ItemBlockWithVariants extends ItemBlock { @@ -22,6 +25,19 @@ public class ItemBlockWithVariants extends ItemBlock this.setMaxDamage(0); this.setHasSubtypes(true); } + + + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int renderPass) + { + // TODO: might be neater to use an interface rather than checking for specific blocks? + if (this.block instanceof BlockBOPGrass) + { + // grass item will render with grey grass unless we set the color here + return ((BlockBOPGrass)this.block).getRenderColor(this.block.getStateFromMeta(stack.getMetadata())); + } + return super.getColorFromItemStack(stack,renderPass); + } @Override public int getMetadata(int metadata) diff --git a/src/main/resources/assets/biomesoplenty/blockstates/dirt.json b/src/main/resources/assets/biomesoplenty/blockstates/dirt.json new file mode 100644 index 000000000..70f7cc7b8 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/blockstates/dirt.json @@ -0,0 +1,7 @@ +{ + "variants": { + "variant=loamy_dirt": { "model": "biomesoplenty:loamy_dirt" }, + "variant=sandy_dirt": { "model": "biomesoplenty:sandy_dirt" }, + "variant=silty_dirt": { "model": "biomesoplenty:silty_dirt" } + } +} diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index 62d43bf2b..eef3df019 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -133,6 +133,11 @@ tile.waterlily.lily_medium.name=Medium Lily Pad tile.waterlily.lily_small.name=Small Lily Pad tile.waterlily.lily_tiny.name=Tiny Lily Pad +tile.dirt.loamy_dirt=Loamy Dirt +tile.dirt.sandy_dirt=Sandy Dirt +tile.dirt.silty_dirt=Silty Dirt + + item.fleshchunk.name=Chunk of Flesh item.mudball.name=Mud Ball item.turnip.name=Turnip diff --git a/src/main/resources/assets/biomesoplenty/models/block/loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/loamy_dirt.json new file mode 100644 index 000000000..a8eb6eff1 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/loamy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/dirt_loamy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/sandy_dirt.json new file mode 100644 index 000000000..1e27ebe02 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sandy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/dirt_sandy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/silty_dirt.json new file mode 100644 index 000000000..1813d7afe --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/silty_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/dirt_silty" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/item/loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/loamy_dirt.json new file mode 100644 index 000000000..03dafee35 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/loamy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/loamy_dirt", + "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/models/item/sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/sandy_dirt.json new file mode 100644 index 000000000..87753af57 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/sandy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/sandy_dirt", + "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/models/item/silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/silty_dirt.json new file mode 100644 index 000000000..34fb504a0 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/silty_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/silty_dirt", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +} From a4e7e0fdd98d55e3308114cf111a3120bfbbaa67 Mon Sep 17 00:00:00 2001 From: Cheeserolls Date: Fri, 27 Mar 2015 03:15:34 +0000 Subject: [PATCH 6/6] Add snowy property to new grass variants, add coarse property to new dirt variants, improve grass spreading algorithm --- .../common/block/BlockBOPDirt.java | 29 +++-- .../common/block/BlockBOPGrass.java | 105 +++++++++++++----- .../biomesoplenty/common/init/ModBlocks.java | 4 +- .../biomesoplenty/blockstates/dirt.json | 9 +- .../biomesoplenty/blockstates/grass.json | 15 ++- .../assets/biomesoplenty/lang/en_US.lang | 10 +- .../models/block/coarse_loamy_dirt.json | 6 + .../models/block/coarse_sandy_dirt.json | 6 + .../models/block/coarse_silty_dirt.json | 6 + .../block/loamy_grass_block_snowed.json | 9 ++ .../block/sandy_grass_block_snowed.json | 9 ++ .../block/silty_grass_block_snowed.json | 9 ++ .../models/item/coarse_loamy_dirt.json | 10 ++ .../models/item/coarse_sandy_dirt.json | 10 ++ .../models/item/coarse_silty_dirt.json | 10 ++ .../textures/blocks/coarse_dirt_loamy.png | Bin 0 -> 563 bytes .../textures/blocks/coarse_dirt_sandy.png | Bin 0 -> 618 bytes .../textures/blocks/coarse_dirt_silty.png | Bin 0 -> 602 bytes 18 files changed, 193 insertions(+), 54 deletions(-) create mode 100644 src/main/resources/assets/biomesoplenty/models/block/coarse_loamy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/coarse_sandy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/coarse_silty_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block_snowed.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block_snowed.json create mode 100644 src/main/resources/assets/biomesoplenty/models/block/silty_grass_block_snowed.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/coarse_loamy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/coarse_sandy_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/models/item/coarse_silty_dirt.json create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_loamy.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_sandy.png create mode 100644 src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_silty.png diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java index 4bb90fa8e..e24a0a813 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPDirt.java @@ -8,14 +8,20 @@ package biomesoplenty.common.block; +import java.util.List; + import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; import biomesoplenty.api.block.BOPBlock; import biomesoplenty.api.block.BOPBlocks; @@ -23,11 +29,12 @@ import biomesoplenty.api.block.BOPBlocks; public class BlockBOPDirt extends BOPBlock { + public static final PropertyBool COARSE = PropertyBool.create("coarse"); public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", BOPDirtType.class); public BlockBOPDirt() { super(Material.ground); - this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, BOPDirtType.LOAMY)); + this.setDefaultState(this.blockState.getBaseState().withProperty(COARSE, Boolean.valueOf(false)).withProperty(VARIANT_PROP, BOPDirtType.LOAMY)); this.setHardness(0.5F); this.setHarvestLevel("shovel", 0); this.setStepSound(Block.soundTypeGravel); @@ -36,38 +43,36 @@ public class BlockBOPDirt extends BOPBlock @Override public IBlockState getStateFromMeta(int meta) { - // only one property to worry about, the variant, so just map according to integer index in BOPDirtType - return this.getDefaultState().withProperty(VARIANT_PROP, BOPDirtType.values()[meta]); + // both variant and coarseness saved in meta, first bit coarseness, other bits variant + return this.getDefaultState().withProperty(COARSE, Boolean.valueOf((meta & 8) > 0)).withProperty(VARIANT_PROP, BOPDirtType.values()[Math.min(2, meta & 7)]); } @Override public int getMetaFromState(IBlockState state) { - // only one property to worry about, the variant, so just map according to integer index in BOPDirtType - return ((BOPDirtType) state.getValue(VARIANT_PROP)).ordinal(); + // both variant and coarseness saved in meta, first bit coarseness, other bits variant + return (Boolean.TRUE.equals(state.getValue(COARSE)) ? 8 : 0) | ((BOPDirtType) state.getValue(VARIANT_PROP)).ordinal(); } @Override protected BlockState createBlockState() { - return new BlockState(this, new IProperty[] { VARIANT_PROP }); + return new BlockState(this, new IProperty[] { COARSE, VARIANT_PROP }); } @Override public IProperty[] getPresetProperties() { - return new IProperty[] { VARIANT_PROP }; + return new IProperty[] { COARSE, VARIANT_PROP }; } @Override public String getStateName(IBlockState state, boolean fullName) { - return ((BOPDirtType) state.getValue(VARIANT_PROP)).getName(); + return (Boolean.TRUE.equals(state.getValue(COARSE)) ? "coarse_" : "") + ((BOPDirtType) state.getValue(VARIANT_PROP)).getName() + "_dirt"; } - - - // enum representing the variants of grass + // enum representing the variants of dirt public static enum BOPDirtType implements IStringSerializable { LOAMY, SANDY, SILTY; @@ -75,7 +80,7 @@ public class BlockBOPDirt extends BOPBlock @Override public String getName() { - return this.name().toLowerCase() + "_dirt"; + return this.name().toLowerCase(); } @Override diff --git a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java index d0ce9e358..93e4b5105 100644 --- a/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java +++ b/src/main/java/biomesoplenty/common/block/BlockBOPGrass.java @@ -18,6 +18,7 @@ import net.minecraft.block.BlockTallGrass; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; @@ -42,35 +43,43 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class BlockBOPGrass extends BOPBlock implements IGrowable { public static final PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", BOPGrassType.class); + public static final PropertyBool SNOWY = PropertyBool.create("snowy"); public BlockBOPGrass() { super(Material.grass); - this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, BOPGrassType.SPECTRALMOSS)); + this.setDefaultState(this.blockState.getBaseState().withProperty(SNOWY, Boolean.valueOf(false)).withProperty(VARIANT_PROP, BOPGrassType.SPECTRALMOSS)); this.setHardness(0.6F); this.setHarvestLevel("shovel", 0); // TODO: I think this just determines which tool speeds up digging - need to investigate more this.setStepSound(Block.soundTypeGrass); this.setTickRandomly(true); } + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) + { + Block block = worldIn.getBlockState(pos.up()).getBlock(); + return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); + } + @Override public IBlockState getStateFromMeta(int meta) { - // only one property to worry about, the variant, so just map according to integer index in BOPGrassType + // only one property in meta to worry about, the variant, so just map according to integer index in BOPGrassType return this.getDefaultState().withProperty(VARIANT_PROP, BOPGrassType.values()[meta]); } @Override public int getMetaFromState(IBlockState state) { - // only one property to worry about, the variant, so just map according to integer index in BOPGrassType + // only one property in meta to worry about, the variant, so just map according to integer index in BOPGrassType return ((BOPGrassType) state.getValue(VARIANT_PROP)).ordinal(); } @Override protected BlockState createBlockState() { - return new BlockState(this, new IProperty[] { VARIANT_PROP }); + return new BlockState(this, new IProperty[] { VARIANT_PROP, SNOWY }); } @Override @@ -252,15 +261,16 @@ public class BlockBOPGrass extends BOPBlock implements IGrowable } - // spread grass to suitable nearby grass blocks + // spread grass to suitable nearby blocks // tries - number of times to try and spread to a random nearby block // xzSpread - how far can the grass spread in the x and z directions // downSpread - how far can the grass spread downwards // upSpread - how far can the grass spread upwards - // TODO: let grass spread across different dirt types? onto vanilla dirt too (and vice verca)? + // TODO: find a way to get vanilla grass to spread to BOP dirt types @SideOnly(Side.CLIENT) public void spreadGrass(World world, BlockPos pos, IBlockState state, Random rand, int tries, int xzSpread, int downSpread, int upSpread) { + // the type of grass which is spreading BOPGrassType grassType = (BOPGrassType)state.getValue(VARIANT_PROP); // the type of dirt this grass grows on @@ -280,24 +290,21 @@ public class BlockBOPGrass extends BOPBlock implements IGrowable { // pick a random nearby position, and get the block, block state, and block above BlockPos pos1 = pos.add(rand.nextInt(xzSpread * 2 + 1) - xzSpread, rand.nextInt(downSpread + upSpread + 1) - downSpread, rand.nextInt(xzSpread * 2 + 1) - xzSpread); - IBlockState iblockstate1 = world.getBlockState(pos1); - Block block1 = iblockstate1.getBlock(); - Block blockAbove = world.getBlockState(pos1.up()).getBlock(); + IBlockState target = world.getBlockState(pos1); + Block blockAboveTarget = world.getBlockState(pos1.up()).getBlock(); - // see if the randomly chosen nearby block is the right type for this grass (same block and meta as dirtBlockState) - // TODO: is it ok to just compare the equality of the states? IE iblockstate1==dirtBlockState ? - if (block1==grassType.getDirtBlock() && block1.getMetaFromState(iblockstate1)==grassType.getDirtBlockMeta()) + // see if this type of grass can spread to the target block + IBlockState targetGrass = grassType.spreadsToGrass(target); + if (targetGrass == null) {break;} + + // if there's enough light, turn the block to the relevant grass block + if (world.getLightFromNeighbors(pos1.up()) >= 4 && blockAboveTarget.getLightOpacity(world, pos1.up()) <= 2) { - // if there's enough light and it isn't covered, turn the block to the relevant grass block - if (world.getLightFromNeighbors(pos1.up()) >= 4 && blockAbove.getLightOpacity(world, pos1.up()) <= 2) - { - world.setBlockState(pos1, this.getDefaultState().withProperty(VARIANT_PROP, grassType)); - } - } + world.setBlockState(pos1, targetGrass); + } } } } - } @@ -370,15 +377,6 @@ public class BlockBOPGrass extends BOPBlock implements IGrowable } } - /* TODO: don't understand the intention here.. grass turns to dirt when a plant grows??? - @Override - public void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) - { - world.setBlock(x, y, z, BOPCBlocks.newBopDirt, world.getBlockMetadata(x, y, z) * 2, 2); - } - */ - - @Override public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) { @@ -451,7 +449,7 @@ public class BlockBOPGrass extends BOPBlock implements IGrowable } // get the blockstate which corresponds to the type of dirt which this grass variant grows on - // this is used to determine what drops when you break the grass block, and also which nearby blocks this grass can spread to + // this is used to determine what drops when you break the grass block, and the type of dirt it reverts to when covered public IBlockState getDirtBlockState() { switch(this) @@ -478,6 +476,55 @@ public class BlockBOPGrass extends BOPBlock implements IGrowable { return this.getDirtBlock().getMetaFromState(this.getDirtBlockState()); } + + // if this type of grass can spread to the target block, return the grass which it will transform into + // otherwise return null + // this affects the grass spreading algorithm above, BlockBOPGrass.spreadGrass() + public IBlockState spreadsToGrass(IBlockState target) { + + switch(this) + { + // spectral moss only spreads to end stone + case SPECTRALMOSS: + if (target.getBlock()==Blocks.end_stone) + { + return BOPBlocks.grass.getDefaultState().withProperty(BlockBOPGrass.VARIANT_PROP, BlockBOPGrass.BOPGrassType.SPECTRALMOSS); + } + else + { + return null; + } + + // loamy/sandy/silty grasses spread to any kind of dirt + case LOAMY: case SANDY: case SILTY: + // vanilla dirt gets vanilla grass spread to it + if (target.getBlock() == Blocks.dirt && target.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT) + { + return Blocks.grass.getDefaultState(); + } + // BOP dirt get's the corresponding BOP grass spread to it (unless it's coarse - grass doesn't grow on coarse dirt) + else if (target.getBlock() == BOPBlocks.dirt && Boolean.FALSE.equals(target.getValue(BlockBOPDirt.COARSE)) ) + { + BlockBOPDirt.BOPDirtType targetDirtType = (BlockBOPDirt.BOPDirtType)target.getValue(BlockBOPDirt.VARIANT_PROP); + switch (targetDirtType) + { + case LOAMY: case SANDY: case SILTY: + return targetDirtType.getGrassBlockState(); + default: + return null; + } + } + else + { + return null; + } + + // smoldering grass doesn't spread at all + case SMOLDERING: default: + return null; + } + } + } } \ 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 25ca5f5b4..40852e3da 100644 --- a/src/main/java/biomesoplenty/common/init/ModBlocks.java +++ b/src/main/java/biomesoplenty/common/init/ModBlocks.java @@ -66,6 +66,7 @@ public class ModBlocks grass = registerBlock(new BlockBOPGrass(), "grass"); waterlily = registerBlock(new BlockBOPLilypad(), "waterlily"); dirt = registerBlock(new BlockBOPDirt(), "dirt"); + } private static Block registerBlock(BOPBlock block, String name) @@ -82,9 +83,10 @@ public class ModBlocks for (IBlockState state : block.presetStates) { String stateName = block.getStateName(state, true); + int stateMeta = block.getMetaFromState(state); BiomesOPlenty.proxy.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + stateName); - BiomesOPlenty.proxy.registerBlockForMeshing(block, block.getMetaFromState(state), stateName); + BiomesOPlenty.proxy.registerBlockForMeshing(block, stateMeta, stateName); GuiEventHandler.blockCount++; } diff --git a/src/main/resources/assets/biomesoplenty/blockstates/dirt.json b/src/main/resources/assets/biomesoplenty/blockstates/dirt.json index 70f7cc7b8..98f2543fa 100644 --- a/src/main/resources/assets/biomesoplenty/blockstates/dirt.json +++ b/src/main/resources/assets/biomesoplenty/blockstates/dirt.json @@ -1,7 +1,10 @@ { "variants": { - "variant=loamy_dirt": { "model": "biomesoplenty:loamy_dirt" }, - "variant=sandy_dirt": { "model": "biomesoplenty:sandy_dirt" }, - "variant=silty_dirt": { "model": "biomesoplenty:silty_dirt" } + "coarse=false,variant=loamy": { "model": "biomesoplenty:loamy_dirt" }, + "coarse=false,variant=sandy": { "model": "biomesoplenty:sandy_dirt" }, + "coarse=false,variant=silty": { "model": "biomesoplenty:silty_dirt" }, + "coarse=true,variant=loamy": { "model": "biomesoplenty:coarse_loamy_dirt" }, + "coarse=true,variant=sandy": { "model": "biomesoplenty:coarse_sandy_dirt" }, + "coarse=true,variant=silty": { "model": "biomesoplenty:coarse_silty_dirt" } } } diff --git a/src/main/resources/assets/biomesoplenty/blockstates/grass.json b/src/main/resources/assets/biomesoplenty/blockstates/grass.json index 112ee0b52..cbda40f0c 100644 --- a/src/main/resources/assets/biomesoplenty/blockstates/grass.json +++ b/src/main/resources/assets/biomesoplenty/blockstates/grass.json @@ -1,9 +1,14 @@ { "variants": { - "variant=smoldering_grass_block": { "model": "biomesoplenty:smoldering_grass_block" }, - "variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" }, - "variant=loamy_grass_block": { "model": "biomesoplenty:loamy_grass_block" }, - "variant=sandy_grass_block": { "model": "biomesoplenty:sandy_grass_block" }, - "variant=silty_grass_block": { "model": "biomesoplenty:silty_grass_block" } + "snowy=false,variant=smoldering_grass_block": { "model": "biomesoplenty:smoldering_grass_block" }, + "snowy=true,variant=smoldering_grass_block": { "model": "biomesoplenty:smoldering_grass_block" }, + "snowy=false,variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" }, + "snowy=true,variant=spectral_moss": { "model": "biomesoplenty:spectral_moss" }, + "snowy=false,variant=loamy_grass_block": { "model": "biomesoplenty:loamy_grass_block" }, + "snowy=true,variant=loamy_grass_block": { "model": "biomesoplenty:loamy_grass_block_snowed" }, + "snowy=false,variant=sandy_grass_block": { "model": "biomesoplenty:sandy_grass_block" }, + "snowy=true,variant=sandy_grass_block": { "model": "biomesoplenty:sandy_grass_block_snowed" }, + "snowy=false,variant=silty_grass_block": { "model": "biomesoplenty:silty_grass_block" }, + "snowy=true,variant=silty_grass_block": { "model": "biomesoplenty:silty_grass_block_snowed" } } } diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index eef3df019..8b3a364ea 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -133,10 +133,12 @@ tile.waterlily.lily_medium.name=Medium Lily Pad tile.waterlily.lily_small.name=Small Lily Pad tile.waterlily.lily_tiny.name=Tiny Lily Pad -tile.dirt.loamy_dirt=Loamy Dirt -tile.dirt.sandy_dirt=Sandy Dirt -tile.dirt.silty_dirt=Silty Dirt - +tile.dirt.loamy_dirt.name=Loamy Dirt +tile.dirt.sandy_dirt.name=Sandy Dirt +tile.dirt.silty_dirt.name=Silty Dirt +tile.dirt.coarse_loamy_dirt.name=Coarse Loamy Dirt +tile.dirt.coarse_sandy_dirt.name=Coarse Sandy Dirt +tile.dirt.coarse_silty_dirt.name=Coarse Silty Dirt item.fleshchunk.name=Chunk of Flesh item.mudball.name=Mud Ball diff --git a/src/main/resources/assets/biomesoplenty/models/block/coarse_loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/coarse_loamy_dirt.json new file mode 100644 index 000000000..8b8f67e42 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/coarse_loamy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/coarse_dirt_loamy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/coarse_sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/coarse_sandy_dirt.json new file mode 100644 index 000000000..735b1cbf3 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/coarse_sandy_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/coarse_dirt_sandy" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/coarse_silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/block/coarse_silty_dirt.json new file mode 100644 index 000000000..6653b4688 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/coarse_silty_dirt.json @@ -0,0 +1,6 @@ +{ + "parent": "block/cube_all", + "textures": { + "all": "biomesoplenty:blocks/coarse_dirt_silty" + } +} diff --git a/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block_snowed.json b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block_snowed.json new file mode 100644 index 000000000..1ab261a20 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/loamy_grass_block_snowed.json @@ -0,0 +1,9 @@ +{ + "parent": "block/cube_bottom_top", + "textures": { + "particle": "biomesoplenty:blocks/dirt_loamy", + "bottom": "biomesoplenty:blocks/dirt_loamy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_loamy_side_snowed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block_snowed.json b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block_snowed.json new file mode 100644 index 000000000..d45c607bc --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/sandy_grass_block_snowed.json @@ -0,0 +1,9 @@ +{ + "parent": "block/cube_bottom_top", + "textures": { + "particle": "biomesoplenty:blocks/dirt_sandy", + "bottom": "biomesoplenty:blocks/dirt_sandy", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_sandy_side_snowed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block_snowed.json b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block_snowed.json new file mode 100644 index 000000000..42eabbdb2 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/block/silty_grass_block_snowed.json @@ -0,0 +1,9 @@ +{ + "parent": "block/cube_bottom_top", + "textures": { + "particle": "biomesoplenty:blocks/dirt_silty", + "bottom": "biomesoplenty:blocks/dirt_silty", + "top": "biomesoplenty:blocks/grass_top", + "side": "biomesoplenty:blocks/grass_silty_side_snowed" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/biomesoplenty/models/item/coarse_loamy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/coarse_loamy_dirt.json new file mode 100644 index 000000000..9e9590809 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/coarse_loamy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/coarse_loamy_dirt", + "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/models/item/coarse_sandy_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/coarse_sandy_dirt.json new file mode 100644 index 000000000..947655031 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/coarse_sandy_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/coarse_sandy_dirt", + "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/models/item/coarse_silty_dirt.json b/src/main/resources/assets/biomesoplenty/models/item/coarse_silty_dirt.json new file mode 100644 index 000000000..d607d4768 --- /dev/null +++ b/src/main/resources/assets/biomesoplenty/models/item/coarse_silty_dirt.json @@ -0,0 +1,10 @@ +{ + "parent": "biomesoplenty:block/coarse_silty_dirt", + "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/coarse_dirt_loamy.png b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_loamy.png new file mode 100644 index 0000000000000000000000000000000000000000..60a76d44f4f8079374da72358ef77927a2048094 GIT binary patch literal 563 zcmV-30?hr1P)N2bZe?^J zG%heMGmPe!Pyhe{u}MThR5(vPlG{$gP!L7?6~=_5a<`OnZ>hA!3MmvyErB2;q6jZ0 zKIntd|92gRm`s|v?%8`zwcq3Jkj1Z$lXU1}gtl2FYYD32;lQoO_A)5jW9wB%*vIn?+{gzIAjZq*8oHG+J z{C54A#c4R0`3@Z&o{d~O5V{=u zvIG+r+BzC0fx3f8j6L<`VnN5sMjjpa-G&T65}?aFAOnXOR0`4|_OZ==j$0^DRg`4A z@cw*WIdubvj8)1bKz#amL9Wld21`MrfbpoP^4nG%t8h8;p?7{9iyj2x9^KRFI2*vz<=@dpHkz}Hh?>-Ycw002ovPDHLkV1mI@ B>Z1Sv literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_sandy.png b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_sandy.png new file mode 100644 index 0000000000000000000000000000000000000000..674031e5a895beca892af78773a4cdfbaabff220 GIT binary patch literal 618 zcmV-w0+s!VP)N2bZe?^J zG%heMGmPe!Pyhe{=t)FDR5(vPlF2VaQ544CzhWUQ%rP~jC5@r4HMP~g2(6-Mkk?dO zq(Kceg@_s!#7h?iz_`+m6r-n~@%-67Pc7rc+flMY7Gi?9OfY(Bd8iJUb5bCcd>g}j3 z9xGz_a8pqyK;}R<9c-o&tkDW3&iJnqILwg!{xov1)R&ugQ$bMr1!y<<&`5v%c`k5$ zI5OdHBpMIfrOwc6(3#C>PwPqc$b(~W<*ZEVI}tV_jIusOftl_8j@(9YKUdr42k z+bAn;#C1+?ED>=WEe}wU9BY#XL_+lU4!*7`06wfFq(bcNYUb-Pg#@xnl1vxf??rPm zXaf)#?5<`3!PN1B+&=vpDusyz_H0eDl^J%V)2cMT>_wh>oUnr$fRe<0lLN58$*K?5 zt%S~2L}-?!SqWi0sA^zhz*R$TCe(o|qquvgt@NW9hmIgDl&Kwrd&pBuh&Pt+$!Ko* zr7#V)b`18ERk6Q@HB$%dq&yH?mPJH9IRF!GdSZs{2Vp2ss8DoI{r~^~07*qoM6N<$ Ef+0!?L;wH) literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_silty.png b/src/main/resources/assets/biomesoplenty/textures/blocks/coarse_dirt_silty.png new file mode 100644 index 0000000000000000000000000000000000000000..5d773a48d6e18c572fba39687679d4a5b3ed525c GIT binary patch literal 602 zcmV-g0;TN2bZe?^J zG%heMGmPe!Pyhe{*hxe|R5(vPl36c9Q51#m|MB8MM9fi9y~dVXK}Q|PZE2}edbL$? zi$*CghMHa~M1mJy@ymQCTO>OtYfo#hea_K--mmWJg+|TV&Big@S+|o&bbbQ2y|snY zHPA_XIpXEi@JY|Qhc*&^@JV^KR4N6%`hPRv<>rtYf|#0Mj5>(wj?UXtMGPNqGBN{@ zInV_R7nNX*Rw!}irj!ymV!p|T^I~~(aXTHRf}r#Z(5{d3(_@ZWdG(^YHSbY9ao?oW zxm|tev~3%g>_B&$YACJ8Mh3e`3jrqyk(*D2$r2P{G&4u-fFov_W+4-yh#&?yx3gcb z7g^IMbcocF3kHZZ-T0?_Yq{kh>rxRg^oo^`A(*Jpj*2VAOq6?&6>}>gPHt=|;IZ>2 z6=rB!8W0K5-#f4d03TKoQX%$sU;Tc&L;_hQNv4bLk7nI(=l~+)&R!M}OdT)C?bENJ zQkY0!PuCT;iu>J`W#Lxx3FI-82sHpDiTfr8V1a|3B&^#hD2Is9EK9Qz!gx^Cz{H8+ zK5|jN+D}Gt_dOl0pO1Cu2r8CzSnVL(9=)FsZ!F)F(cJQLqXItL&#h($07*qoM6N<$g6FpWC;$Ke literal 0 HcmV?d00001