use of net.minecraft.util.math.MutableBoundingBox in project minecolonies by Minecolonies.
the class BuildingManager method guardBuildingChangedAt.
@Override
public void guardBuildingChangedAt(final IBuilding guardBuilding, final int newLevel) {
final int claimRadius = guardBuilding.getClaimRadius(Math.max(guardBuilding.getBuildingLevel(), newLevel));
final MutableBoundingBox guardedRegion = BlockPosUtil.getChunkAlignedBB(guardBuilding.getPosition(), claimRadius);
for (final IBuilding building : getBuildings().values()) {
if (guardedRegion.isInside(building.getPosition())) {
building.resetGuardBuildingNear();
}
}
}
use of net.minecraft.util.math.MutableBoundingBox in project BoundingBoxOutlineReloaded by irtimaled.
the class StructureProcessor method addStructures.
private void addStructures(BoundingBoxType type, Map<String, StructureStart> structureMap) {
StructureStart structureStart = structureMap.get(type.getName());
if (structureStart == null)
return;
MutableBoundingBox bb = structureStart.getBoundingBox();
if (bb == null)
return;
AbstractBoundingBox boundingBox = buildStructure(bb, type);
if (boundingBoxCache.isCached(boundingBox))
return;
Set<AbstractBoundingBox> structureBoundingBoxes = new HashSet<>();
for (StructurePiece structureComponent : structureStart.getComponents()) {
structureBoundingBoxes.add(buildStructure(structureComponent.getBoundingBox(), type));
}
boundingBoxCache.addBoundingBoxes(boundingBox, structureBoundingBoxes);
}
use of net.minecraft.util.math.MutableBoundingBox in project GT-4-Reimagined by Trinsdar.
the class RubberTreeFeature method updateBoundingBox.
private void updateBoundingBox(BlockPos pos, Set<BlockPos> set, MutableBoundingBox boundingBox) {
int[] coords = { pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ() };
for (BlockPos bp : set) {
coords[0] = Math.min(coords[0], bp.getX());
coords[1] = Math.min(coords[1], bp.getY());
coords[2] = Math.min(coords[2], bp.getZ());
coords[3] = Math.max(coords[3], bp.getX());
coords[4] = Math.max(coords[4], bp.getY());
coords[5] = Math.max(coords[5], bp.getZ());
}
boundingBox.expandTo(new MutableBoundingBox(coords));
}
use of net.minecraft.util.math.MutableBoundingBox in project FrostedHeart by TeamMoegMC.
the class SpacecraftFeature method generate.
@Override
public boolean generate(ISeedReader reader, ChunkGenerator generator, Random rand, BlockPos pos, NoFeatureConfig config) {
/* List<Integer> listX = IntStream.rangeClosed(chunkpos.getXStart(), chunkpos.getXEnd()).boxed().collect(Collectors.toList());
Collections.shuffle(listX, rand);
List<Integer> listZ = IntStream.rangeClosed(chunkpos.getZStart(), chunkpos.getZEnd()).boxed().collect(Collectors.toList());
Collections.shuffle(listZ, rand);*/
// for(Integer integerX : listX) {
// for(Integer integerZ : listZ) {
BlockPos start = new BlockPos(pos.getX() - 9, pos.getY() - 1, /*generator.getNoiseHeightMinusOne(pos.getX(),pos.getZ(), Heightmap.Type.WORLD_SURFACE_WG)*/
pos.getZ() - 7);
// if (reader.isAirBlock(blockpos$mutable) || reader.getBlockState(blockpos$mutable).getCollisionShapeUncached(reader, blockpos$mutable).isEmpty()) {
Rotation rot = Rotation.randomRotation(rand);
PlacementSettings settings = (new PlacementSettings()).setCenterOffset(new BlockPos(/*9*/
9, 2, 7)).setRotation(rot).setMirror(Mirror.NONE);
Template template = reader.getWorld().getStructureTemplateManager().getTemplate(new ResourceLocation(FHMain.MODID, "relic/spacecraft"));
MutableBoundingBox boundingBox = template.getMutableBoundingBox(settings, start);
Vector3i vector3i = boundingBox.func_215126_f();
if (template.func_237146_a_(reader, start, new BlockPos(vector3i.getX(), vector3i.getY(), vector3i.getZ()), settings, reader.getRandom(), 2)) {
FHMain.LOGGER.debug("spacecraft at " + (start.getX()) + " " + start.getY() + " " + (start.getZ()) + " " + rot);
return true;
}
// }
return false;
}
use of net.minecraft.util.math.MutableBoundingBox in project Shrines by Silverminer007.
the class CustomStructureData method savePieces.
public boolean savePieces(ServerWorld serverWorld, MinecraftServer server, String author, boolean includeEntities) {
ModTemplateManager templatemanager;
try {
templatemanager = new ModTemplateManager(Utils.getSaveLocation().getCanonicalFile().toPath(), server.getFixerUpper());
} catch (IOException e) {
e.printStackTrace();
return false;
}
for (ResourceData rd : PIECES_ON_FLY) {
ResourceLocation location = new ResourceLocation(ShrinesMod.MODID, name + "/" + rd.getName());
MutableBoundingBox mbb = rd.getBounds();
BlockPos c0 = new BlockPos(mbb.x0, mbb.y0, mbb.z0);
BlockPos c1 = new BlockPos(mbb.x1, mbb.y1, mbb.z1);
Template template;
try {
template = templatemanager.getOrCreate(location);
} catch (ResourceLocationException resourcelocationexception) {
LOGGER.error(resourcelocationexception);
return false;
}
template.fillFromWorld(serverWorld, c0, c1.subtract(c0), includeEntities, Blocks.STRUCTURE_VOID);
template.setAuthor(author);
try {
if (!templatemanager.save(location)) {
return false;
}
} catch (ResourceLocationException resourcelocationexception) {
LOGGER.error(resourcelocationexception);
return false;
}
}
return true;
}
Aggregations