Made dungeon loot config also disable loot in villages

This commit is contained in:
Ellpeck 2016-11-21 20:16:13 +01:00
parent 8b96a8b73c
commit dd710b4dbe
4 changed files with 48 additions and 41 deletions

View file

@ -43,7 +43,7 @@ public enum ConfigBoolValues{
SHOW_BOOKLET_INFO("Booklet Quick Opening Info", ConfigCategories.TOOL_VALUES, true, "If true,'Press key for more information' text should show when the item has a page in the booklet"), SHOW_BOOKLET_INFO("Booklet Quick Opening Info", ConfigCategories.TOOL_VALUES, true, "If true,'Press key for more information' text should show when the item has a page in the booklet"),
GIVE_BOOKLET_ON_FIRST_CRAFT("Give Booklet on First Craft", ConfigCategories.OTHER, true, "If true, the booklet should be given to the player when he first crafts something from the Mod"), GIVE_BOOKLET_ON_FIRST_CRAFT("Give Booklet on First Craft", ConfigCategories.OTHER, true, "If true, the booklet should be given to the player when he first crafts something from the Mod"),
DUNGEON_LOOT("Dungeon Loot", ConfigCategories.OTHER, true, "Should Actually Additions Loot generate in dungeons??"), DUNGEON_LOOT("Village and Dungeon Loot", ConfigCategories.OTHER, true, "Should Actually Additions Loot generate in dungeons? (This also disables loot in lush caves and village houses!)"),
GEN_LUSH_CAVES("Generate Lush Caves", ConfigCategories.WORLD_GEN, true, "Should caves with trees and grass randomly generate underground?"), GEN_LUSH_CAVES("Generate Lush Caves", ConfigCategories.WORLD_GEN, true, "Should caves with trees and grass randomly generate underground?"),
WATER_BOWL("Water Bowl", ConfigCategories.OTHER, true, "Should right-clicking a bowl on water blocks create a water bowl?"), WATER_BOWL("Water Bowl", ConfigCategories.OTHER, true, "Should right-clicking a bowl on water blocks create a water bowl?"),

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot; import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -95,7 +96,7 @@ public class WorldGenLushCaves{
} }
trees.generate(world, rand, pos.up()); trees.generate(world, rand, pos.up());
if(!crateGenDone && genCrate){ if(ConfigBoolValues.DUNGEON_LOOT.isEnabled() && !crateGenDone && genCrate){
BlockPos cratePos = pos.add(MathHelper.getRandomIntegerInRange(rand, -2, 2), MathHelper.getRandomIntegerInRange(rand, 3, 8), MathHelper.getRandomIntegerInRange(rand, -2, 2)); BlockPos cratePos = pos.add(MathHelper.getRandomIntegerInRange(rand, -2, 2), MathHelper.getRandomIntegerInRange(rand, 3, 8), MathHelper.getRandomIntegerInRange(rand, -2, 2));
IBlockState state = world.getBlockState(cratePos); IBlockState state = world.getBlockState(cratePos);

View file

@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.api.laser.LaserType;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager; import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
@ -102,46 +103,50 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
} }
private void fillHouse(World world, StructureBoundingBox sbb){ private void fillHouse(World world, StructureBoundingBox sbb){
if(world.rand.nextBoolean()){ if(ConfigBoolValues.DUNGEON_LOOT.isEnabled()){
TileEntity compost = this.getTileAtPos(world, 6, 1, 2, sbb); if(world.rand.nextBoolean()){
if(compost instanceof TileEntityCompost){ TileEntity compost = this.getTileAtPos(world, 6, 1, 2, sbb);
((TileEntityCompost)compost).setInventorySlotContents(0, new ItemStack(InitItems.itemFertilizer, 10)); if(compost instanceof TileEntityCompost){
((TileEntityCompost)compost).setInventorySlotContents(0, new ItemStack(InitItems.itemFertilizer, 10));
}
} }
}
TileEntity ferment = this.getTileAtPos(world, 11, 1, 0, sbb); TileEntity ferment = this.getTileAtPos(world, 11, 1, 0, sbb);
if(ferment instanceof TileEntityFermentingBarrel){ if(ferment instanceof TileEntityFermentingBarrel){
TileEntityFermentingBarrel tile = (TileEntityFermentingBarrel)ferment; TileEntityFermentingBarrel tile = (TileEntityFermentingBarrel)ferment;
tile.canolaTank.setFluid(new FluidStack(InitFluids.fluidCanolaOil, world.rand.nextInt(1500)+200)); tile.canolaTank.setFluid(new FluidStack(InitFluids.fluidCanolaOil, world.rand.nextInt(1500)+200));
}
TileEntity coffee = this.getTileAtPos(world, 4, 2, 6, sbb);
if(coffee instanceof TileEntityCoffeeMachine){
TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine)coffee;
tile.tank.setFluid(new FluidStack(FluidRegistry.WATER, world.rand.nextInt(3000)+500));
tile.coffeeCacheAmount = world.rand.nextInt(150);
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2));
}
TileEntity press = this.getTileAtPos(world, 2, 1, 5, sbb);
if(press instanceof TileEntityCanolaPress){
TileEntityCanolaPress tile = (TileEntityCanolaPress)press;
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/3));
tile.setInventorySlotContents(0, new ItemStack(InitItems.itemMisc, world.rand.nextInt(60)+1, TheMiscItems.CANOLA.ordinal()));
}
TileEntity crusher = this.getTileAtPos(world, 2, 1, 6, sbb);
if(crusher instanceof TileEntityGrinder){
TileEntityGrinder tile = (TileEntityGrinder)crusher;
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2));
if(world.rand.nextFloat() >= 0.25F){
tile.setInventorySlotContents(TileEntityGrinder.SLOT_INPUT_1, new ItemStack(InitBlocks.blockMisc, world.rand.nextInt(10)+1, TheMiscBlocks.ORE_QUARTZ.ordinal()));
} }
}
TileEntity coal = this.getTileAtPos(world, 5, 5, 6, sbb); TileEntity coffee = this.getTileAtPos(world, 4, 2, 6, sbb);
if(coal instanceof TileEntityCoalGenerator){ if(coffee instanceof TileEntityCoffeeMachine){
((TileEntityCoalGenerator)coal).setInventorySlotContents(0, new ItemStack(Items.COAL, world.rand.nextInt(25)+3, 1)); TileEntityCoffeeMachine tile = (TileEntityCoffeeMachine)coffee;
tile.tank.setFluid(new FluidStack(FluidRegistry.WATER, world.rand.nextInt(3000)+500));
tile.coffeeCacheAmount = world.rand.nextInt(150);
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2));
}
TileEntity press = this.getTileAtPos(world, 2, 1, 5, sbb);
if(press instanceof TileEntityCanolaPress){
TileEntityCanolaPress tile = (TileEntityCanolaPress)press;
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/3));
tile.setInventorySlotContents(0, new ItemStack(InitItems.itemMisc, world.rand.nextInt(60)+1, TheMiscItems.CANOLA.ordinal()));
}
TileEntity crusher = this.getTileAtPos(world, 2, 1, 6, sbb);
if(crusher instanceof TileEntityGrinder){
TileEntityGrinder tile = (TileEntityGrinder)crusher;
tile.storage.setEnergyStored(world.rand.nextInt(tile.storage.getMaxEnergyStored()/2));
if(world.rand.nextFloat() >= 0.25F){
tile.setInventorySlotContents(TileEntityGrinder.SLOT_INPUT_1, new ItemStack(InitBlocks.blockMisc, world.rand.nextInt(10)+1, TheMiscBlocks.ORE_QUARTZ.ordinal()));
}
}
TileEntity coal = this.getTileAtPos(world, 5, 5, 6, sbb);
if(coal instanceof TileEntityCoalGenerator){
((TileEntityCoalGenerator)coal).setInventorySlotContents(0, new ItemStack(Items.COAL, world.rand.nextInt(25)+3, 1));
}
VillageComponentJamHouse.generateCrate(world, sbb, this.getXWithOffset(6, 4), this.getYWithOffset(4), this.getZWithOffset(6, 4), DungeonLoot.ENGINEER_HOUSE);
} }
TileEntity firstRelay = this.getTileAtPos(world, 6, 5, 6, sbb); TileEntity firstRelay = this.getTileAtPos(world, 6, 5, 6, sbb);
@ -152,8 +157,6 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
int meta = world.rand.nextInt(TheColoredLampColors.values().length); int meta = world.rand.nextInt(TheColoredLampColors.values().length);
this.setBlockState(world, InitBlocks.blockColoredLampOn.getStateFromMeta(meta), 8, 1, 6, sbb); this.setBlockState(world, InitBlocks.blockColoredLampOn.getStateFromMeta(meta), 8, 1, 6, sbb);
VillageComponentJamHouse.generateCrate(world, sbb, this.getXWithOffset(6, 4), this.getYWithOffset(4), this.getZWithOffset(6, 4), DungeonLoot.ENGINEER_HOUSE);
} }
private void spawnActualHouse(World world, StructureBoundingBox sbb){ private void spawnActualHouse(World world, StructureBoundingBox sbb){

View file

@ -11,6 +11,7 @@
package de.ellpeck.actuallyadditions.mod.gen.village.component; package de.ellpeck.actuallyadditions.mod.gen.village.component;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager; import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot; import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
@ -190,7 +191,9 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
this.fillWithBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false); this.fillWithBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.CARPET.getStateFromMeta(10), Blocks.CARPET.getStateFromMeta(10), false);
//Loot Chest //Loot Chest
generateCrate(world, this.boundingBox, this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6), DungeonLoot.JAM_HOUSE); if(ConfigBoolValues.DUNGEON_LOOT.isEnabled()){
generateCrate(world, this.boundingBox, this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6), DungeonLoot.JAM_HOUSE);
}
//Torches //Torches
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 2, 0, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 2, 0, sbb);