Allowed villages to generate in Coniferous Forests, Season Forests, and Woodlands. Added loot table modifier, started working on village material replacement

This commit is contained in:
Forstride 2016-08-08 21:39:48 -04:00
parent d5a5954958
commit 6daa914cad
6 changed files with 92 additions and 3 deletions

View file

@ -38,7 +38,7 @@ public class BiomeGenConiferousForest extends BOPBiome
// terrain
this.terrainSettings.avgHeight(68).heightVariation(10, 20);
this.canGenerateVillages = false;
this.canGenerateVillages = true;
if (BOPBiomes.gravel_beach.isPresent())
{

View file

@ -37,7 +37,7 @@ public class BiomeGenSeasonalForest extends BOPBiome
this.addWeight(BOPClimates.COOL_TEMPERATE, 7);
this.canGenerateVillages = false;
this.canGenerateVillages = true;
if (BOPBiomes.gravel_beach.isPresent())
{

View file

@ -42,7 +42,7 @@ public class BiomeGenWoodland extends BOPBiome
// terrain
this.terrainSettings.avgHeight(64).heightVariation(6, 25);
this.canGenerateVillages = false;
this.canGenerateVillages = true;
this.addWeight(BOPClimates.WARM_TEMPERATE, 10);

View file

@ -0,0 +1,45 @@
package biomesoplenty.common.handler;
import biomesoplenty.api.item.BOPItems;
import net.minecraft.world.storage.loot.LootEntryItem;
import net.minecraft.world.storage.loot.LootPool;
import net.minecraft.world.storage.loot.LootTableList;
import net.minecraft.world.storage.loot.conditions.LootCondition;
import net.minecraft.world.storage.loot.functions.LootFunction;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class LootTableEventHandler
{
@SubscribeEvent
public void onLootTableLoad(LootTableLoadEvent event)
{
if (event.getName().equals(LootTableList.CHESTS_NETHER_BRIDGE))
{
LootPool main = event.getTable().getPool("main");
if (main != null)
{
main.addEntry(new LootEntryItem(BOPItems.ash, 3, 6, new LootFunction[0], new LootCondition[0], "biomesoplenty:ash"));
main.addEntry(new LootEntryItem(BOPItems.fleshchunk, 5, 5, new LootFunction[0], new LootCondition[0], "biomesoplenty:fleshchunk"));
}
}
if (event.getName().equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST))
{
LootPool main = event.getTable().getPool("main");
if (main != null)
{
main.addEntry(new LootEntryItem(BOPItems.pear, 4, 2, new LootFunction[0], new LootCondition[0], "biomesoplenty:pear"));
main.addEntry(new LootEntryItem(BOPItems.peach, 4, 2, new LootFunction[0], new LootCondition[0], "biomesoplenty:peach"));
}
}
if (event.getName().equals(LootTableList.CHESTS_VILLAGE_BLACKSMITH))
{
LootPool main = event.getTable().getPool("main");
if (main != null)
{
main.addEntry(new LootEntryItem(BOPItems.flippers, 2, 1, new LootFunction[0], new LootCondition[0], "biomesoplenty:flippers"));
main.addEntry(new LootEntryItem(BOPItems.wading_boots, 2, 1, new LootFunction[0], new LootCondition[0], "biomesoplenty:wading_boots"));
}
}
}
}

View file

@ -0,0 +1,42 @@
package biomesoplenty.common.handler;
import biomesoplenty.api.biome.BOPBiomes;
import biomesoplenty.common.block.BlockBOPLog;
import biomesoplenty.common.block.BlockBOPPlanks;
import biomesoplenty.common.block.BlockBOPWoodStairs;
import biomesoplenty.common.enums.BOPWoods;
import net.minecraft.block.BlockStairs;
import net.minecraft.init.Blocks;
import net.minecraftforge.event.terraingen.BiomeEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class VillageMaterialEventHandler
{
@SubscribeEvent
public void getVillageBlockID(BiomeEvent.GetVillageBlockID event)
{
//Coniferous Forest
if (event.getBiome() == BOPBiomes.coniferous_forest.get())
{
//Planks
if (event.getOriginal().getBlock() == Blocks.PLANKS)
{
event.setReplacement(BlockBOPPlanks.paging.getVariantState(BOPWoods.FIR));
event.setResult(Result.DENY);
}
//Logs
if (event.getOriginal().getBlock() == Blocks.LOG)
{
event.setReplacement(BlockBOPLog.paging.getVariantState(BOPWoods.FIR));
event.setResult(Result.DENY);
}
if (event.getOriginal().getBlock() == Blocks.OAK_STAIRS)
{
int meta = BlockStairs.getStateId(event.getOriginal());
event.setReplacement(BlockBOPWoodStairs.getBlock(BOPWoods.FIR).getStateFromMeta(meta));
event.setResult(Result.DENY);
}
}
}
}

View file

@ -27,6 +27,7 @@ public class ModHandlers
DecorateBiomeEventHandler decorateBiomeHandler = new DecorateBiomeEventHandler();
MinecraftForge.EVENT_BUS.register(decorateBiomeHandler);
MinecraftForge.TERRAIN_GEN_BUS.register(decorateBiomeHandler);
//MinecraftForge.TERRAIN_GEN_BUS.register(new VillageMaterialEventHandler());
MinecraftForge.ORE_GEN_BUS.register(decorateBiomeHandler);
MinecraftForge.EVENT_BUS.register(new DyeEventHandler());
MinecraftForge.EVENT_BUS.register(new FlippersEventHandler());
@ -38,6 +39,7 @@ public class ModHandlers
MinecraftForge.EVENT_BUS.register(new AchievementEventHandler());
MinecraftForge.EVENT_BUS.register(new GrassPathEventHandler());
MinecraftForge.EVENT_BUS.register(new SheepEventHandler());
MinecraftForge.EVENT_BUS.register(new LootTableEventHandler());
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
{