Merge branch 'master' into BOP-1.8-3.0.x

This commit is contained in:
Adubbz 2015-01-11 17:10:07 +11:00
commit 549ce43f8b
10 changed files with 191 additions and 6 deletions

View File

@ -15,6 +15,7 @@ public class BOPBlocks
public static Block ash_block;
public static Block bamboo;
public static Block bone_segment;
public static Block coral;
public static Block flower;
public static Block flower2;
public static Block gem;

View File

@ -26,9 +26,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BOPPlant extends BOPBlock
{
protected BOPPlant()
protected BOPPlant(Material material)
{
super(Material.plants);
super(material);
this.setTickRandomly(true);
@ -36,6 +36,11 @@ public class BOPPlant extends BOPBlock
this.setStepSound(Block.soundTypeGrass);
}
protected BOPPlant()
{
this(Material.plants);
}
@Override
public boolean canReplace(World world, BlockPos pos, EnumFacing side, ItemStack stack)
{

View File

@ -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.block;
import static net.minecraft.block.BlockLiquid.LEVEL;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.IStringSerializable;
import biomesoplenty.api.block.BOPPlant;
public class BlockCoral extends BOPPlant
{
public static PropertyEnum VARIANT_PROP = PropertyEnum.create("variant", CoralType.class);
public BlockCoral()
{
super(Material.water);
this.setDefaultState(this.blockState.getBaseState().withProperty(VARIANT_PROP, CoralType.PINK));
}
@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(VARIANT_PROP, CoralType.values()[meta]).withProperty(LEVEL, 15);
}
@Override
public int getMetaFromState(IBlockState state)
{
int meta = ((CoralType)state.getValue(VARIANT_PROP)).ordinal();
return meta;
}
@Override
protected BlockState createBlockState()
{
return new BlockState(this, new IProperty[] { VARIANT_PROP, LEVEL });
}
@Override
public IProperty[] getPresetProperties()
{
return new IProperty[] { VARIANT_PROP };
}
@Override
public String getStateName(IBlockState state, boolean fullName)
{
CoralType type = (CoralType)state.getValue(VARIANT_PROP);
return type.getName() + (fullName && type != CoralType.ALGAE ? "_coral" : "");
}
public static enum CoralType implements IStringSerializable
{
PINK,
ORANGE,
BLUE,
GLOWING,
ALGAE;
@Override
public String getName()
{
return this.name().toLowerCase();
}
@Override
public String toString()
{
return getName();
}
}
}

View File

@ -0,0 +1,13 @@
/*******************************************************************************
* 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;
public class BlockSegmentedCoral {
}

View File

@ -0,0 +1,27 @@
/*******************************************************************************
* 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.event;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* Called upon the construction of BlockModelShapes after the registration
* of Vanilla blocks. This event should be used as an opportunity to register
* any custom state mappings for modded blocks.
*/
public class BlockModelRegisterEvent extends Event
{
public final BlockModelShapes modelShapes;
public BlockModelRegisterEvent(BlockModelShapes modelShapes)
{
this.modelShapes = modelShapes;
}
}

View File

@ -0,0 +1,28 @@
/*******************************************************************************
* 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.handler;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.properties.IProperty;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.common.event.BlockModelRegisterEvent;
public class BlockModelRegisterEventHandler
{
@SubscribeEvent
public void onBlockModelRegister(BlockModelRegisterEvent event)
{
BlockModelShapes modelShapes = event.modelShapes;
modelShapes.func_178121_a(BOPBlocks.coral, (new StateMap.Builder()).func_178442_a(new IProperty[] {BlockLiquid.LEVEL}).build());
}
}

View File

@ -30,6 +30,7 @@ import biomesoplenty.common.block.BlockBOPPlanks;
import biomesoplenty.common.block.BlockBOPStone;
import biomesoplenty.common.block.BlockBamboo;
import biomesoplenty.common.block.BlockBones;
import biomesoplenty.common.block.BlockCoral;
import biomesoplenty.common.block.BlockGem;
import biomesoplenty.common.block.BlockGemOre;
import biomesoplenty.common.block.BlockHive;
@ -44,6 +45,7 @@ public class ModBlocks
ash_block = registerBlock(new BlockAsh(), "ash_block");
bamboo = registerBlock(new BlockBamboo(), "bamboo");
bone_segment = registerBlock(new BlockBones(), "bone_segment");
coral = registerBlock(new BlockCoral(), "coral");
flower = registerBlock(new BlockBOPFlower(), "flower");
flower2 = registerBlock(new BlockBOPFlower2(), "flower2");
gem = registerBlock(new BlockGem(), "gem");

View File

@ -0,0 +1,20 @@
/*******************************************************************************
* 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.init;
import biomesoplenty.common.handler.BlockModelRegisterEventHandler;
import net.minecraftforge.common.MinecraftForge;
public class ModHandlers
{
public static void init()
{
MinecraftForge.EVENT_BUS.register(new BlockModelRegisterEventHandler());
}
}

View File

@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import biomesoplenty.common.init.ModBlocks;
import biomesoplenty.common.init.ModConfiguration;
import biomesoplenty.common.init.ModHandlers;
import biomesoplenty.common.init.ModItems;
@Mod(modid = BiomesOPlenty.MOD_ID, name = BiomesOPlenty.MOD_NAME)
@ -43,6 +44,7 @@ public class BiomesOPlenty
ModConfiguration.init(configDirectory);
ModItems.init();
ModBlocks.init();
ModHandlers.init();
}
@EventHandler

View File

@ -4,10 +4,10 @@
"variant=kelp_middle": { "model": "biomesoplenty:kelp_middle" },
"variant=kelp_top": { "model": "biomesoplenty:kelp_top" },
"variant=kelp": { "model": "biomesoplenty:kelp" },
"variant=pink_coral": { "model": "biomesoplenty:pink_coral" },
"variant=orange_coral": { "model": "biomesoplenty:orange_coral" },
"variant=blue_coral": { "model": "biomesoplenty:blue_coral" },
"variant=glowing_coral": { "model": "biomesoplenty:glowing_coral" },
"variant=pink": { "model": "biomesoplenty:pink_coral" },
"variant=orange": { "model": "biomesoplenty:orange_coral" },
"variant=blue": { "model": "biomesoplenty:blue_coral" },
"variant=glowing": { "model": "biomesoplenty:glowing_coral" },
"variant=algae": { "model": "biomesoplenty:algae" }
}
}