Java Code Examples for net.minecraft.world.gen.structure.StructureComponent#findIntersecting()

The following examples show how to use net.minecraft.world.gen.structure.StructureComponent#findIntersecting() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StructureTofuMineshaftPieces.java    From TofuCraftReload with MIT License 6 votes vote down vote up
public static StructureBoundingBox findStairs(List<StructureComponent> listIn, Random rand, int x, int y, int z, EnumFacing facing) {
    StructureBoundingBox structureboundingbox = new StructureBoundingBox(x, y - 5, z, x, y + 2, z);

    switch (facing) {
        case NORTH:
        default:
            structureboundingbox.maxX = x + 2;
            structureboundingbox.minZ = z - 8;
            break;
        case SOUTH:
            structureboundingbox.maxX = x + 2;
            structureboundingbox.maxZ = z + 8;
            break;
        case WEST:
            structureboundingbox.minX = x - 8;
            structureboundingbox.maxZ = z + 2;
            break;
        case EAST:
            structureboundingbox.maxX = x + 8;
            structureboundingbox.maxZ = z + 2;
    }

    return StructureComponent.findIntersecting(listIn, structureboundingbox) != null ? null : structureboundingbox;
}
 
Example 2
Source File: StructureTofuMineshaftPieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public static StructureBoundingBox findCrossing(List<StructureComponent> listIn, Random rand, int x, int y, int z, EnumFacing facing) {
    StructureBoundingBox structureboundingbox = new StructureBoundingBox(x, y, z, x, y + 2, z);

    if (rand.nextInt(4) == 0) {
        structureboundingbox.maxY += 4;
    }

    switch (facing) {
        case NORTH:
        default:
            structureboundingbox.minX = x - 1;
            structureboundingbox.maxX = x + 3;
            structureboundingbox.minZ = z - 4;
            break;
        case SOUTH:
            structureboundingbox.minX = x - 1;
            structureboundingbox.maxX = x + 3;
            structureboundingbox.maxZ = z + 3 + 1;
            break;
        case WEST:
            structureboundingbox.minX = x - 4;
            structureboundingbox.minZ = z - 1;
            structureboundingbox.maxZ = z + 3;
            break;
        case EAST:
            structureboundingbox.maxX = x + 3 + 1;
            structureboundingbox.minZ = z - 1;
            structureboundingbox.maxZ = z + 3;
    }

    return StructureComponent.findIntersecting(listIn, structureboundingbox) != null ? null : structureboundingbox;
}
 
Example 3
Source File: VillageHandlerKeep.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static VillagePieceKeep createPiece(StructureVillagePieces.Start start, List<StructureComponent> structures, Random rand, int x, int y,
		int z, EnumFacing facing, int p_175850_7_) {
	BlockPos size = new BlockMapMeasurer(NAME).measure();
	StructureBoundingBox bounds = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0, size.getX(), size.getY(), size.getZ(),
			facing);
	return canVillageGoDeeper(bounds) && StructureComponent.findIntersecting(structures, bounds) == null
			? new VillagePieceKeep(start, p_175850_7_, rand, bounds, facing) : null;
}
 
Example 4
Source File: VillageHandlerGuardTower2.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public static VillagePieceGuardTower2 createPiece(StructureVillagePieces.Start start, List<StructureComponent> structures, Random rand, int x,
		int y, int z, EnumFacing facing, int p_175850_7_) {
	BlockPos size = new BlockMapMeasurer(NAME).measure();
	StructureBoundingBox bounds = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0, size.getX(), size.getY(), size.getZ(),
			facing);
	return canVillageGoDeeper(bounds) && StructureComponent.findIntersecting(structures, bounds) == null
			? new VillagePieceGuardTower2(start, p_175850_7_, rand, bounds, facing) : null;
}
 
Example 5
Source File: WAVillagerHouse.java    From Sakura_mod with MIT License 5 votes vote down vote up
public static WAVillagerHouse createPiece(StructureVillagePieces.Start start,
		List<StructureComponent> list, Random rand, int minX, int minY, int minZ, EnumFacing facing, int type) {
	StructureBoundingBox box = StructureBoundingBox
			.getComponentToAddBoundingBox(minX, minY, minZ, 0, 0, 0, 9, 9, 6, facing);
	return StructureComponent.findIntersecting(list, box) != null ? null : new WAVillagerHouse(start,
			type, rand, box, facing);
}
 
Example 6
Source File: TofuVillagerHouse.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public static TofuVillagerHouse createPiece(StructureVillagePieces.Start start,
                                            List<StructureComponent> list, Random rand, int minX, int minY, int minZ, EnumFacing facing, int type) {
    StructureBoundingBox box = StructureBoundingBox
            .getComponentToAddBoundingBox(minX, minY, minZ, 0, 0, 0, 6, 10, 6, facing);
    return StructureComponent.findIntersecting(list, box) != null ? null : new TofuVillagerHouse(start,
            type, rand, box, facing);
}
 
Example 7
Source File: StructureTofuMineshaftPieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public static StructureBoundingBox findCorridorSize(List<StructureComponent> p_175814_0_, Random rand, int x, int y, int z, EnumFacing facing) {
    StructureBoundingBox structureboundingbox = new StructureBoundingBox(x, y, z, x, y + 2, z);
    int i;

    for (i = rand.nextInt(3) + 2; i > 0; --i) {
        int j = i * 5;

        switch (facing) {
            case NORTH:
            default:
                structureboundingbox.maxX = x + 2;
                structureboundingbox.minZ = z - (j - 1);
                break;
            case SOUTH:
                structureboundingbox.maxX = x + 2;
                structureboundingbox.maxZ = z + (j - 1);
                break;
            case WEST:
                structureboundingbox.minX = x - (j - 1);
                structureboundingbox.maxZ = z + 2;
                break;
            case EAST:
                structureboundingbox.maxX = x + (j - 1);
                structureboundingbox.maxZ = z + 2;
        }

        if (StructureComponent.findIntersecting(p_175814_0_, structureboundingbox) == null) {
            break;
        }
    }

    return i > 0 ? structureboundingbox : null;
}
 
Example 8
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public static StructureBoundingBox findPieceBox(Start start, List<StructureComponent> p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, EnumFacing facing) {
    for (int i = 7 * MathHelper.getInt(rand, 3, 5); i >= 7; i -= 7) {
        StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175848_3_, p_175848_4_, p_175848_5_, 0, 0, 0, 3, 3, i, facing);

        if (StructureComponent.findIntersecting(p_175848_1_, structureboundingbox) == null) {
            return structureboundingbox;
        }
    }

    return null;
}
 
Example 9
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static House createPiece(Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, EnumFacing facing, int p_175853_7_) {
    StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 5, 6, 5, facing);
    return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new House(start, p_175853_7_, rand, structureboundingbox, facing) : null;
}
 
Example 10
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static WoodHut createPiece(Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, EnumFacing facing, int p_175853_7_) {
    StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 4, 6, 5, facing);
    return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new WoodHut(start, p_175853_7_, rand, structureboundingbox, facing) : null;
}
 
Example 11
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static FarmLand createPiece(Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, EnumFacing facing, int p_175853_7_) {
    StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 6, 5, 6, facing);
    return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new FarmLand(start, p_175853_7_, rand, structureboundingbox, facing) : null;
}
 
Example 12
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static TorchNew createPiece(Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, EnumFacing facing, int p_175853_7_) {
    StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 4, 6, 5, facing);
    return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new TorchNew(start, p_175853_7_, rand, structureboundingbox, facing) : null;
}
 
Example 13
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static StructureBoundingBox findPieceBox(Start start, List<StructureComponent> p_175856_1_, Random rand, int p_175856_3_, int p_175856_4_, int p_175856_5_, EnumFacing facing) {
    StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175856_3_, p_175856_4_, p_175856_5_, 0, 0, 0, 3, 4, 2, facing);
    return StructureComponent.findIntersecting(p_175856_1_, structureboundingbox) != null ? null : structureboundingbox;
}
 
Example 14
Source File: VillageHandlerBarracks.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static VillagePieceBarracks createPiece(StructureVillagePieces.Start start, List<StructureComponent> structures, Random rand, int x, int y, int z, EnumFacing facing, int p_175850_7_) {
	BlockPos size = new BlockMapMeasurer(NAME).measure();
	StructureBoundingBox bounds = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0, size.getX(), size.getY(), size.getZ(), facing);
	return canVillageGoDeeper(bounds) && StructureComponent.findIntersecting(structures, bounds) == null ? new VillagePieceBarracks(start, p_175850_7_, rand, bounds, facing) : null;
}
 
Example 15
Source File: VillageHandlerGuardTower.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static VillagePieceGuardTower createPiece(StructureVillagePieces.Start start, List<StructureComponent> structures, Random rand, int x, int y, int z, EnumFacing facing, int p_175850_7_) {
	BlockPos size = new BlockMapMeasurer(NAME).measure();
	StructureBoundingBox bounds = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0, size.getX(), size.getY(), size.getZ(), facing);
	return canVillageGoDeeper(bounds) && StructureComponent.findIntersecting(structures, bounds) == null ? new VillagePieceGuardTower(start, p_175850_7_, rand, bounds, facing) : null;
}
 
Example 16
Source File: VillageHandlerShop.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static VillagePieceShop createPiece(StructureVillagePieces.Start start, List<StructureComponent> structures, Random rand, int x, int y, int z, EnumFacing facing, int p_175850_7_) {
	BlockPos size = new BlockMapMeasurer(NAME).measure();
	StructureBoundingBox bounds = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0, size.getX(), size.getY(), size.getZ(), facing);
	return canVillageGoDeeper(bounds) && StructureComponent.findIntersecting(structures, bounds) == null ? new VillagePieceShop(start, p_175850_7_, rand, bounds, facing) : null;
}
 
Example 17
Source File: VillageHandlerTrophy.java    From ToroQuest with GNU General Public License v3.0 4 votes vote down vote up
public static VillagePieceTrophy createPiece(StructureVillagePieces.Start start, List<StructureComponent> structures, Random rand, int x, int y, int z, EnumFacing facing, int p_175850_7_) {
	BlockPos size = new BlockMapMeasurer(NAME).measure();
	StructureBoundingBox bounds = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0, size.getX(), size.getY(), size.getZ(), facing);
	return canVillageGoDeeper(bounds) && StructureComponent.findIntersecting(structures, bounds) == null ? new VillagePieceTrophy(start, p_175850_7_, rand, bounds, facing) : null;
}
 
Example 18
Source File: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public static TallTofuHouse createPiece(Start start, List<StructureComponent> p_175850_1_, Random rand, int p_175850_3_, int p_175850_4_, int p_175850_5_, EnumFacing facing, int p_175850_7_) {
    StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175850_3_, p_175850_4_, p_175850_5_, 0, 0, 0, 6, 10, 6, facing);
    return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175850_1_, structureboundingbox) == null ? new TallTofuHouse(start, p_175850_7_, rand, structureboundingbox, facing) : null;
}
 
Example 19
Source File: VillageHandlerCabin.java    From ToroQuest with GNU General Public License v3.0 3 votes vote down vote up
public static VillagePieceCabin createPiece(StructureVillagePieces.Start start, List<StructureComponent> structures, Random rand, int x, int y, int z, EnumFacing facing, int p_175850_7_) {

			BlockPos size = new BlockMapMeasurer(NAME).measure();

			StructureBoundingBox bounds = StructureBoundingBox.getComponentToAddBoundingBox(x, y, z, 0, 0, 0, size.getX(), size.getY(), size.getZ(), facing);

			return canVillageGoDeeper(bounds) && StructureComponent.findIntersecting(structures, bounds) == null ? new VillagePieceCabin(start, p_175850_7_, rand, bounds, facing) : null;
		}