Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
9c3560a3ff
Commit
db88a91085
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.slaves.laufbau;
|
package de.steamwar.bausystem.features.slaves.laufbau;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -28,9 +27,9 @@ import org.bukkit.block.data.*;
|
|||||||
import org.bukkit.block.data.type.*;
|
import org.bukkit.block.data.type.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
@ToString
|
@ToString
|
||||||
@Getter
|
@Getter
|
||||||
public class BlockBoundingBox {
|
public class BlockBoundingBox {
|
||||||
@ -38,10 +37,18 @@ public class BlockBoundingBox {
|
|||||||
public static List<BlockBoundingBox> elements = new ArrayList<>();
|
public static List<BlockBoundingBox> elements = new ArrayList<>();
|
||||||
|
|
||||||
public BlockData blockData;
|
public BlockData blockData;
|
||||||
public Cuboid cuboid;
|
public List<Cuboid> cuboidList;
|
||||||
|
private double volume;
|
||||||
|
|
||||||
|
public BlockBoundingBox(BlockData blockData, List<Cuboid> cuboidList) {
|
||||||
|
this.blockData = blockData;
|
||||||
|
this.cuboidList = cuboidList;
|
||||||
|
volume = cuboidList.stream().mapToDouble(Cuboid::volume).sum();
|
||||||
|
elements.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
public double volume() {
|
public double volume() {
|
||||||
return cuboid.getDx() * cuboid.getDy() * cuboid.getDz();
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -51,10 +58,6 @@ public class BlockBoundingBox {
|
|||||||
addPixel(Material.GRASS_PATH.createBlockData(), 0, 0, 0, 16, 15, 16);
|
addPixel(Material.GRASS_PATH.createBlockData(), 0, 0, 0, 16, 15, 16);
|
||||||
addPixel(Material.SOUL_SAND.createBlockData(), 0, 0, 0, 16, 14, 16);
|
addPixel(Material.SOUL_SAND.createBlockData(), 0, 0, 0, 16, 14, 16);
|
||||||
|
|
||||||
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
|
||||||
hopper.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(hopper, 0, 4, 0, 16, 12, 16);
|
|
||||||
|
|
||||||
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
|
Cocoa cocoaNorth = (Cocoa) Material.COCOA.createBlockData();
|
||||||
cocoaNorth.setAge(2);
|
cocoaNorth.setAge(2);
|
||||||
cocoaNorth.setFacing(BlockFace.NORTH);
|
cocoaNorth.setFacing(BlockFace.NORTH);
|
||||||
@ -85,28 +88,12 @@ public class BlockBoundingBox {
|
|||||||
doubleTurtleEgg.setHatch(0);
|
doubleTurtleEgg.setHatch(0);
|
||||||
addPixel(doubleTurtleEgg, 1, 0, 1, 14, 7, 14);
|
addPixel(doubleTurtleEgg, 1, 0, 1, 14, 7, 14);
|
||||||
|
|
||||||
Grindstone floorGrindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
floorGrindstone.setAttachedFace(FaceAttachable.AttachedFace.FLOOR);
|
|
||||||
addPixel(floorGrindstone, 2, 0, 2, 12, 16, 12);
|
|
||||||
|
|
||||||
Grindstone northSouthGrindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
northSouthGrindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
|
||||||
northSouthGrindstone.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(northSouthGrindstone, 2, 2, 0, 12, 12, 16);
|
|
||||||
|
|
||||||
Grindstone eastWestGrindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
|
||||||
eastWestGrindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
|
||||||
eastWestGrindstone.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(eastWestGrindstone, 0, 2, 2, 16, 12, 12);
|
|
||||||
|
|
||||||
addPixel(Material.CHEST.createBlockData(), 1, 0, 1, 14, 14, 14);
|
addPixel(Material.CHEST.createBlockData(), 1, 0, 1, 14, 14, 14);
|
||||||
|
|
||||||
Snow snowLayers8 = (Snow) Material.SNOW.createBlockData();
|
Snow snowLayers8 = (Snow) Material.SNOW.createBlockData();
|
||||||
snowLayers8.setLayers(8);
|
snowLayers8.setLayers(8);
|
||||||
addPixel(snowLayers8, 0, 0, 0, 16, 14, 16);
|
addPixel(snowLayers8, 0, 0, 0, 16, 14, 16);
|
||||||
|
|
||||||
addPixel(Material.CHORUS_PLANT.createBlockData(), 3, 3, 3, 10, 10, 10);
|
|
||||||
|
|
||||||
Directional headNorth = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
Directional headNorth = (Directional) Material.PLAYER_WALL_HEAD.createBlockData();
|
||||||
headNorth.setFacing(BlockFace.NORTH);
|
headNorth.setFacing(BlockFace.NORTH);
|
||||||
addPixel(headNorth, 4, 4, 8, 8, 8, 8);
|
addPixel(headNorth, 4, 4, 8, 8, 8, 8);
|
||||||
@ -170,53 +157,8 @@ public class BlockBoundingBox {
|
|||||||
singleSeaPickle.setPickles(1);
|
singleSeaPickle.setPickles(1);
|
||||||
addPixel(singleSeaPickle, 6, 0, 6, 4, 6, 4);
|
addPixel(singleSeaPickle, 6, 0, 6, 4, 6, 4);
|
||||||
|
|
||||||
Bell doubleAttachedBellEast = (Bell) Material.BELL.createBlockData();
|
|
||||||
doubleAttachedBellEast.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
|
||||||
doubleAttachedBellEast.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(doubleAttachedBellEast, 0, 4, 4, 16, 11, 8);
|
|
||||||
|
|
||||||
Bell doubleAttachedBellNorth = (Bell) Material.BELL.createBlockData();
|
|
||||||
doubleAttachedBellNorth.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
|
||||||
doubleAttachedBellNorth.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(doubleAttachedBellNorth, 4, 4, 0, 8, 11, 16);
|
|
||||||
|
|
||||||
Bell floorBellNorth = (Bell) Material.BELL.createBlockData();
|
|
||||||
floorBellNorth.setAttachment(Bell.Attachment.FLOOR);
|
|
||||||
addPixel(floorBellNorth, 0, 0, 4, 16, 16, 8);
|
|
||||||
|
|
||||||
Bell floorBellEast = (Bell) Material.BELL.createBlockData();
|
|
||||||
floorBellEast.setAttachment(Bell.Attachment.FLOOR);
|
|
||||||
floorBellEast.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(floorBellEast, 4, 0, 0, 8, 16, 16);
|
|
||||||
|
|
||||||
Bell ceilingBell = (Bell) Material.BELL.createBlockData();
|
|
||||||
ceilingBell.setAttachment(Bell.Attachment.CEILING);
|
|
||||||
addPixel(ceilingBell, 4, 4, 4, 8, 12, 8);
|
|
||||||
|
|
||||||
Bell singleAttachedBellNorth = (Bell) Material.BELL.createBlockData();
|
|
||||||
singleAttachedBellNorth.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
singleAttachedBellNorth.setFacing(BlockFace.NORTH);
|
|
||||||
addPixel(singleAttachedBellNorth, 4, 4, 0, 8, 11, 13);
|
|
||||||
|
|
||||||
Bell singleAttachedBellSouth = (Bell) Material.BELL.createBlockData();
|
|
||||||
singleAttachedBellSouth.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
singleAttachedBellSouth.setFacing(BlockFace.SOUTH);
|
|
||||||
addPixel(singleAttachedBellSouth, 4, 4, 3, 8, 11, 13);
|
|
||||||
|
|
||||||
Bell singleAttachedBellWest = (Bell) Material.BELL.createBlockData();
|
|
||||||
singleAttachedBellWest.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
singleAttachedBellWest.setFacing(BlockFace.WEST);
|
|
||||||
addPixel(singleAttachedBellWest, 0, 4, 4, 13, 11, 8);
|
|
||||||
|
|
||||||
Bell singleAttachedBellEast = (Bell) Material.BELL.createBlockData();
|
|
||||||
singleAttachedBellEast.setAttachment(Bell.Attachment.SINGLE_WALL);
|
|
||||||
singleAttachedBellEast.setFacing(BlockFace.EAST);
|
|
||||||
addPixel(singleAttachedBellEast, 3, 4, 4, 13, 11, 8);
|
|
||||||
|
|
||||||
addPixel(Material.FLOWER_POT.createBlockData(), 5, 0, 5, 6, 6, 6);
|
addPixel(Material.FLOWER_POT.createBlockData(), 5, 0, 5, 6, 6, 6);
|
||||||
|
|
||||||
addPixel(Material.DAYLIGHT_DETECTOR.createBlockData(), 0, 0, 0, 16, 6, 16);
|
|
||||||
|
|
||||||
Snow snowLayers3 = (Snow) Material.SNOW.createBlockData();
|
Snow snowLayers3 = (Snow) Material.SNOW.createBlockData();
|
||||||
snowLayers3.setLayers(3);
|
snowLayers3.setLayers(3);
|
||||||
addPixel(snowLayers3, 0, 0, 0, 16, 4, 16);
|
addPixel(snowLayers3, 0, 0, 0, 16, 4, 16);
|
||||||
@ -252,19 +194,6 @@ public class BlockBoundingBox {
|
|||||||
conduit.setWaterlogged(false);
|
conduit.setWaterlogged(false);
|
||||||
addPixel(conduit, 5, 5, 5, 6, 6, 6);
|
addPixel(conduit, 5, 5, 5, 6, 6, 6);
|
||||||
|
|
||||||
Lantern floorLantern = (Lantern) Material.LANTERN.createBlockData();
|
|
||||||
addPixel(floorLantern, 5, 0, 5, 6, 9, 6);
|
|
||||||
|
|
||||||
Lantern ceilingLantern = (Lantern) Material.LANTERN.createBlockData();
|
|
||||||
ceilingLantern.setHanging(true);
|
|
||||||
addPixel(ceilingLantern, 5, 1, 5, 6, 15, 6);
|
|
||||||
|
|
||||||
addPixel(Material.END_STONE_BRICK_WALL.createBlockData(), 4, 0, 4, 8, 24, 8);
|
|
||||||
|
|
||||||
addPixel(Material.NETHER_BRICK_FENCE.createBlockData(), 6, 0, 6, 4, 24, 4);
|
|
||||||
|
|
||||||
addPixel(Material.IRON_BARS.createBlockData(), 7, 0, 7, 2, 16, 2);
|
|
||||||
|
|
||||||
TrapDoor northTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
TrapDoor northTrapDoor = (TrapDoor) Material.IRON_TRAPDOOR.createBlockData();
|
||||||
northTrapDoor.setFacing(BlockFace.NORTH);
|
northTrapDoor.setFacing(BlockFace.NORTH);
|
||||||
northTrapDoor.setOpen(true);
|
northTrapDoor.setOpen(true);
|
||||||
@ -287,7 +216,7 @@ public class BlockBoundingBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel) {
|
private static void addPixel(BlockData blockData, double xPixel, double yPixel, double zPixel, double dxPixel, double dyPixel, double dzPixel) {
|
||||||
elements.add(new BlockBoundingBox(blockData, new Cuboid(pixelToBlock(xPixel), pixelToBlock(yPixel), pixelToBlock(zPixel), pixelToBlock(dxPixel), pixelToBlock(dyPixel), pixelToBlock(dzPixel))));
|
new BlockBoundingBox(blockData, Arrays.asList(new Cuboid(pixelToBlock(xPixel), pixelToBlock(yPixel), pixelToBlock(zPixel), pixelToBlock(dxPixel), pixelToBlock(dyPixel), pixelToBlock(dzPixel))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double pixelToBlock(double pixel) {
|
private static double pixelToBlock(double pixel) {
|
||||||
|
@ -43,15 +43,11 @@ public class Cuboid {
|
|||||||
return maxx > cuboid.x && maxy > cuboid.y && maxz > cuboid.z && minx < cuboid.x && miny < cuboid.y && minz < cuboid.z;
|
return maxx > cuboid.x && maxy > cuboid.y && maxz > cuboid.z && minx < cuboid.x && miny < cuboid.y && minz < cuboid.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double volume() {
|
||||||
|
return dx * dy * dz;
|
||||||
|
}
|
||||||
|
|
||||||
public Cuboid add(Point point) {
|
public Cuboid add(Point point) {
|
||||||
return new Cuboid(x + point.getX(), y + point.getY(), z + point.getZ(), dx, dy, dz);
|
return new Cuboid(x + point.getX(), y + point.getY(), z + point.getZ(), dx, dy, dz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cuboid expand(Cuboid cuboid) {
|
|
||||||
return new Cuboid(x - cuboid.dx, y - cuboid.dy, z - cuboid.dz, dx + cuboid.dx, dy + cuboid.dy, dz + cuboid.dz);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasInside(Cuboid cuboid) {
|
|
||||||
return x <= cuboid.x && x + dx >= cuboid.x && y <= cuboid.y && y + dy >= cuboid.y && z <= cuboid.z && z + dz >= cuboid.z;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.type.Bell;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class BellBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
ceilingBell();
|
||||||
|
|
||||||
|
floorNorthBell();
|
||||||
|
floorEastBell();
|
||||||
|
|
||||||
|
doubleWallNorthBell();
|
||||||
|
doubleWallEastBell();
|
||||||
|
|
||||||
|
singleWallNorthBell();
|
||||||
|
singleWallSouthBell();
|
||||||
|
singleWallEastBell();
|
||||||
|
singleWallWestBell();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ceilingBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.CEILING);
|
||||||
|
bell.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||||
|
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||||
|
cuboidList.add(pixelCuboid(7, 13, 7, 2, 3, 2));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void floorNorthBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.FLOOR);
|
||||||
|
bell.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 4, 16, 16, 8));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void floorEastBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.FLOOR);
|
||||||
|
bell.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 0, 0, 8, 16, 16));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doubleWallNorthBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
||||||
|
bell.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||||
|
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||||
|
cuboidList.add(pixelCuboid(7, 13, 0, 2, 2, 16));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doubleWallEastBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.DOUBLE_WALL);
|
||||||
|
bell.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||||
|
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||||
|
cuboidList.add(pixelCuboid(0, 13, 7, 16, 2, 2));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void singleWallNorthBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||||
|
bell.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||||
|
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||||
|
cuboidList.add(pixelCuboid(7, 13, 0, 2, 2, 13));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void singleWallSouthBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||||
|
bell.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||||
|
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||||
|
cuboidList.add(pixelCuboid(7, 13, 3, 2, 2, 13));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void singleWallEastBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||||
|
bell.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||||
|
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||||
|
cuboidList.add(pixelCuboid(3, 13, 7, 13, 2, 2));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void singleWallWestBell() {
|
||||||
|
Bell bell = (Bell) Material.BELL.createBlockData();
|
||||||
|
bell.setAttachment(Bell.Attachment.SINGLE_WALL);
|
||||||
|
bell.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 2, 8));
|
||||||
|
cuboidList.add(pixelCuboid(5, 6, 5, 6, 8, 6));
|
||||||
|
cuboidList.add(pixelCuboid(0, 13, 7, 13, 2, 2));
|
||||||
|
new BlockBoundingBox(bell, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.data.type.BrewingStand;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class BrewingStandBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
BrewingStand brewingStand = (BrewingStand) Material.BREWING_STAND.createBlockData();
|
||||||
|
List<Cuboid> cuboids = new ArrayList<>();
|
||||||
|
cuboids.add(pixelCuboid(1, 0, 1, 14, 2, 14));
|
||||||
|
cuboids.add(pixelCuboid(7, 2, 7, 2, 12, 2));
|
||||||
|
new BlockBoundingBox(brewingStand, cuboids);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.MultipleFacing;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class ChorusPlantBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
for (int nx = 0; nx < 2; nx++) {
|
||||||
|
for (int ny = 0; ny < 2; ny++) {
|
||||||
|
for (int nz = 0; nz < 2; nz++) {
|
||||||
|
for (int px = 0; px < 2; px++) {
|
||||||
|
for (int py = 0; py < 2; py++) {
|
||||||
|
for (int pz = 0; pz < 2; pz++) {
|
||||||
|
MultipleFacing chorusPlant = (MultipleFacing) Material.CHORUS_PLANT.createBlockData();
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(3, 3, 3, 10, 10, 10));
|
||||||
|
if (nx == 1) {
|
||||||
|
chorusPlant.setFace(BlockFace.WEST, true);
|
||||||
|
cuboidList.add(pixelCuboid(0, 3, 3, 3, 10, 10));
|
||||||
|
}
|
||||||
|
if (ny == 1) {
|
||||||
|
chorusPlant.setFace(BlockFace.DOWN, true);
|
||||||
|
cuboidList.add(pixelCuboid(3, 0, 3, 10, 3, 10));
|
||||||
|
}
|
||||||
|
if (nz == 1) {
|
||||||
|
chorusPlant.setFace(BlockFace.NORTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 3));
|
||||||
|
}
|
||||||
|
if (px == 1) {
|
||||||
|
chorusPlant.setFace(BlockFace.EAST, true);
|
||||||
|
cuboidList.add(pixelCuboid(13, 3, 3, 3, 10, 10));
|
||||||
|
}
|
||||||
|
if (py == 1) {
|
||||||
|
chorusPlant.setFace(BlockFace.UP, true);
|
||||||
|
cuboidList.add(pixelCuboid(3, 13, 3, 10, 3, 10));
|
||||||
|
}
|
||||||
|
if (pz == 1) {
|
||||||
|
chorusPlant.setFace(BlockFace.SOUTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(3, 3, 13, 10, 10, 3));
|
||||||
|
}
|
||||||
|
new BlockBoundingBox(chorusPlant, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
|
||||||
|
public class CuboidUtils {
|
||||||
|
|
||||||
|
public static Cuboid pixelCuboid(double pixelX, double pixelY, double pixelZ, double pixelDX, double pixelDY, double pixelDZ) {
|
||||||
|
return new Cuboid(pixelToBlock(pixelX), pixelToBlock(pixelY), pixelToBlock(pixelZ), pixelToBlock(pixelDX), pixelToBlock(pixelDY), pixelToBlock(pixelDZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double pixelToBlock(double pixel) {
|
||||||
|
return 1.0 / 16 * pixel;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.type.Fence;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class FencesBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
for (int nx = 0; nx < 2; nx++) {
|
||||||
|
for (int nz = 0; nz < 2; nz++) {
|
||||||
|
for (int px = 0; px < 2; px++) {
|
||||||
|
for (int pz = 0; pz < 2; pz++) {
|
||||||
|
Fence fence = (Fence) Material.NETHER_BRICK_FENCE.createBlockData();
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(6, 0, 6, 4, 24, 4));
|
||||||
|
if (nz == 1) {
|
||||||
|
fence.setFace(BlockFace.NORTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(6, 0, 0, 4, 24, 6));
|
||||||
|
}
|
||||||
|
if (pz == 1) {
|
||||||
|
fence.setFace(BlockFace.SOUTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(6, 0, 10, 4, 24, 6));
|
||||||
|
}
|
||||||
|
if (nx == 1) {
|
||||||
|
fence.setFace(BlockFace.WEST, true);
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 6, 6, 24, 4));
|
||||||
|
}
|
||||||
|
if (px == 1) {
|
||||||
|
fence.setFace(BlockFace.EAST, true);
|
||||||
|
cuboidList.add(pixelCuboid(10, 0, 6, 6, 24, 4));
|
||||||
|
}
|
||||||
|
new BlockBoundingBox(fence, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.FaceAttachable;
|
||||||
|
import org.bukkit.block.data.type.Grindstone;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class GrindstoneBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
floorNorthGrindstone();
|
||||||
|
floorEastGrindstone();
|
||||||
|
|
||||||
|
ceilingNorthGrindstone();
|
||||||
|
ceilingEastGrindstone();
|
||||||
|
|
||||||
|
wallNorthGrindstone();
|
||||||
|
wallSouthGrindstone();
|
||||||
|
wallEastGrindstone();
|
||||||
|
wallWestGrindstone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void floorNorthGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.FLOOR);
|
||||||
|
grindstone.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 2, 8, 12, 12));
|
||||||
|
cuboidList.add(pixelCuboid(2, 0, 6, 2, 7, 4));
|
||||||
|
cuboidList.add(pixelCuboid(12, 0, 6, 2, 7, 4));
|
||||||
|
cuboidList.add(pixelCuboid(2, 7, 5, 2, 6, 6));
|
||||||
|
cuboidList.add(pixelCuboid(12, 7, 5, 2, 6, 6));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void floorEastGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.FLOOR);
|
||||||
|
grindstone.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(2, 4, 4, 12, 12, 8));
|
||||||
|
cuboidList.add(pixelCuboid(6, 0, 2, 4, 7, 2));
|
||||||
|
cuboidList.add(pixelCuboid(6, 0, 12, 4, 7, 2));
|
||||||
|
cuboidList.add(pixelCuboid(5, 7, 2, 6, 6, 2));
|
||||||
|
cuboidList.add(pixelCuboid(5, 7, 12, 6, 6, 2));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ceilingNorthGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.CEILING);
|
||||||
|
grindstone.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 0, 2, 8, 12, 12));
|
||||||
|
cuboidList.add(pixelCuboid(2, 9, 6, 2, 7, 4));
|
||||||
|
cuboidList.add(pixelCuboid(12, 9, 6, 2, 7, 4));
|
||||||
|
cuboidList.add(pixelCuboid(2, 3, 5, 2, 6, 6));
|
||||||
|
cuboidList.add(pixelCuboid(12, 3, 5, 2, 6, 6));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ceilingEastGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.CEILING);
|
||||||
|
grindstone.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(2, 0, 4, 12, 12, 8));
|
||||||
|
cuboidList.add(pixelCuboid(6, 9, 2, 4, 7, 2));
|
||||||
|
cuboidList.add(pixelCuboid(6, 9, 12, 4, 7, 2));
|
||||||
|
cuboidList.add(pixelCuboid(5, 3, 2, 6, 6, 2));
|
||||||
|
cuboidList.add(pixelCuboid(5, 3, 12, 6, 6, 2));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void wallNorthGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||||
|
grindstone.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 2, 0, 8, 12, 12));
|
||||||
|
cuboidList.add(pixelCuboid(2, 6, 9, 2, 4, 7));
|
||||||
|
cuboidList.add(pixelCuboid(12, 6, 9, 2, 4, 7));
|
||||||
|
cuboidList.add(pixelCuboid(2, 5, 3, 2, 6, 6));
|
||||||
|
cuboidList.add(pixelCuboid(12, 5, 3, 2, 6, 6));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void wallSouthGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||||
|
grindstone.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 2, 4, 8, 12, 12));
|
||||||
|
cuboidList.add(pixelCuboid(2, 6, 0, 2, 4, 7));
|
||||||
|
cuboidList.add(pixelCuboid(12, 6, 0, 2, 4, 7));
|
||||||
|
cuboidList.add(pixelCuboid(2, 5, 7, 2, 6, 6));
|
||||||
|
cuboidList.add(pixelCuboid(12, 5, 7, 2, 6, 6));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void wallEastGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||||
|
grindstone.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 2, 4, 12, 12, 8));
|
||||||
|
cuboidList.add(pixelCuboid(0, 6, 2, 7, 4, 2));
|
||||||
|
cuboidList.add(pixelCuboid(0, 6, 12, 7, 4, 2));
|
||||||
|
cuboidList.add(pixelCuboid(7, 5, 2, 6, 6, 2));
|
||||||
|
cuboidList.add(pixelCuboid(7, 5, 12, 6, 6, 2));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void wallWestGrindstone() {
|
||||||
|
Grindstone grindstone = (Grindstone) Material.GRINDSTONE.createBlockData();
|
||||||
|
grindstone.setAttachedFace(FaceAttachable.AttachedFace.WALL);
|
||||||
|
grindstone.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 2, 4, 12, 12, 8));
|
||||||
|
cuboidList.add(pixelCuboid(9, 6, 2, 7, 4, 2));
|
||||||
|
cuboidList.add(pixelCuboid(9, 6, 12, 7, 4, 2));
|
||||||
|
cuboidList.add(pixelCuboid(3, 5, 2, 6, 6, 2));
|
||||||
|
cuboidList.add(pixelCuboid(3, 5, 12, 6, 6, 2));
|
||||||
|
new BlockBoundingBox(grindstone, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.type.Hopper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class HopperBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
downHopper();
|
||||||
|
northHopper();
|
||||||
|
southHopper();
|
||||||
|
eastHopper();
|
||||||
|
westHopper();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void downHopper() {
|
||||||
|
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||||
|
hopper.setFacing(BlockFace.DOWN);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||||
|
cuboidList.add(pixelCuboid(6, 0, 6, 4, 4, 4));
|
||||||
|
new BlockBoundingBox(hopper, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void northHopper() {
|
||||||
|
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||||
|
hopper.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||||
|
cuboidList.add(pixelCuboid(6, 4, 0, 4, 4, 4));
|
||||||
|
new BlockBoundingBox(hopper, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void southHopper() {
|
||||||
|
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||||
|
hopper.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||||
|
cuboidList.add(pixelCuboid(6, 4, 12, 4, 4, 4));
|
||||||
|
new BlockBoundingBox(hopper, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void eastHopper() {
|
||||||
|
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||||
|
hopper.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||||
|
cuboidList.add(pixelCuboid(12, 4, 6, 4, 4, 4));
|
||||||
|
new BlockBoundingBox(hopper, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void westHopper() {
|
||||||
|
Hopper hopper = (Hopper) Material.HOPPER.createBlockData();
|
||||||
|
hopper.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 10, 0, 16, 6, 16));
|
||||||
|
cuboidList.add(pixelCuboid(4, 4, 4, 8, 6, 8));
|
||||||
|
cuboidList.add(pixelCuboid(0, 4, 6, 4, 4, 4));
|
||||||
|
new BlockBoundingBox(hopper, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.type.Fence;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class IronBarBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
for (int nx = 0; nx < 2; nx++) {
|
||||||
|
for (int nz = 0; nz < 2; nz++) {
|
||||||
|
for (int px = 0; px < 2; px++) {
|
||||||
|
for (int pz = 0; pz < 2; pz++) {
|
||||||
|
Fence fence = (Fence) Material.IRON_BARS.createBlockData();
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(7, 0, 7, 2, 16, 2));
|
||||||
|
if (nz == 1) {
|
||||||
|
fence.setFace(BlockFace.NORTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(7, 0, 0, 2, 16, 7));
|
||||||
|
}
|
||||||
|
if (pz == 1) {
|
||||||
|
fence.setFace(BlockFace.SOUTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(7, 0, 9, 2, 16, 7));
|
||||||
|
}
|
||||||
|
if (nx == 1) {
|
||||||
|
fence.setFace(BlockFace.WEST, true);
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 7, 7, 16, 2));
|
||||||
|
}
|
||||||
|
if (px == 1) {
|
||||||
|
fence.setFace(BlockFace.EAST, true);
|
||||||
|
cuboidList.add(pixelCuboid(9, 0, 7, 7, 16, 2));
|
||||||
|
}
|
||||||
|
new BlockBoundingBox(fence, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.data.type.Lantern;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class LanternBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
lantern();
|
||||||
|
hangingLantern();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lantern() {
|
||||||
|
Lantern lantern = (Lantern) Material.LANTERN.createBlockData();
|
||||||
|
lantern.setHanging(false);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(5, 0, 5, 6, 7, 6));
|
||||||
|
cuboidList.add(pixelCuboid(6, 7, 6, 4, 2, 4));
|
||||||
|
new BlockBoundingBox(lantern, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hangingLantern() {
|
||||||
|
Lantern lantern = (Lantern) Material.LANTERN.createBlockData();
|
||||||
|
lantern.setHanging(false);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(5, 1, 5, 6, 7, 6));
|
||||||
|
cuboidList.add(pixelCuboid(6, 8, 6, 4, 2, 4));
|
||||||
|
new BlockBoundingBox(lantern, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,343 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.type.Stairs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class StairBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
straightBottomNorthStair();
|
||||||
|
straightBottomSouthStair();
|
||||||
|
straightBottomEastStair();
|
||||||
|
straightBottomWestStair();
|
||||||
|
|
||||||
|
straightTopNorthStair();
|
||||||
|
straightTopSouthStair();
|
||||||
|
straightTopEastStair();
|
||||||
|
straightTopWestStair();
|
||||||
|
|
||||||
|
outerLeftBottomNorthStair();
|
||||||
|
outerLeftBottomSouthStair();
|
||||||
|
outerLeftBottomEastStair();
|
||||||
|
outerLeftBottomWestStair();
|
||||||
|
|
||||||
|
outerLeftTopNorthStair();
|
||||||
|
outerLeftTopSouthStair();
|
||||||
|
outerLeftTopEastStair();
|
||||||
|
outerLeftTopWestStair();
|
||||||
|
|
||||||
|
innerLeftBottomNorthStair();
|
||||||
|
innerLeftBottomSouthStair();
|
||||||
|
innerLeftBottomEastStair();
|
||||||
|
innerLeftBottomWestStair();
|
||||||
|
|
||||||
|
innerLeftTopNorthStair();
|
||||||
|
innerLeftTopSouthStair();
|
||||||
|
innerLeftTopEastStair();
|
||||||
|
innerLeftTopWestStair();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightBottomNorthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightBottomSouthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightBottomEastStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 16));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightBottomWestStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 16));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightTopNorthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightTopSouthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightTopEastStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 16));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void straightTopWestStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.STRAIGHT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 16));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftBottomNorthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftBottomSouthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(8, 8, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftBottomEastStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftBottomWestStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftTopNorthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftTopSouthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(8, 0, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftTopEastStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void outerLeftTopWestStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.OUTER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftBottomNorthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftBottomSouthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(8, 8, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftBottomEastStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(8, 8, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftBottomWestStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.BOTTOM);
|
||||||
|
stairs.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 8, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftTopNorthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.NORTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftTopSouthStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.SOUTH);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(8, 0, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftTopEastStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.EAST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(8, 0, 8, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void innerLeftTopWestStair() {
|
||||||
|
Stairs stairs = (Stairs) Material.END_STONE_BRICK_STAIRS.createBlockData();
|
||||||
|
stairs.setShape(Stairs.Shape.INNER_LEFT);
|
||||||
|
stairs.setHalf(Stairs.Half.TOP);
|
||||||
|
stairs.setFacing(BlockFace.WEST);
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(0, 8, 0, 16, 8, 16));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 8, 16, 8, 8));
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 0, 8, 8, 8));
|
||||||
|
new BlockBoundingBox(stairs, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* This file is a part of the SteamWar software.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2022 SteamWar.de-Serverteam
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;
|
||||||
|
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
|
||||||
|
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
|
||||||
|
import de.steamwar.bausystem.linkage.Enable;
|
||||||
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.type.Fence;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static de.steamwar.bausystem.features.slaves.laufbau.boundingboxes.CuboidUtils.pixelCuboid;
|
||||||
|
|
||||||
|
@Linked(LinkageType.ENABLE_LINK)
|
||||||
|
public class WallBoundingBox implements Enable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
for (int nx = 0; nx < 2; nx++) {
|
||||||
|
for (int nz = 0; nz < 2; nz++) {
|
||||||
|
for (int px = 0; px < 2; px++) {
|
||||||
|
for (int pz = 0; pz < 2; pz++) {
|
||||||
|
Fence fence = (Fence) Material.END_STONE_BRICK_WALL.createBlockData();
|
||||||
|
List<Cuboid> cuboidList = new ArrayList<>();
|
||||||
|
cuboidList.add(pixelCuboid(4, 0, 4, 8, 24, 8));
|
||||||
|
if (nz == 1) {
|
||||||
|
fence.setFace(BlockFace.NORTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(5, 0, 0, 6, 24, 4));
|
||||||
|
}
|
||||||
|
if (pz == 1) {
|
||||||
|
fence.setFace(BlockFace.SOUTH, true);
|
||||||
|
cuboidList.add(pixelCuboid(5, 0, 12, 6, 24, 4));
|
||||||
|
}
|
||||||
|
if (nx == 1) {
|
||||||
|
fence.setFace(BlockFace.WEST, true);
|
||||||
|
cuboidList.add(pixelCuboid(0, 0, 5, 4, 24, 6));
|
||||||
|
}
|
||||||
|
if (px == 1) {
|
||||||
|
fence.setFace(BlockFace.EAST, true);
|
||||||
|
cuboidList.add(pixelCuboid(12, 0, 5, 4, 24, 6));
|
||||||
|
}
|
||||||
|
new BlockBoundingBox(fence, cuboidList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -32,6 +32,7 @@ import org.bukkit.block.data.BlockData;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class CreatingInnerBlocksState implements LaufbauState {
|
public class CreatingInnerBlocksState implements LaufbauState {
|
||||||
|
|
||||||
@ -73,16 +74,19 @@ public class CreatingInnerBlocksState implements LaufbauState {
|
|||||||
List<Cuboid> neededCuboids = intersectedCuboid.get(point);
|
List<Cuboid> neededCuboids = intersectedCuboid.get(point);
|
||||||
List<BlockBoundingBox> blockDataWithBoundingBoxList = new ArrayList<>();
|
List<BlockBoundingBox> blockDataWithBoundingBoxList = new ArrayList<>();
|
||||||
for (BlockBoundingBox blockDataWithBoundingBox : elements) {
|
for (BlockBoundingBox blockDataWithBoundingBox : elements) {
|
||||||
Cuboid tempCuboid = blockDataWithBoundingBox.cuboid.add(point);
|
List<Cuboid> cuboids = blockDataWithBoundingBox.getCuboidList().stream().map(c -> c.add(point)).collect(Collectors.toList());
|
||||||
|
|
||||||
|
/*
|
||||||
List<Cuboid> extendedCuboids = null;
|
List<Cuboid> extendedCuboids = null;
|
||||||
if (tempCuboid.getDy() > 1) {
|
if (cuboids.stream().anyMatch(cuboid -> cuboid.getDy() > 1)) {
|
||||||
extendedCuboids = cuboidList;
|
extendedCuboids = cuboidList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
boolean isInCuboid = false;
|
boolean isInCuboid = false;
|
||||||
for (Cuboid cuboid : extendedCuboids == null ? neededCuboids : extendedCuboids) {
|
for (Cuboid cuboid : /*extendedCuboids == null ? neededCuboids : extendedCuboids*/ neededCuboids) {
|
||||||
if (cuboid.intersects(tempCuboid)) {
|
if (cuboids.stream().anyMatch(cuboid::intersects)) {
|
||||||
isInCuboid = true;
|
isInCuboid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -122,11 +126,5 @@ public class CreatingInnerBlocksState implements LaufbauState {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
BlockData finalHighestBlockData = highestBlockData;
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
|
||||||
player.sendBlockChange(location, finalHighestBlockData);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,11 +79,5 @@ public class CreatingOuterBlocksState implements LaufbauState {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
// ingored
|
// ingored
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
BlockData fullBlock = Material.STONE.createBlockData();
|
|
||||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
|
||||||
player.sendBlockChange(location, fullBlock);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import java.util.*;
|
|||||||
public class SplittingPointsState implements LaufbauState {
|
public class SplittingPointsState implements LaufbauState {
|
||||||
|
|
||||||
private static final Cuboid ONE = new Cuboid(0, 0, 0, 1, 1, 1);
|
private static final Cuboid ONE = new Cuboid(0, 0, 0, 1, 1, 1);
|
||||||
|
private static final Cuboid ABOVE_HALF = new Cuboid(0, 1, 0, 1, 0.5, 1);
|
||||||
|
|
||||||
private List<Point> blocks;
|
private List<Point> blocks;
|
||||||
private int totalBlocks;
|
private int totalBlocks;
|
||||||
@ -65,12 +66,16 @@ public class SplittingPointsState implements LaufbauState {
|
|||||||
Point point = blocks.remove(0);
|
Point point = blocks.remove(0);
|
||||||
boolean isInCuboid = false;
|
boolean isInCuboid = false;
|
||||||
Cuboid tempCuboid = ONE.add(point);
|
Cuboid tempCuboid = ONE.add(point);
|
||||||
|
Cuboid aboveHalfTempCuboid = ABOVE_HALF.add(point);
|
||||||
List<Cuboid> intersectedCuboids = new ArrayList<>();
|
List<Cuboid> intersectedCuboids = new ArrayList<>();
|
||||||
for (Cuboid cuboid : cuboidList) {
|
for (Cuboid cuboid : cuboidList) {
|
||||||
if (cuboid.intersects(tempCuboid)) {
|
if (cuboid.intersects(tempCuboid)) {
|
||||||
isInCuboid = true;
|
isInCuboid = true;
|
||||||
intersectedCuboids.add(cuboid);
|
intersectedCuboids.add(cuboid);
|
||||||
}
|
}
|
||||||
|
if (cuboid.intersects(aboveHalfTempCuboid)) {
|
||||||
|
intersectedCuboids.add(cuboid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isInCuboid) {
|
if (!isInCuboid) {
|
||||||
outerPoints.add(point);
|
outerPoints.add(point);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren