Java 类net.minecraft.world.gen.structure.StructureVillagePieces.PieceWeight 实例源码

项目:Structures    文件:CreationHandler.java   
@SuppressWarnings("rawtypes")
@Override
public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, int x, int y, int z, int coordBaseMode, int p5) {


  IStructureTemplate template = null;
  if(startPiece.inDesert && !desertTemplates.isEmpty()) {
    template = WeightedTemplate.getTemplate(desertTemplates);      
  } 
  if(template == null) {
    template = WeightedTemplate.getTemplate(templates);
  }
  if(template == null) {
    return null;
  }
  VillageHouse comp = new VillageHouse(template,villagerSpawnLocation, villagerId, x, y, z, coordBaseMode);
  VillageHouse res = canVillageGoDeeper(comp.getBoundingBox()) && StructureComponent.findIntersecting(pieces, comp.getBoundingBox()) == null
      ? comp : null;

  return res;
}
项目:Mods    文件:MannCoBuilding.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces,
        Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0,
            0, 0, 14, 16, 11, facing);
    return canVillageGoDeeper(structureboundingbox)
            && StructureComponent.findIntersecting(pieces, structureboundingbox) == null
                    ? new MannCoBuilding(startPiece, p5, random, structureboundingbox, facing) : null;
}
项目:CustomWorldGen    文件:VillagerRegistry.java   
public static void addExtraVillageComponents(List<PieceWeight> list, Random random, int i)
{
    List<StructureVillagePieces.PieceWeight> parts = list;
    for (IVillageCreationHandler handler : instance().villageCreationHandlers.values())
    {
        parts.add(handler.getVillagePieceWeight(random, i));
    }
}
项目:Coding    文件:WoodHutCreationHandler.java   
@SuppressWarnings("rawtypes")
    @Override
    public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, 
            int p1, int p2, int p3, int p4, int p5) {
//              BiomeGenBase biome = 
//                      world.getBiomeGenForCoords(startPiece.getBoundingBox().minX, startPiece.getBoundingBox().minZ);
//      if (biome != ModBiomes.biomeCityPlains)
//          return null;
        return StructureVillagePieces.WoodHut.func_74908_a(startPiece, pieces, random, p1, p2, p3, p4, p5);
    }
项目:Restructured    文件:SchematicStructureCreationHandler.java   
@Override
public Village buildComponent(final PieceWeight villagePiece, final Start startPiece,
        final List<StructureComponent> pieces, final Random random, final int x, final int y, final int z,
        final EnumFacing facing, final int type) {

    // This shouldn't happen, but just in case...
    if (!(villagePiece instanceof SchematicPieceWeight))
        return null;

    // Get our next structure
    final SchematicPieceWeight pw = (SchematicPieceWeight) villagePiece;
    final SchematicProperties props = pw.getNextStructure();

    // If we don't get properties we may have exceeded
    // the spawn limit.
    if (props == null)
        return null;

    // Bound it out
    final Dimensions size = props.schematic.getDimensions();
    final StructureBoundingBox _boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0,
            size.width, size.height, size.length, facing);

    // Check to see if the region is OK, and if so return back
    // a SchematicStructure surrogate for the schematic.
    if (canVillageGoDeeper(_boundingBox)) {
        if (StructureComponent.findIntersecting(pieces, _boundingBox) == null) {
            ModLog.debug("Village structure [%s] @(%s); mode %d", props.name, _boundingBox, facing);
            final SchematicStructure struct = new SchematicStructure(startPiece, type, random, _boundingBox,
                    facing);
            struct.setProperties(props);
            return struct;
        }
    }
    return null;
}
项目:Structures    文件:CompositeCreationHandler.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {

  int maxToSpawn = 0;
  int totalWeight = 0;
  pieceWeights = getWeightedSpawnList(random, 0);
  for (WeightedCreationHandler wch : pieceWeights) {
    maxToSpawn += wch.weight.villagePiecesLimit;
    totalWeight += wch.weight.villagePieceWeight;
  }
  return new PieceWeight(VillageHouse.class, totalWeight, maxToSpawn);
}
项目:Structures    文件:CompositeCreationHandler.java   
@SuppressWarnings("rawtypes")
@Override
public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, int x, int y, int z, int coordBaseMode, int p5) {

  int totalWeight = getTotalWieght(pieceWeights);
  if(totalWeight <= 0) {
    return null;
  }

  for (int i = 0; i < 5; ++i) {

    int randomWeight = random.nextInt(totalWeight);
    Iterator<WeightedCreationHandler> iterator = pieceWeights.iterator();

    while (iterator.hasNext()) {
      WeightedCreationHandler el = iterator.next();
      PieceWeight pieceweight = el.weight;
      randomWeight -= pieceweight.villagePieceWeight;

      if(randomWeight < 0) {
        int notUsed = 0;
        if(!pieceweight.canSpawnMoreVillagePiecesOfType(notUsed)
            || pieceweight == startPiece.structVillagePieceWeight && pieceWeights.size() > 1) {
          break;
        }
        StructureVillagePieces.Village village = (Village) el.handler.buildComponent(pieceweight, startPiece, pieces, random, x, y, z, coordBaseMode, p5);

        if(village != null) {
          ++pieceweight.villagePiecesSpawned;
          startPiece.structVillagePieceWeight = pieceweight;
          if(!pieceweight.canSpawnMoreVillagePieces()) {
            pieceWeights.remove(el);
          }
          return village;
        }
      }
    }
  }
  return null;
}
项目:Structures    文件:CompositeCreationHandler.java   
private int getTotalWieght(List<WeightedCreationHandler> handlers) {
  boolean result = false;
  int totalWeight = 0;
  StructureVillagePieces.PieceWeight pieceweight;

  for (Iterator<WeightedCreationHandler> iterator = handlers.iterator(); iterator.hasNext(); totalWeight += pieceweight.villagePieceWeight) {
    pieceweight = iterator.next().weight;

    if(pieceweight.villagePiecesLimit > 0 && pieceweight.villagePiecesSpawned < pieceweight.villagePiecesLimit) {
      result = true;
    }
  }

  return result ? totalWeight : -1;
}
项目:ThermalRecycling    文件:VendingVillageStructureHandler.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    final int weight = ModOptions.getVillageStructureWeight();
    int count = ModOptions.getVillageStructureCount();
    if(count > 1) {
        count = random.nextInt(count) + 1;
    }

    return new PieceWeight(getComponentClass(), weight, count);
}
项目:Mods    文件:MannCoBuilding.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new StructureVillagePieces.PieceWeight(MannCoBuilding.class, 15, 1);
}
项目:CustomWorldGen    文件:VillagerRegistry.java   
public static Village getVillageComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List<StructureComponent> pieces, Random random,
                                          int p1, int p2, int p3, EnumFacing facing, int p5)
{
    return instance().villageCreationHandlers.get(villagePiece.villagePieceClass).buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, facing, p5);
}
项目:Dailies    文件:VillageHandlerBailey.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(BaileysShopVillagePiece.class, 30, 1);
}
项目:Dailies    文件:VillageHandlerBailey.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces,
        Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    return BaileysShopVillagePiece.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);
}
项目:ToroQuest    文件:VillageHandlerGuardTower2.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(VillagePieceGuardTower2.class, 15, 1);
}
项目:ToroQuest    文件:VillageHandlerGuardTower2.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3,
        EnumFacing facing, int p5) {
    return VillagePieceGuardTower2.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);

}
项目:ToroQuest    文件:VillageHandlerBarracks.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(VillagePieceBarracks.class, 30, 1);
}
项目:ToroQuest    文件:VillageHandlerBarracks.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    return VillagePieceBarracks.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);

}
项目:ToroQuest    文件:VillageHandlerCabin.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(VillagePieceCabin.class, 30, 1);
}
项目:ToroQuest    文件:VillageHandlerCabin.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    return VillagePieceCabin.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);

}
项目:ToroQuest    文件:VillageHandlerGuardTower.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(VillagePieceGuardTower.class, 15, 3);
}
项目:ToroQuest    文件:VillageHandlerGuardTower.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    return VillagePieceGuardTower.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);

}
项目:ToroQuest    文件:VillageHandlerShop.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(VillagePieceShop.class, 30, 2);
}
项目:ToroQuest    文件:VillageHandlerShop.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    return VillagePieceShop.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);

}
项目:ToroQuest    文件:VillageHandlerTrophy.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(VillagePieceTrophy.class, 30, 1);
}
项目:ToroQuest    文件:VillageHandlerTrophy.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    return VillagePieceTrophy.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);

}
项目:ToroQuest    文件:VillageHandlerKeep.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(VillagePieceKeep.class, 30, 1);
}
项目:ToroQuest    文件:VillageHandlerKeep.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3,
        EnumFacing facing, int p5) {
    return VillagePieceKeep.createPiece(startPiece, pieces, random, p1, p2, p3, facing, p5);

}
项目:Toms-Mod    文件:VillageHouseScientist.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new StructureVillagePieces.PieceWeight(VillageHouseScientist.class, Config.scientistHouseWeight, i);
}
项目:Toms-Mod    文件:VillageHouseScientist.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece, List<StructureComponent> pieces, Random random, int p1, int p2, int p3, EnumFacing facing, int p5) {
    StructureBoundingBox box = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, -32 + 9, 0, 13, 11, 13, facing);
    return !Config.genScientistHouse || !(box != null && box.minY > 16) || (StructureComponent.findIntersecting(pieces, box) != null) ? null : new VillageHouseScientist(startPiece, p5, random, box, facing);
}
项目:SimpleCorn    文件:CornWorldGen.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
       return  new StructureVillagePieces.PieceWeight(ComponentCornField.class, Config.generationWeight, MathHelper.getInt(random, 2 + i, 4 + i * 2));
}
项目:SimpleCorn    文件:CornWorldGen.java   
@Override
public Village buildComponent(PieceWeight villagePiece, Start startPiece,List pieces, Random random, int x, int y, int z,EnumFacing facing, int p5) {
    return ComponentCornField.createPiece(startPiece, pieces, random, x, y, z, facing, p5);
}
项目:Coding    文件:WoodHutCreationHandler.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    // First number is likelihood of spawning, second is maximum to spawn
       return new PieceWeight(StructureVillagePieces.WoodHut.class, 20, MathHelper.getRandomIntegerInRange(random, 2 + i, 4 + i));
}
项目:Coding    文件:CatapultTowerCreationHandler.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    // First number is likelihood of spawning, second is maximum to spawn
       return new PieceWeight(CatapultTower.class, 25, MathHelper.getRandomIntegerInRange(random, 1 + i, 1 + i));
}
项目:Coding    文件:CatapultTowerCreationHandler.java   
@SuppressWarnings("rawtypes")
@Override
public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, 
        int p1, int p2, int p3, int p4, int p5) {
    return CatapultTower.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
项目:Coding    文件:GuardTowerCreationHandler.java   
@Override
    public PieceWeight getVillagePieceWeight(Random random, int i) {
//        return new PieceWeight(VillageTavern.class, 4, MathHelper.getRandomIntegerInRange(random, 0, 1));
        // First number is likelihood of spawning, second is maximum to spawn
        return new PieceWeight(VillageGuardTower.class, 15, MathHelper.getRandomIntegerInRange(random, 1 + i, 1 + i));
    }
项目:Coding    文件:GuardTowerCreationHandler.java   
@SuppressWarnings("rawtypes")
@Override
public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, 
        int p1, int p2, int p3, int p4, int p5) {
    return VillageGuardTower.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
项目:Coding    文件:House3CreationHandler.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    // First number is likelihood of spawning, second is maximum to spawn
       return new PieceWeight(StructureVillagePieces.House3.class, 20, MathHelper.getRandomIntegerInRange(random, 1 + i, 2 + i));
}
项目:Coding    文件:House3CreationHandler.java   
@SuppressWarnings("rawtypes")
@Override
public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, 
        int p1, int p2, int p3, int p4, int p5) {
    return StructureVillagePieces.House3.func_74921_a(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
项目:Coding    文件:BakeryHandler.java   
@Override
public PieceWeight getVillagePieceWeight(Random random, int i) {
    return new PieceWeight(ComponentBakery.class, 10, 1);
}
项目:Coding    文件:BakeryHandler.java   
@SuppressWarnings("rawtypes")
@Override
   public Object buildComponent(PieceWeight villagePiece, Start startPiece, List pieces, Random random, 
        int x, int y, int z, int coordBaseMode, int p5) {
       return ComponentBakery.buildComponent(startPiece, pieces, random, x, y, z, coordBaseMode, p5);
   }