Merge branch 'master' into BOP-1.8-3.0.x
This commit is contained in:
commit
549ce43f8b
10 changed files with 191 additions and 6 deletions
|
@ -15,6 +15,7 @@ public class BOPBlocks
|
||||||
public static Block ash_block;
|
public static Block ash_block;
|
||||||
public static Block bamboo;
|
public static Block bamboo;
|
||||||
public static Block bone_segment;
|
public static Block bone_segment;
|
||||||
|
public static Block coral;
|
||||||
public static Block flower;
|
public static Block flower;
|
||||||
public static Block flower2;
|
public static Block flower2;
|
||||||
public static Block gem;
|
public static Block gem;
|
||||||
|
|
|
@ -26,9 +26,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BOPPlant extends BOPBlock
|
public class BOPPlant extends BOPBlock
|
||||||
{
|
{
|
||||||
protected BOPPlant()
|
protected BOPPlant(Material material)
|
||||||
{
|
{
|
||||||
super(Material.plants);
|
super(material);
|
||||||
|
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
|
|
||||||
|
@ -36,6 +36,11 @@ public class BOPPlant extends BOPBlock
|
||||||
this.setStepSound(Block.soundTypeGrass);
|
this.setStepSound(Block.soundTypeGrass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected BOPPlant()
|
||||||
|
{
|
||||||
|
this(Material.plants);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canReplace(World world, BlockPos pos, EnumFacing side, ItemStack stack)
|
public boolean canReplace(World world, BlockPos pos, EnumFacing side, ItemStack stack)
|
||||||
{
|
{
|
||||||
|
|
87
src/main/java/biomesoplenty/common/block/BlockCoral.java
Normal file
87
src/main/java/biomesoplenty/common/block/BlockCoral.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,6 +30,7 @@ import biomesoplenty.common.block.BlockBOPPlanks;
|
||||||
import biomesoplenty.common.block.BlockBOPStone;
|
import biomesoplenty.common.block.BlockBOPStone;
|
||||||
import biomesoplenty.common.block.BlockBamboo;
|
import biomesoplenty.common.block.BlockBamboo;
|
||||||
import biomesoplenty.common.block.BlockBones;
|
import biomesoplenty.common.block.BlockBones;
|
||||||
|
import biomesoplenty.common.block.BlockCoral;
|
||||||
import biomesoplenty.common.block.BlockGem;
|
import biomesoplenty.common.block.BlockGem;
|
||||||
import biomesoplenty.common.block.BlockGemOre;
|
import biomesoplenty.common.block.BlockGemOre;
|
||||||
import biomesoplenty.common.block.BlockHive;
|
import biomesoplenty.common.block.BlockHive;
|
||||||
|
@ -44,6 +45,7 @@ public class ModBlocks
|
||||||
ash_block = registerBlock(new BlockAsh(), "ash_block");
|
ash_block = registerBlock(new BlockAsh(), "ash_block");
|
||||||
bamboo = registerBlock(new BlockBamboo(), "bamboo");
|
bamboo = registerBlock(new BlockBamboo(), "bamboo");
|
||||||
bone_segment = registerBlock(new BlockBones(), "bone_segment");
|
bone_segment = registerBlock(new BlockBones(), "bone_segment");
|
||||||
|
coral = registerBlock(new BlockCoral(), "coral");
|
||||||
flower = registerBlock(new BlockBOPFlower(), "flower");
|
flower = registerBlock(new BlockBOPFlower(), "flower");
|
||||||
flower2 = registerBlock(new BlockBOPFlower2(), "flower2");
|
flower2 = registerBlock(new BlockBOPFlower2(), "flower2");
|
||||||
gem = registerBlock(new BlockGem(), "gem");
|
gem = registerBlock(new BlockGem(), "gem");
|
||||||
|
|
20
src/main/java/biomesoplenty/common/init/ModHandlers.java
Normal file
20
src/main/java/biomesoplenty/common/init/ModHandlers.java
Normal 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());
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
import biomesoplenty.common.init.ModBlocks;
|
import biomesoplenty.common.init.ModBlocks;
|
||||||
import biomesoplenty.common.init.ModConfiguration;
|
import biomesoplenty.common.init.ModConfiguration;
|
||||||
|
import biomesoplenty.common.init.ModHandlers;
|
||||||
import biomesoplenty.common.init.ModItems;
|
import biomesoplenty.common.init.ModItems;
|
||||||
|
|
||||||
@Mod(modid = BiomesOPlenty.MOD_ID, name = BiomesOPlenty.MOD_NAME)
|
@Mod(modid = BiomesOPlenty.MOD_ID, name = BiomesOPlenty.MOD_NAME)
|
||||||
|
@ -43,6 +44,7 @@ public class BiomesOPlenty
|
||||||
ModConfiguration.init(configDirectory);
|
ModConfiguration.init(configDirectory);
|
||||||
ModItems.init();
|
ModItems.init();
|
||||||
ModBlocks.init();
|
ModBlocks.init();
|
||||||
|
ModHandlers.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
"variant=kelp_middle": { "model": "biomesoplenty:kelp_middle" },
|
"variant=kelp_middle": { "model": "biomesoplenty:kelp_middle" },
|
||||||
"variant=kelp_top": { "model": "biomesoplenty:kelp_top" },
|
"variant=kelp_top": { "model": "biomesoplenty:kelp_top" },
|
||||||
"variant=kelp": { "model": "biomesoplenty:kelp" },
|
"variant=kelp": { "model": "biomesoplenty:kelp" },
|
||||||
"variant=pink_coral": { "model": "biomesoplenty:pink_coral" },
|
"variant=pink": { "model": "biomesoplenty:pink_coral" },
|
||||||
"variant=orange_coral": { "model": "biomesoplenty:orange_coral" },
|
"variant=orange": { "model": "biomesoplenty:orange_coral" },
|
||||||
"variant=blue_coral": { "model": "biomesoplenty:blue_coral" },
|
"variant=blue": { "model": "biomesoplenty:blue_coral" },
|
||||||
"variant=glowing_coral": { "model": "biomesoplenty:glowing_coral" },
|
"variant=glowing": { "model": "biomesoplenty:glowing_coral" },
|
||||||
"variant=algae": { "model": "biomesoplenty:algae" }
|
"variant=algae": { "model": "biomesoplenty:algae" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue