Added village material replacements for various BOP biomes

This commit is contained in:
Forstride 2018-04-12 22:30:09 -04:00
parent e7b2cd0396
commit bd7cdf2262
2 changed files with 173 additions and 8 deletions

View file

@ -1,12 +1,18 @@
package biomesoplenty.common.handler; package biomesoplenty.common.handler;
import biomesoplenty.api.biome.BOPBiomes; import biomesoplenty.api.biome.BOPBiomes;
import biomesoplenty.api.block.BOPBlocks;
import biomesoplenty.api.enums.BOPWoods; import biomesoplenty.api.enums.BOPWoods;
import biomesoplenty.common.block.BlockBOPLog; import biomesoplenty.common.block.BlockBOPLog;
import biomesoplenty.common.block.BlockBOPPlanks; import biomesoplenty.common.block.BlockBOPPlanks;
import biomesoplenty.common.block.BlockBOPWoodStairs; import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockLog.EnumAxis;
import net.minecraft.block.BlockNewLog;
import net.minecraft.block.BlockOldLog;
import net.minecraft.block.BlockPlanks;
import net.minecraft.block.BlockStairs; import net.minecraft.block.BlockStairs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.event.terraingen.BiomeEvent; import net.minecraftforge.event.terraingen.BiomeEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result; import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@ -16,25 +22,184 @@ public class VillageMaterialEventHandler
@SubscribeEvent @SubscribeEvent
public void getVillageBlockID(BiomeEvent.GetVillageBlockID event) public void getVillageBlockID(BiomeEvent.GetVillageBlockID event)
{ {
//Brushland
if (event.getBiome() == BOPBiomes.brushland.get())
{
if (event.getOriginal().getBlock() == Blocks.PLANKS)
{
event.setReplacement(BlockBOPPlanks.paging.getVariantState(BOPWoods.EBONY));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.LOG || event.getOriginal().getBlock() == Blocks.LOG2)
{
EnumAxis axis = event.getOriginal().getValue(BlockLog.LOG_AXIS);
event.setReplacement(BlockBOPLog.paging.getVariantState(BOPWoods.EBONY).withProperty(BlockLog.LOG_AXIS, axis));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.COBBLESTONE)
{
event.setReplacement(BlockBOPLog.paging.getVariantState(BOPWoods.EBONY).withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Y));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS)
{
EnumFacing facing = event.getOriginal().getValue(BlockStairs.FACING);
event.setReplacement(BOPBlocks.ebony_stairs.getDefaultState().withProperty(BlockStairs.FACING, facing));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_FENCE)
{
event.setReplacement(BOPBlocks.ebony_fence.getDefaultState());
event.setResult(Result.DENY);
}
}
//Coniferous Forest //Coniferous Forest
if (event.getBiome() == BOPBiomes.coniferous_forest.get()) if (event.getBiome() == BOPBiomes.coniferous_forest.get())
{ {
//Planks
if (event.getOriginal().getBlock() == Blocks.PLANKS) if (event.getOriginal().getBlock() == Blocks.PLANKS)
{ {
event.setReplacement(BlockBOPPlanks.paging.getVariantState(BOPWoods.FIR)); event.setReplacement(BlockBOPPlanks.paging.getVariantState(BOPWoods.FIR));
event.setResult(Result.DENY); event.setResult(Result.DENY);
} }
//Logs if (event.getOriginal().getBlock() == Blocks.LOG || event.getOriginal().getBlock() == Blocks.LOG2)
if (event.getOriginal().getBlock() == Blocks.LOG)
{ {
event.setReplacement(BlockBOPLog.paging.getVariantState(BOPWoods.FIR)); EnumAxis axis = event.getOriginal().getValue(BlockLog.LOG_AXIS);
event.setReplacement(BlockBOPLog.paging.getVariantState(BOPWoods.FIR).withProperty(BlockLog.LOG_AXIS, axis));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.COBBLESTONE)
{
event.setReplacement(BlockBOPLog.paging.getVariantState(BOPWoods.FIR).withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Y));
event.setResult(Result.DENY); event.setResult(Result.DENY);
} }
if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS) if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS)
{ {
int meta = BlockStairs.getStateId(event.getOriginal()); EnumFacing facing = event.getOriginal().getValue(BlockStairs.FACING);
event.setReplacement(BlockBOPWoodStairs.getBlock(BOPWoods.FIR).getStateFromMeta(meta)); event.setReplacement(BOPBlocks.fir_stairs.getDefaultState().withProperty(BlockStairs.FACING, facing));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_FENCE)
{
event.setReplacement(BOPBlocks.fir_fence.getDefaultState());
event.setResult(Result.DENY);
}
}
//Grove
if (event.getBiome() == BOPBiomes.grove.get())
{
if (event.getOriginal().getBlock() == Blocks.PLANKS)
{
event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.DARK_OAK));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.LOG || event.getOriginal().getBlock() == Blocks.LOG2)
{
EnumAxis axis = event.getOriginal().getValue(BlockLog.LOG_AXIS);
event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK).withProperty(BlockLog.LOG_AXIS, axis));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.COBBLESTONE)
{
event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.DARK_OAK).withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Y));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS)
{
EnumFacing facing = event.getOriginal().getValue(BlockStairs.FACING);
event.setReplacement(Blocks.DARK_OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, facing));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_FENCE)
{
event.setReplacement(Blocks.DARK_OAK_FENCE.getDefaultState());
event.setResult(Result.DENY);
}
}
//Lush Desert
if (event.getBiome() == BOPBiomes.lush_desert.get())
{
if (event.getOriginal().getBlock() == Blocks.PLANKS)
{
event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.ACACIA));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.LOG || event.getOriginal().getBlock() == Blocks.LOG2)
{
EnumAxis axis = event.getOriginal().getValue(BlockLog.LOG_AXIS);
event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLog.LOG_AXIS, axis));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS)
{
EnumFacing facing = event.getOriginal().getValue(BlockStairs.FACING);
event.setReplacement(Blocks.ACACIA_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, facing));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_FENCE)
{
event.setReplacement(Blocks.ACACIA_FENCE.getDefaultState());
event.setResult(Result.DENY);
}
}
//Meadow
if (event.getBiome() == BOPBiomes.meadow.get())
{
if (event.getOriginal().getBlock() == Blocks.PLANKS)
{
event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.LOG || event.getOriginal().getBlock() == Blocks.LOG2)
{
EnumAxis axis = event.getOriginal().getValue(BlockLog.LOG_AXIS);
event.setReplacement(Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.SPRUCE).withProperty(BlockLog.LOG_AXIS, axis));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS)
{
EnumFacing facing = event.getOriginal().getValue(BlockStairs.FACING);
event.setReplacement(Blocks.SPRUCE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, facing));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_FENCE)
{
event.setReplacement(Blocks.SPRUCE_FENCE.getDefaultState());
event.setResult(Result.DENY);
}
}
//Outback
if (event.getBiome() == BOPBiomes.outback.get())
{
if (event.getOriginal().getBlock() == Blocks.PLANKS)
{
event.setReplacement(Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.ACACIA));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.LOG || event.getOriginal().getBlock() == Blocks.LOG2)
{
EnumAxis axis = event.getOriginal().getValue(BlockLog.LOG_AXIS);
event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLog.LOG_AXIS, axis));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.COBBLESTONE)
{
event.setReplacement(Blocks.LOG2.getDefaultState().withProperty(BlockNewLog.VARIANT, BlockPlanks.EnumType.ACACIA).withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Y));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS)
{
EnumFacing facing = event.getOriginal().getValue(BlockStairs.FACING);
event.setReplacement(Blocks.ACACIA_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, facing));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_FENCE)
{
event.setReplacement(Blocks.ACACIA_FENCE.getDefaultState());
event.setResult(Result.DENY); event.setResult(Result.DENY);
} }
} }

View file

@ -27,7 +27,7 @@ public class ModHandlers
DecorateBiomeEventHandler decorateBiomeHandler = new DecorateBiomeEventHandler(); DecorateBiomeEventHandler decorateBiomeHandler = new DecorateBiomeEventHandler();
MinecraftForge.EVENT_BUS.register(decorateBiomeHandler); MinecraftForge.EVENT_BUS.register(decorateBiomeHandler);
MinecraftForge.TERRAIN_GEN_BUS.register(decorateBiomeHandler); MinecraftForge.TERRAIN_GEN_BUS.register(decorateBiomeHandler);
//MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler()); MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler());
MinecraftForge.ORE_GEN_BUS.register(decorateBiomeHandler); MinecraftForge.ORE_GEN_BUS.register(decorateBiomeHandler);
MinecraftForge.EVENT_BUS.register(new DyeEventHandler()); MinecraftForge.EVENT_BUS.register(new DyeEventHandler());
MinecraftForge.EVENT_BUS.register(new BucketEventHandler()); MinecraftForge.EVENT_BUS.register(new BucketEventHandler());