Re-implemented village structures

Villager and chest still to go
This commit is contained in:
Ellpeck 2016-05-07 12:55:59 +02:00
parent 95fa796e92
commit 4b548dd0a9
7 changed files with 185 additions and 156 deletions

View file

@ -13,6 +13,7 @@ package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
public class InitVillager{ public class InitVillager{
@ -42,15 +43,14 @@ public class InitVillager{
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, 1, i), 1, 1, 10)); ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, 1, i), 1, 1, 10));
} }
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.glass_bottle), 1, 2, 30)); ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.glass_bottle), 1, 2, 30));
ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.potionitem), 1, 1, 20)); ChestGenHooks.addItem(JAM_HOUSE_CHEST_NAME, new WeightedRandomChestContent(new ItemStack(Items.potionitem), 1, 1, 20));*/
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler()); VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID+":jamHouseStructure");*/ MapGenStructureIO.registerStructureComponent(VillageComponentJamHouse.class, ModUtil.MOD_ID+":jamHouseStructure");
} }
private static void initCustomCropFieldPart(){ private static void initCustomCropFieldPart(){
//TODO Fix village VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
//VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
MapGenStructureIO.registerStructureComponent(VillageComponentCustomCropField.class, ModUtil.MOD_ID+":customCropFieldStructure"); MapGenStructureIO.registerStructureComponent(VillageComponentCustomCropField.class, ModUtil.MOD_ID+":customCropFieldStructure");
} }

View file

@ -23,7 +23,6 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
//TODO Fix the villager
public class JamVillagerTradeHandler{ public class JamVillagerTradeHandler{
private ArrayList<Trade> trades = new ArrayList<Trade>(); private ArrayList<Trade> trades = new ArrayList<Trade>();
@ -49,7 +48,6 @@ public class JamVillagerTradeHandler{
this.trades.add(new Trade(stack, minSize, maxSize)); this.trades.add(new Trade(stack, minSize, maxSize));
} }
//TODO Fix the Villager
//@Override //@Override
@SuppressWarnings("all") @SuppressWarnings("all")
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){ public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){

View file

@ -10,8 +10,20 @@
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;
import java.util.List;
import java.util.Random;
public class VillageComponentCustomCropField extends StructureVillagePieces.House1{ public class VillageComponentCustomCropField extends StructureVillagePieces.House1{
private static final int xSize = 13; private static final int xSize = 13;
@ -25,13 +37,12 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
} }
//TODO Fix village public VillageComponentCustomCropField(StructureBoundingBox boundingBox, EnumFacing par5){
/*public VillageComponentCustomCropField(StructureBoundingBox boundingBox, int par5){ this.setCoordBaseMode(par5);
this.coordBaseMode = par5;
this.boundingBox = boundingBox; this.boundingBox = boundingBox;
} }
public static VillageComponentCustomCropField buildComponent(List pieces, int p1, int p2, int p3, int p4){ public static VillageComponentCustomCropField buildComponent(List pieces, int p1, int p2, int p3, EnumFacing p4){
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4); StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentCustomCropField(boundingBox, p4) : null; return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentCustomCropField(boundingBox, p4) : null;
} }
@ -46,13 +57,13 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0); this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
} }
this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.air); this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.AIR);
this.spawnActualHouse(world, rand, sbb); this.spawnActualHouse(world, rand, sbb);
for(int i = 0; i < xSize; i++){ for(int i = 0; i < xSize; i++){
for(int j = 0; j < zSize; j++){ for(int j = 0; j < zSize; j++){
this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb); this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb);
this.func_151554_b(world, Blocks.dirt, 0, i, -1, j, sbb); this.replaceAirAndLiquidDownwards(world, Blocks.DIRT.getDefaultState(), i, -1, j, sbb);
} }
} }
@ -60,44 +71,45 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
} }
public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){ public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){
this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block, block, false); this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block.getDefaultState(), block.getDefaultState(), false);
} }
public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){ public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){
this.fillWithBlocks(world, sbb, 1, 0, 1, 2, 0, 7, Blocks.farmland); this.fillWithBlocks(world, sbb, 1, 0, 1, 2, 0, 7, Blocks.FARMLAND);
this.fillWithBlocks(world, sbb, 4, 0, 1, 5, 0, 7, Blocks.farmland); this.fillWithBlocks(world, sbb, 4, 0, 1, 5, 0, 7, Blocks.FARMLAND);
this.fillWithBlocks(world, sbb, 7, 0, 1, 8, 0, 7, Blocks.farmland); this.fillWithBlocks(world, sbb, 7, 0, 1, 8, 0, 7, Blocks.FARMLAND);
this.fillWithBlocks(world, sbb, 10, 0, 1, 11, 0, 7, Blocks.farmland); this.fillWithBlocks(world, sbb, 10, 0, 1, 11, 0, 7, Blocks.FARMLAND);
this.fillWithBlocks(world, sbb, 0, 0, 0, 0, 0, 8, Blocks.log); this.fillWithBlocks(world, sbb, 0, 0, 0, 0, 0, 8, Blocks.LOG);
this.fillWithBlocks(world, sbb, 6, 0, 0, 6, 0, 8, Blocks.log); this.fillWithBlocks(world, sbb, 6, 0, 0, 6, 0, 8, Blocks.LOG);
this.fillWithBlocks(world, sbb, 12, 0, 0, 12, 0, 8, Blocks.log); this.fillWithBlocks(world, sbb, 12, 0, 0, 12, 0, 8, Blocks.LOG);
this.fillWithBlocks(world, sbb, 1, 0, 0, 11, 0, 0, Blocks.log); this.fillWithBlocks(world, sbb, 1, 0, 0, 11, 0, 0, Blocks.LOG);
this.fillWithBlocks(world, sbb, 1, 0, 8, 11, 0, 8, Blocks.log); this.fillWithBlocks(world, sbb, 1, 0, 8, 11, 0, 8, Blocks.LOG);
this.fillWithBlocks(world, sbb, 3, 0, 1, 3, 0, 7, Blocks.water); this.fillWithBlocks(world, sbb, 3, 0, 1, 3, 0, 7, Blocks.WATER);
this.fillWithBlocks(world, sbb, 9, 0, 1, 9, 0, 7, Blocks.water); this.fillWithBlocks(world, sbb, 9, 0, 1, 9, 0, 7, Blocks.WATER);
for(int i = 1; i <= 7; ++i){ for(int i = 1; i <= 7; ++i){
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 1, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 1, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 2, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 2, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 4, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 4, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 5, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 5, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 7, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 7, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 8, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 8, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 10, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 10, 1, i, sbb);
this.placeBlockAtCurrentPosition(world, this.getRandomCropType(rand), MathHelper.getRandomIntegerInRange(rand, 1, 7), 11, 1, i, sbb); this.setBlockState(world, this.getRandomCropType(rand), 11, 1, i, sbb);
} }
} }
private Block getRandomCropType(Random rand){ private IBlockState getRandomCropType(Random rand){
int randomMeta = MathHelper.getRandomIntegerInRange(rand, 1, 7);
switch(rand.nextInt(4)){ switch(rand.nextInt(4)){
case 0: case 0:
return InitBlocks.blockFlax; return InitBlocks.blockFlax.getStateFromMeta(randomMeta);
case 1: case 1:
return InitBlocks.blockCoffee; return InitBlocks.blockCoffee.getStateFromMeta(randomMeta);
case 2: case 2:
return InitBlocks.blockRice; return InitBlocks.blockRice.getStateFromMeta(randomMeta);
default: default:
return InitBlocks.blockCanola; return InitBlocks.blockCanola.getStateFromMeta(randomMeta);
}
} }
}*/
} }

View file

@ -10,8 +10,23 @@
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigIntValues;
import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;
import java.util.List;
import java.util.Random;
public class VillageComponentJamHouse extends StructureVillagePieces.House1{ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
private static final int xSize = 11; private static final int xSize = 11;
@ -25,13 +40,12 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
} }
//TODO Fix village public VillageComponentJamHouse(StructureBoundingBox boundingBox, EnumFacing par5){
/*public VillageComponentJamHouse(StructureBoundingBox boundingBox, int par5){ this.setCoordBaseMode(par5);
this.coordBaseMode = par5;
this.boundingBox = boundingBox; this.boundingBox = boundingBox;
} }
public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, int p4){ public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, EnumFacing p4){
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4); StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize, ySize, zSize, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null; return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null;
} }
@ -46,13 +60,13 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0); this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
} }
this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.air); this.fillWithBlocks(world, sbb, 0, 0, 0, xSize-1, ySize-1, zSize-1, Blocks.AIR);
this.spawnActualHouse(world, rand, sbb); this.spawnActualHouse(world, rand, sbb);
for(int i = 0; i < xSize; i++){ for(int i = 0; i < xSize; i++){
for(int j = 0; j < zSize; j++){ for(int j = 0; j < zSize; j++){
this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb); this.clearCurrentPositionBlocksUpwards(world, i, ySize, j, sbb);
this.func_151554_b(world, Blocks.cobblestone, 0, i, -1, j, sbb); this.replaceAirAndLiquidDownwards(world, Blocks.COBBLESTONE.getDefaultState(), i, -1, j, sbb);
} }
} }
@ -62,131 +76,133 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
} }
public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){ public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){
this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block, block, false); this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block.getDefaultState(), block.getDefaultState(), false);
} }
public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){ public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){
//Base //Base
this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.grass); this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.GRASS);
this.fillWithBlocks(world, sbb, 0, 0, 0, 1, 0, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 0, 0, 0, 1, 0, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 2, 0, 0, 4, 0, 1, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 2, 0, 0, 4, 0, 1, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 9, 0, 0, 10, 0, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 9, 0, 0, 10, 0, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 6, 0, 0, 8, 0, 1, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 6, 0, 0, 8, 0, 1, Blocks.COBBLESTONE);
this.placeBlockAtCurrentPosition(world, Blocks.stone_stairs, this.getMetadataWithOffset(Blocks.stone_stairs, 3), 5, 0, 0, sbb); this.setBlockState(world, Blocks.STONE_STAIRS.getStateFromMeta(3), 5, 0, 0, sbb);
this.fillWithBlocks(world, sbb, 2, 0, 7, 3, 0, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 2, 0, 7, 3, 0, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 5, 0, 7, 8, 0, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 5, 0, 7, 8, 0, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 10, 0, 8, 10, 0, 11, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 10, 0, 8, 10, 0, 11, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 0, 0, 8, 0, 0, 11, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 0, 0, 8, 0, 0, 11, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 0, 11, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 0, 11, Blocks.COBBLESTONE);
this.fillWithMetadataBlocks(world, sbb, 2, 0, 2, 8, 0, 6, Blocks.planks, 1, Blocks.planks, 1, false); this.fillWithBlocks(world, sbb, 2, 0, 2, 8, 0, 6, Blocks.PLANKS.getStateFromMeta(1), Blocks.PLANKS.getStateFromMeta(1), false);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 5, 0, 1, sbb); this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(1), 5, 0, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 4, 0, 7, sbb); this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(1), 4, 0, 7, sbb);
//Garden Fence //Garden FENCE
this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 1, 11, Blocks.fence); this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 1, 11, Blocks.OAK_FENCE);
this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 1, 11, Blocks.fence); this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 1, 11, Blocks.OAK_FENCE);
this.fillWithBlocks(world, sbb, 1, 1, 11, 9, 1, 11, Blocks.fence); this.fillWithBlocks(world, sbb, 1, 1, 11, 9, 1, 11, Blocks.OAK_FENCE);
//Side Walls //Side Walls
for(int i = 0; i < 2; i++){ for(int i = 0; i < 2; i++){
this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 1, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 1, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 4, 1, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 4, 1, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 1+i*8, 1, 7, 1+i*8, 4, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 1+i*8, 1, 7, 1+i*8, 4, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 1+i*8, 4, 2, 1+i*8, 5, 6, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 1+i*8, 4, 2, 1+i*8, 5, 6, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 1+i*8, 3, 2, 1+i*8, 3, 6, Blocks.planks); this.fillWithBlocks(world, sbb, 1+i*8, 3, 2, 1+i*8, 3, 6, Blocks.PLANKS);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i*8, 2, 2, sbb); this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(0), 1+i*8, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i*8, 2, 6, sbb); this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(0), 1+i*8, 2, 6, sbb);
this.fillWithBlocks(world, sbb, 1+i*8, 2, 3, 1+i*8, 2, 5, Blocks.glass_pane); this.fillWithBlocks(world, sbb, 1+i*8, 2, 3, 1+i*8, 2, 5, Blocks.GLASS_PANE);
} }
//Front Wall //Front Wall
this.fillWithBlocks(world, sbb, 7, 1, 1, 8, 4, 1, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 7, 1, 1, 8, 4, 1, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 2, 1, 1, 3, 4, 1, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 2, 1, 1, 3, 4, 1, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 4, 4, 1, 7, 4, 1, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 4, 4, 1, 7, 4, 1, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 6, 1, 1, 6, 3, 1, Blocks.planks); this.fillWithBlocks(world, sbb, 6, 1, 1, 6, 3, 1, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 4, 1, 1, 4, 3, 1, Blocks.planks); this.fillWithBlocks(world, sbb, 4, 1, 1, 4, 3, 1, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 5, 3, 1, 5, 3, 1, Blocks.planks); this.fillWithBlocks(world, sbb, 5, 3, 1, 5, 3, 1, Blocks.PLANKS);
this.placeDoorAtCurrentPosition(world, sbb, rand, 5, 1, 1, this.getMetadataWithOffset(Blocks.wooden_door, 1)); this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState(), 5, 1, 1, sbb);
this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 5, 2, 1, sbb);
//Back Wall //Back Wall
this.fillWithBlocks(world, sbb, 2, 1, 7, 2, 4, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 2, 1, 7, 2, 4, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 3, 1, 7, 3, 3, 7, Blocks.planks); this.fillWithBlocks(world, sbb, 3, 1, 7, 3, 3, 7, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 4, 3, 7, 8, 3, 7, Blocks.planks); this.fillWithBlocks(world, sbb, 4, 3, 7, 8, 3, 7, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 3, 4, 7, 8, 4, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 3, 4, 7, 8, 4, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 5, 1, 7, 5, 2, 7, Blocks.planks); this.fillWithBlocks(world, sbb, 5, 1, 7, 5, 2, 7, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 6, 1, 7, 8, 1, 7, Blocks.cobblestone); this.fillWithBlocks(world, sbb, 6, 1, 7, 8, 1, 7, Blocks.COBBLESTONE);
this.fillWithBlocks(world, sbb, 6, 2, 7, 7, 2, 7, Blocks.glass_pane); this.fillWithBlocks(world, sbb, 6, 2, 7, 7, 2, 7, Blocks.GLASS_PANE);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 8, 2, 7, sbb); this.setBlockState(world, Blocks.PLANKS.getStateFromMeta(0), 8, 2, 7, sbb);
this.placeDoorAtCurrentPosition(world, sbb, rand, 4, 1, 7, this.getMetadataWithOffset(Blocks.wooden_door, 1)); this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.SOUTH), 4, 1, 7, sbb);
this.setBlockState(world, Blocks.SPRUCE_DOOR.getDefaultState().withProperty(BlockDoor.FACING, EnumFacing.SOUTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 4, 2, 7, sbb);
//Fence Supports //FENCE Supports
this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 3, 8, Blocks.fence); this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 3, 8, Blocks.OAK_FENCE);
this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 3, 8, Blocks.fence); this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 3, 8, Blocks.OAK_FENCE);
this.fillWithBlocks(world, sbb, 0, 1, 0, 0, 3, 0, Blocks.fence); this.fillWithBlocks(world, sbb, 0, 1, 0, 0, 3, 0, Blocks.OAK_FENCE);
this.fillWithBlocks(world, sbb, 10, 1, 0, 10, 3, 0, Blocks.fence); this.fillWithBlocks(world, sbb, 10, 1, 0, 10, 3, 0, Blocks.OAK_FENCE);
//Roof //Roof
this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.planks); this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.PLANKS);
this.fillWithMetadataBlocks(world, sbb, 0, 4, 0, 10, 4, 0, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false); IBlockState stairSouth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH);
this.fillWithMetadataBlocks(world, sbb, 0, 5, 1, 10, 5, 1, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false); IBlockState stairNorth = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH);
this.fillWithMetadataBlocks(world, sbb, 0, 6, 2, 10, 6, 2, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false); this.fillWithBlocks(world, sbb, 0, 4, 0, 10, 4, 0, stairNorth, stairNorth, false);
this.fillWithMetadataBlocks(world, sbb, 0, 4, 8, 10, 4, 8, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false); this.fillWithBlocks(world, sbb, 0, 5, 1, 10, 5, 1, stairNorth, stairNorth, false);
this.fillWithMetadataBlocks(world, sbb, 0, 5, 7, 10, 5, 7, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false); this.fillWithBlocks(world, sbb, 0, 6, 2, 10, 6, 2, stairNorth, stairNorth, false);
this.fillWithMetadataBlocks(world, sbb, 0, 6, 6, 10, 6, 6, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false); this.fillWithBlocks(world, sbb, 0, 4, 8, 10, 4, 8, stairSouth, stairSouth, false);
this.fillWithBlocks(world, sbb, 0, 7, 3, 10, 7, 5, Blocks.wooden_slab); this.fillWithBlocks(world, sbb, 0, 5, 7, 10, 5, 7, stairSouth, stairSouth, false);
this.fillWithBlocks(world, sbb, 0, 6, 6, 10, 6, 6, stairSouth, stairSouth, false);
this.fillWithBlocks(world, sbb, 0, 7, 3, 10, 7, 5, Blocks.WOODEN_SLAB);
//Roof Gadgets //Roof Gadgets
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 1, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 4, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 2, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 5, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 1, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 4, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 2, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 5, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 7, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 4, 7, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 6, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 0, 5, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 7, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 4, 7, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 6, sbb); this.setBlockState(world, Blocks.PLANKS.getDefaultState(), 10, 5, 6, sbb);
this.fillWithBlocks(world, sbb, 0, 6, 3, 0, 6, 5, Blocks.planks); this.fillWithBlocks(world, sbb, 0, 6, 3, 0, 6, 5, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 10, 6, 3, 10, 6, 5, Blocks.planks); this.fillWithBlocks(world, sbb, 10, 6, 3, 10, 6, 5, Blocks.PLANKS);
//Counter //Counter
this.fillWithMetadataBlocks(world, sbb, 6, 3, 2, 6, 3, 4, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false); this.fillWithBlocks(world, sbb, 6, 3, 2, 6, 3, 4, Blocks.WOODEN_SLAB.getStateFromMeta(8), Blocks.WOODEN_SLAB.getStateFromMeta(8), false);
this.fillWithMetadataBlocks(world, sbb, 5, 3, 4, 5, 3, 6, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false); this.fillWithBlocks(world, sbb, 5, 3, 4, 5, 3, 6, Blocks.WOODEN_SLAB.getStateFromMeta(8), Blocks.WOODEN_SLAB.getStateFromMeta(8), false);
this.fillWithBlocks(world, sbb, 6, 1, 2, 6, 1, 4, Blocks.planks); this.fillWithBlocks(world, sbb, 6, 1, 2, 6, 1, 4, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 5, 1, 4, 5, 1, 5, Blocks.planks); this.fillWithBlocks(world, sbb, 5, 1, 4, 5, 1, 5, Blocks.PLANKS);
this.fillWithBlocks(world, sbb, 6, 4, 2, 6, 5, 2, Blocks.fence); this.fillWithBlocks(world, sbb, 6, 4, 2, 6, 5, 2, Blocks.OAK_FENCE);
this.fillWithBlocks(world, sbb, 5, 4, 4, 5, 5, 4, Blocks.fence); this.fillWithBlocks(world, sbb, 5, 4, 4, 5, 5, 4, Blocks.OAK_FENCE);
this.fillWithBlocks(world, sbb, 5, 4, 6, 5, 5, 6, Blocks.fence); this.fillWithBlocks(world, sbb, 5, 4, 6, 5, 5, 6, Blocks.OAK_FENCE);
//Decoration //Decoration
this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 2, sbb); this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 2, 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 2, sbb); this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 2, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 8, 1, 2, sbb); this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 8, 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 8, 2, 2, sbb); this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 8, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 6, sbb); this.setBlockState(world, Blocks.OAK_FENCE.getDefaultState(), 2, 1, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 6, sbb); this.setBlockState(world, Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.DECAYABLE, false), 2, 2, 6, sbb);
this.fillWithMetadataBlocks(world, sbb, 2, 1, 3, 2, 1, 5, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), false); IBlockState stairWest = Blocks.OAK_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST);
this.fillWithMetadataBlocks(world, sbb, 3, 1, 2, 5, 1, 3, Blocks.carpet, 10, Blocks.carpet, 10, false); this.fillWithBlocks(world, sbb, 2, 1, 3, 2, 1, 5, stairWest, stairWest, false);
this.fillWithMetadataBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.carpet, 10, Blocks.carpet, 10, false); this.fillWithBlocks(world, sbb, 3, 1, 2, 5, 1, 3, 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
this.placeBlockAtCurrentPosition(world, Blocks.chest, 0, 8, 1, 6, sbb); this.setBlockState(world, Blocks.CHEST.getDefaultState(), 8, 1, 6, sbb);
TileEntity chest = world.getTileEntity(this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6)); TileEntity chest = world.getTileEntity(new BlockPos(this.getXWithOffset(8, 6), this.getYWithOffset(1), this.getZWithOffset(8, 6)));
if(chest != null && chest instanceof TileEntityChest){ //TODO Chest content
/*if(chest != null && chest instanceof TileEntityChest){
WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(InitVillager.JAM_HOUSE_CHEST_NAME, rand), (TileEntityChest)chest, ChestGenHooks.getCount(InitVillager.JAM_HOUSE_CHEST_NAME, rand)); WeightedRandomChestContent.generateChestContents(rand, ChestGenHooks.getItems(InitVillager.JAM_HOUSE_CHEST_NAME, rand), (TileEntityChest)chest, ChestGenHooks.getCount(InitVillager.JAM_HOUSE_CHEST_NAME, rand));
} }*/
//Torches //Torches
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 2, 0, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 4, 2, 0, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 4, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 2, 8, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 5, 2, 8, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 2, 8, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 3, 2, 8, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 2, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST), 2, 3, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 6, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.EAST), 2, 3, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 2, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST), 8, 3, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 6, sbb); this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.WEST), 8, 3, 6, sbb);
} }
@Override
protected int getVillagerType(int par1){
return ConfigIntValues.JAM_VILLAGER_ID.getValue();
}*/
} }

View file

@ -10,13 +10,15 @@
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry; import net.minecraftforge.fml.common.registry.VillagerRegistry;
import java.util.List;
import java.util.Random; import java.util.Random;
//TODO Fix village public class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageCreationHandler{
public abstract class VillageCustomCropFieldHandler implements VillagerRegistry.IVillageCreationHandler{
@Override @Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){ public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){
@ -28,8 +30,8 @@ public abstract class VillageCustomCropFieldHandler implements VillagerRegistry.
return VillageComponentCustomCropField.class; return VillageComponentCustomCropField.class;
} }
/*@Override @Override
public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){ public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5){
return VillageComponentCustomCropField.buildComponent(pieces, p1, p2, p3, p4); return VillageComponentCustomCropField.buildComponent(pieces, p1, p2, p3, facing);
}*/ }
} }

View file

@ -10,13 +10,15 @@
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;
import net.minecraftforge.fml.common.registry.VillagerRegistry; import net.minecraftforge.fml.common.registry.VillagerRegistry;
import java.util.List;
import java.util.Random; import java.util.Random;
//TODO Fix village public class VillageJamHouseHandler implements VillagerRegistry.IVillageCreationHandler{
public abstract class VillageJamHouseHandler implements VillagerRegistry.IVillageCreationHandler{
@Override @Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){ public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){
@ -28,8 +30,8 @@ public abstract class VillageJamHouseHandler implements VillagerRegistry.IVillag
return VillageComponentJamHouse.class; return VillageComponentJamHouse.class;
} }
/*@Override @Override
public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){ public StructureVillagePieces.Village buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5){
return VillageComponentJamHouse.buildComponent(pieces, p1, p2, p3, p4); return VillageComponentJamHouse.buildComponent(pieces, p1, p2, p3, facing);
}*/ }
} }

View file

@ -145,7 +145,6 @@ public class ClientProxy implements IProxy{
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAtomicReconstructor.class, new RenderReconstructorLens()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAtomicReconstructor.class, new RenderReconstructorLens());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySmileyCloud.class, new RenderSmileyCloud());
//TODO Fix villager, doesn't work in this Version of Forge
//VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID, "textures/entity/villager/jamVillager.png")); //VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID, "textures/entity/villager/jamVillager.png"));
for(Item item : colorProdividingItemsForRegistering){ for(Item item : colorProdividingItemsForRegistering){