Began work on readding coral
This commit is contained in:
parent
c8ea198f67
commit
decc047e42
10 changed files with 172 additions and 6 deletions
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
/build/
|
||||
/bin/
|
||||
/.gradle/
|
||||
/.settings/
|
||||
/.classpath
|
||||
/.project
|
|
@ -14,6 +14,7 @@ public class BOPBlocks
|
|||
{
|
||||
public static Block ash_block;
|
||||
public static Block bamboo;
|
||||
public static Block coral;
|
||||
public static Block flower;
|
||||
public static Block flower2;
|
||||
public static Block gem;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
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,30 @@
|
|||
/*******************************************************************************
|
||||
* 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 biomesoplenty.api.block.BOPBlocks;
|
||||
import net.minecraft.block.BlockJukebox;
|
||||
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.client.event.BlockModelRegisterEvent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class BlockModelRegisterEventHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void onBlockModelRegister(BlockModelRegisterEvent event)
|
||||
{
|
||||
BlockModelShapes modelShapes = event.modelShapes;
|
||||
|
||||
modelShapes.registerBlockWithStateMapper(BOPBlocks.coral, (new StateMap.Builder()).addPropertiesToIgnore(new IProperty[] {BlockLiquid.LEVEL}).build());
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ import biomesoplenty.common.block.BlockBOPMushroom;
|
|||
import biomesoplenty.common.block.BlockBOPPlanks;
|
||||
import biomesoplenty.common.block.BlockBOPStone;
|
||||
import biomesoplenty.common.block.BlockBamboo;
|
||||
import biomesoplenty.common.block.BlockCoral;
|
||||
import biomesoplenty.common.block.BlockGem;
|
||||
import biomesoplenty.common.block.BlockGemOre;
|
||||
import biomesoplenty.common.block.BlockHive;
|
||||
|
@ -42,6 +43,7 @@ public class ModBlocks
|
|||
{
|
||||
ash_block = registerBlock(new BlockAsh(), "ash_block");
|
||||
bamboo = registerBlock(new BlockBamboo(), "bamboo");
|
||||
coral = registerBlock(new BlockCoral(), "coral");
|
||||
flower = registerBlock(new BlockBOPFlower(), "flower");
|
||||
flower2 = registerBlock(new BlockBOPFlower2(), "flower2");
|
||||
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 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
|
||||
|
|
|
@ -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" }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue