Finished readding the first set of flowers, updated to the latest FML

This commit is contained in:
Adubbz 2014-10-12 11:11:57 +11:00
parent 94df3fb688
commit c8239fa3a4
17 changed files with 150 additions and 64 deletions

View File

@ -1,3 +1,3 @@
minecraft_version=1.8
forge_version=7.10.93.1001-1.8
forge_version=8.0.2.1009-1.8
mod_version=3.0.0

View File

@ -15,8 +15,10 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@ -34,10 +36,16 @@ public class BOPPlant extends BOPBlock
this.setStepSound(Block.soundTypeGrass);
}
@Override
public boolean canReplace(World world, BlockPos pos, EnumFacing side, ItemStack stack)
{
return super.canPlaceBlockOnSide(world, pos, side) && this.canBlockStay(world, pos, this.getStateFromMeta(stack.getMetadata()));
}
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos)
{
return super.canPlaceBlockAt(world, pos) && this.canBlockStay(world, pos, world.getBlockState(pos));
return super.canPlaceBlockAt(world, pos) && this.canBlockStay(world, pos, this.getDefaultState());
}
public boolean canBlockStay(World world, BlockPos pos, IBlockState state)
@ -93,4 +101,11 @@ public class BOPPlant extends BOPBlock
{
return EnumWorldBlockLayer.CUTOUT;
}
@Override
@SideOnly(Side.CLIENT)
public Block.EnumOffsetType getOffsetType()
{
return Block.EnumOffsetType.XZ;
}
}

View File

@ -16,6 +16,15 @@ 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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemShears;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
@ -39,7 +48,34 @@ public class BlockBOPFlower extends BOPPlant
super(VARIANT_PROP);
}
//TODO: Add light for glowflowers (Requires Forge)
//TODO: Add light for glowflowers and enderlotus (Requires Forge)
//TODO: Make enderlotus require spectral moss
//TODO: Make bromeliads require hard dirt, hardened clay or sand
@Override
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity tileentity)
{
super.harvestBlock(world, player, pos, state, tileentity);
FlowerType type = (FlowerType)state.getValue(VARIANT_PROP);
if (type == FlowerType.DEATHBLOOM && (player.getCurrentEquippedItem() == null || !(player.getCurrentEquippedItem().getItem() instanceof ItemShears)))
{
player.addPotionEffect(new PotionEffect(Potion.wither.id, 300));
}
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
FlowerType type = (FlowerType)state.getValue(VARIANT_PROP);
if (entity instanceof EntityLivingBase && type == FlowerType.DEATHBLOOM)
{
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.wither.id, 200));
}
}
@Override
protected BlockState createBlockState()
@ -70,19 +106,20 @@ public class BlockBOPFlower extends BOPPlant
this.setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, 0.5F, 0.7F);
break;
case ENDERLOTUS:
this.setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, 0.4F, 0.7F);
break;
case DANDELION:
this.setBlockBounds(0.3F, 0.0F, 0.3F, 0.7F, 0.6F, 0.7F);
break;
default:
this.setBlockBounds(0.1F, 0.0F, 0.1F, 0.9F, 0.8F, 0.9F);
break;
}
}
@Override
@SideOnly(Side.CLIENT)
public Block.EnumOffsetType getOffsetType()
{
return Block.EnumOffsetType.XZ;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand)
@ -94,6 +131,8 @@ public class BlockBOPFlower extends BOPPlant
}
}
//TODO: Readd eyebulb in as a seperate block
//TODO: Readd dandelion blowing
public static enum FlowerType implements IBOPVariant
{
CLOVER,
@ -105,7 +144,10 @@ public class BlockBOPFlower extends BOPPlant
PINK_DAFFODIL,
WILDFLOWER,
VIOLET,
WHITE_ANEMONE;
WHITE_ANEMONE,
ENDERLOTUS,
BROMELIAD,
DANDELION;
@Override
public String getBaseName()

View File

@ -11,6 +11,7 @@ package biomesoplenty.common.init;
import static biomesoplenty.api.block.BOPBlocks.*;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
import biomesoplenty.api.block.BOPBlock;
import biomesoplenty.api.block.IBOPVariant;
import biomesoplenty.client.util.ModelHelper;
@ -22,7 +23,6 @@ import biomesoplenty.common.block.BlockBOPLog2;
import biomesoplenty.common.block.BlockBOPLog3;
import biomesoplenty.common.block.BlockBOPLog4;
import biomesoplenty.common.item.ItemBlockWithVariants;
import biomesoplenty.common.util.RegistryUtil;
import biomesoplenty.core.BiomesOPlenty;
public class ModBlocks
@ -44,7 +44,7 @@ public class ModBlocks
if (block.hasVariants())
{
RegistryUtil.registerBlock(block, ItemBlockWithVariants.class, name);
GameRegistry.registerBlock(block, ItemBlockWithVariants.class, name);
for (IBOPVariant variant : block.getVariants())
{
@ -56,7 +56,7 @@ public class ModBlocks
}
else
{
RegistryUtil.registerBlock(block, name);
GameRegistry.registerBlock(block, name);
ModelHelper.addVariantName(Item.getItemFromBlock(block), BiomesOPlenty.MOD_ID + ":" + name);
BiomesOPlenty.proxy.registerBlockForMeshing(block, 0, name);

View File

@ -1,49 +0,0 @@
/*******************************************************************************
* 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.util;
import java.util.Iterator;
import java.util.Map;
import biomesoplenty.core.BiomesOPlenty;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class RegistryUtil
{
public static Block registerBlock(Block block, String name)
{
return registerBlock(block, ItemBlock.class, name);
}
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name)
{
return registerBlock(block, itemclass, name, new Object[]{});
}
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name, Object... itemCtorArgs)
{
block = GameRegistry.registerBlock(block, itemclass, name, itemCtorArgs);
Iterator iterator = block.getBlockState().getValidStates().iterator();
while (iterator.hasNext())
{
IBlockState iblockstate = (IBlockState)iterator.next();
int id = Block.blockRegistry.getIDForObject(block) << 4 | block.getMetaFromState(iblockstate);
Block.BLOCK_STATE_IDS.put(iblockstate, id);
}
return block;
}
}

View File

@ -9,6 +9,9 @@
"variant=pink_daffodil": { "model": "biomesoplenty:pink_daffodil" },
"variant=wildflower": { "model": "biomesoplenty:wildflower" },
"variant=violet": { "model": "biomesoplenty:violet" },
"variant=white_anemone": { "model": "biomesoplenty:white_anemone" }
"variant=white_anemone": { "model": "biomesoplenty:white_anemone" },
"variant=enderlotus": { "model": "biomesoplenty:enderlotus" },
"variant=bromeliad": { "model": "biomesoplenty:bromeliad" },
"variant=dandelion": { "model": "biomesoplenty:dandelion" }
}
}

View File

@ -10,6 +10,9 @@ tile.flower.pink_daffodil.name=Pink Dafodil
tile.flower.wildflower.name=Wildflower
tile.flower.violet.name=Violet
tile.flower.white_anemone.name=White Anemone
tile.flower.enderlotus.name=Enderlotus
tile.flower.bromeliad.name=Bromeliad
tile.flower.dandelion.name=Dandelion Puff
tile.log.sacred_oak.name=Sacred Oak Wood
tile.log.cherry.name=Cherry Wood

View File

@ -0,0 +1,6 @@
{
"parent": "block/cross",
"textures": {
"cross": "biomesoplenty:blocks/bromeliad"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cross",
"textures": {
"cross": "biomesoplenty:blocks/dandelion"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cross",
"textures": {
"cross": "biomesoplenty:blocks/enderlotus"
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "biomesoplenty:blocks/bromeliad"
},
"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 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "biomesoplenty:blocks/dandelion"
},
"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 ]
}
}
}

View File

@ -0,0 +1,18 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "biomesoplenty:blocks/enderlotus"
},
"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 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 665 B