mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2024-11-12 10:04:44 +01:00
Better structures.
This commit is contained in:
parent
c30841440b
commit
87fb333753
2
pom.xml
2
pom.xml
@ -59,7 +59,7 @@
|
||||
<powermock.version>2.0.9</powermock.version>
|
||||
<!-- More visible way how to change dependency versions -->
|
||||
<spigot.version>1.19.3-R0.1-SNAPSHOT</spigot.version>
|
||||
<bentobox.version>1.22.0-SNAPSHOT</bentobox.version>
|
||||
<bentobox.version>1.22.1-SNAPSHOT</bentobox.version>
|
||||
<!-- Revision variable removes warning about dynamic version -->
|
||||
<revision>${build.version}-SNAPSHOT</revision>
|
||||
<!-- Do not change unless you want different name for local builds. -->
|
||||
|
@ -87,8 +87,6 @@ public class Boxed extends GameModeAddon {
|
||||
new AdminPlaceStructureCommand(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean loadSettings() {
|
||||
@ -183,7 +181,7 @@ public class Boxed extends GameModeAddon {
|
||||
// This creates a vanilla base world with biomes
|
||||
AbstractBoxedChunkGenerator seedBaseGen = new BoxedSeedChunkGenerator(this, Environment.NETHER);
|
||||
baseWorldNether = WorldCreator
|
||||
.name(SEED+NETHER+BASE)
|
||||
.name(worldName + "/" + SEED+NETHER+BASE)
|
||||
.generator(seedBaseGen)
|
||||
.environment(Environment.NETHER)
|
||||
.seed(getSettings().getSeed())
|
||||
@ -196,7 +194,7 @@ public class Boxed extends GameModeAddon {
|
||||
log("Creating Boxed Biomed Nether world ...");
|
||||
|
||||
seedWorldNether = WorldCreator
|
||||
.name(SEED+NETHER)
|
||||
.name(worldName + "/" + SEED+NETHER)
|
||||
.generator(new BoxedSeedChunkGenerator(this, Environment.NETHER, new NetherSeedBiomeGenerator(this, seedBaseGen)))
|
||||
.environment(Environment.NETHER)
|
||||
.seed(getSettings().getSeed())
|
||||
@ -219,7 +217,7 @@ public class Boxed extends GameModeAddon {
|
||||
// This creates a vanilla base world with biomes
|
||||
AbstractBoxedChunkGenerator seedBaseGen = new BoxedSeedChunkGenerator(this, Environment.NORMAL);
|
||||
baseWorld = WorldCreator
|
||||
.name(SEED+BASE)
|
||||
.name(worldName + "/" + SEED+BASE)
|
||||
.generator(seedBaseGen)
|
||||
.environment(Environment.NORMAL)
|
||||
.seed(getSettings().getSeed())
|
||||
@ -232,7 +230,7 @@ public class Boxed extends GameModeAddon {
|
||||
log("Creating Boxed Biomed world ...");
|
||||
|
||||
seedWorld = WorldCreator
|
||||
.name(SEED)
|
||||
.name(worldName + "/" + SEED)
|
||||
.generator(new BoxedSeedChunkGenerator(this, Environment.NORMAL, new SeedBiomeGenerator(this, seedBaseGen)))
|
||||
.environment(Environment.NORMAL)
|
||||
.seed(getSettings().getSeed())
|
||||
@ -395,4 +393,8 @@ public class Boxed extends GameModeAddon {
|
||||
return boxedBlockPopulator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsesNewChunkGeneration() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -76,51 +76,11 @@ public class Settings implements WorldSettings {
|
||||
@ConfigEntry(path = "world.generator.seed", needsReset = true)
|
||||
private long seed = 602103456450L;
|
||||
|
||||
@ConfigComment("Area seed center. This is where the areas are copied from.")
|
||||
@ConfigEntry(path = "world.generator.seed-start.normal.x")
|
||||
private int seedX = 0;
|
||||
@ConfigEntry(path = "world.generator.seed-start.normal.z")
|
||||
private int seedZ = 0;
|
||||
|
||||
@ConfigComment("Nether area seed center. This is where the areas are copied from.")
|
||||
@ConfigEntry(path = "world.generator.seed-start.nether.x")
|
||||
private int netherSeedX = 0;
|
||||
@ConfigEntry(path = "world.generator.seed-start.nether.z")
|
||||
private int netherSeedZ = 0;
|
||||
|
||||
@ConfigComment("End area seed center. This is where the areas are copied from.")
|
||||
@ConfigEntry(path = "world.generator.seed-start.end.x")
|
||||
private int endSeedX = 0;
|
||||
@ConfigEntry(path = "world.generator.seed-start.end.z")
|
||||
private int endSeedZ = 0;
|
||||
|
||||
@ConfigComment("World difficulty setting - PEACEFUL, EASY, NORMAL, HARD")
|
||||
@ConfigComment("Other plugins may override this setting")
|
||||
@ConfigEntry(path = "world.difficulty")
|
||||
private Difficulty difficulty = Difficulty.NORMAL;
|
||||
|
||||
@ConfigComment("Generate surface")
|
||||
@ConfigEntry(path = "world.generator.generate-surface", needsRestart = true)
|
||||
private boolean generateSurface = true;
|
||||
|
||||
@ConfigComment("Generate caves")
|
||||
@ConfigEntry(path = "world.generator.generate-caves", needsRestart = true)
|
||||
private boolean generateCaves = true;
|
||||
|
||||
@ConfigComment("Generate Decorations")
|
||||
@ConfigEntry(path = "world.generator.generate-decorations", needsRestart = true)
|
||||
private boolean generateDecorations = true;
|
||||
|
||||
@ConfigComment("Generate mobs")
|
||||
@ConfigEntry(path = "world.generator.generate-mobs", needsRestart = true)
|
||||
private boolean generateMobs = true;
|
||||
|
||||
@ConfigComment("Allow surface structures - villages, shipwrecks, broken portals, etc.")
|
||||
@ConfigComment("These will be randomly placed, so may not be available for every player.")
|
||||
@ConfigEntry(path = "world.generator.allow-structures", needsRestart = true)
|
||||
private boolean allowStructures = true;
|
||||
|
||||
|
||||
@ConfigComment("Spawn limits. These override the limits set in bukkit.yml")
|
||||
@ConfigComment("If set to a negative number, the server defaults will be used")
|
||||
@ConfigEntry(path = "world.spawn-limits.monsters")
|
||||
@ -161,21 +121,11 @@ public class Settings implements WorldSettings {
|
||||
@ConfigEntry(path = "world.start-z")
|
||||
private int islandStartZ = 0;
|
||||
|
||||
@ConfigComment("Area height - Lowest is 5.")
|
||||
@ConfigComment("It is the y coordinate of the bedrock block in the blueprint.")
|
||||
@ConfigEntry(path = "world.area-height")
|
||||
private int islandHeight = 5;
|
||||
|
||||
@ConfigComment("Maximum number of player areas in the world. Set to -1 or 0 for unlimited.")
|
||||
@ConfigComment("If the number of areas is greater than this number, it will stop players from joining the world.")
|
||||
@ConfigEntry(path = "world.max-areas")
|
||||
private int maxIslands = -1;
|
||||
|
||||
@ConfigComment("The default game mode for this world. Players will be set to this mode when they create")
|
||||
@ConfigComment("a new area for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR")
|
||||
@ConfigEntry(path = "world.default-game-mode")
|
||||
private GameMode defaultGameMode = GameMode.SURVIVAL;
|
||||
|
||||
@ConfigComment("The maximum number of players a player can ban at any one time in this game mode.")
|
||||
@ConfigComment("The permission boxed.ban.maxlimit.X where X is a number can also be used per player")
|
||||
@ConfigComment("-1 = unlimited")
|
||||
@ -191,13 +141,6 @@ public class Settings implements WorldSettings {
|
||||
@ConfigEntry(path = "world.nether.generate")
|
||||
private boolean netherGenerate = true;
|
||||
|
||||
@ConfigComment("Nether spawn protection radius - this is the distance around the nether spawn")
|
||||
@ConfigComment("that will be public from player interaction (breaking blocks, pouring lava etc.)")
|
||||
@ConfigComment("Minimum is 0 (not recommended), maximum is 100. Default is 25.")
|
||||
@ConfigComment("Only applies to vanilla nether")
|
||||
@ConfigEntry(path = "world.nether.spawn-radius")
|
||||
private int netherSpawnRadius = 32;
|
||||
|
||||
@ConfigComment("This option indicates if nether portals should be linked via dimensions.")
|
||||
@ConfigComment("Option will simulate vanilla portal mechanics that links portals together")
|
||||
@ConfigComment("or creates a new portal, if there is not a portal in that dimension.")
|
||||
@ -205,7 +148,7 @@ public class Settings implements WorldSettings {
|
||||
private boolean makeNetherPortals = false;
|
||||
|
||||
// End
|
||||
@ConfigComment("End Nether - if this is false, the end world will not be made and access to")
|
||||
@ConfigComment("End World - if this is false, the end world will not be made and access to")
|
||||
@ConfigComment("the end will not occur. Other plugins may still enable portal usage.")
|
||||
@ConfigEntry(path = "world.end.generate")
|
||||
private boolean endGenerate = true;
|
||||
@ -369,7 +312,7 @@ public class Settings implements WorldSettings {
|
||||
@ConfigComment("Grant these advancements")
|
||||
@ConfigEntry(path = "area.reset.on-leave.grant-advancements")
|
||||
private List<String> onLeaveGrantAdvancements = new ArrayList<>();
|
||||
|
||||
|
||||
@ConfigComment("Toggles the automatic area creation upon the player's first login on your server.")
|
||||
@ConfigComment("If set to true,")
|
||||
@ConfigComment(" * Upon connecting to your server for the first time, the player will be told that")
|
||||
@ -412,13 +355,6 @@ public class Settings implements WorldSettings {
|
||||
@ConfigEntry(path = "area.teleport-player-to-area-when-created")
|
||||
private boolean teleportPlayerToIslandUponIslandCreation = true;
|
||||
|
||||
@ConfigComment("Create Nether or End areas if they are missing when a player goes through a portal.")
|
||||
@ConfigComment("Nether and End areas are usually pasted when a player makes their area, but if they are")
|
||||
@ConfigComment("missing for some reason, you can switch this on.")
|
||||
@ConfigComment("Note that bedrock removal glitches can exploit this option.")
|
||||
@ConfigEntry(path = "area.create-missing-nether-end-areas")
|
||||
private boolean pasteMissingIslands = false;
|
||||
|
||||
// Commands
|
||||
@ConfigComment("List of commands to run when a player joins an area or creates one.")
|
||||
@ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,")
|
||||
@ -464,14 +400,14 @@ public class Settings implements WorldSettings {
|
||||
private List<String> onRespawnCommands = new ArrayList<>();
|
||||
|
||||
// Sethome
|
||||
@ConfigComment("Allow setting home in the nether. Only available on nether areas, not vanilla nether.")
|
||||
@ConfigComment("Allow setting home in the nether.")
|
||||
@ConfigEntry(path = "area.sethome.nether.allow")
|
||||
private boolean allowSetHomeInNether = true;
|
||||
|
||||
@ConfigEntry(path = "area.sethome.nether.require-confirmation")
|
||||
private boolean requireConfirmationToSetHomeInNether = true;
|
||||
|
||||
@ConfigComment("Allow setting home in the end. Only available on end areas, not vanilla end.")
|
||||
@ConfigComment("Allow setting home in the end.")
|
||||
@ConfigEntry(path = "area.sethome.the-end.allow")
|
||||
private boolean allowSetHomeInTheEnd = true;
|
||||
|
||||
@ -503,7 +439,7 @@ public class Settings implements WorldSettings {
|
||||
@ConfigEntry(path = "protection.geo-limit-settings")
|
||||
private List<String> geoLimitSettings = new ArrayList<>();
|
||||
|
||||
@ConfigComment("Boxed blocked mobs.")
|
||||
@ConfigComment("Blocked mobs.")
|
||||
@ConfigComment("List of mobs that should not spawn in Boxed.")
|
||||
@ConfigEntry(path = "protection.block-mobs")
|
||||
private List<String> mobLimitSettings = new ArrayList<>();
|
||||
@ -596,7 +532,7 @@ public class Settings implements WorldSettings {
|
||||
*/
|
||||
@Override
|
||||
public int getIslandHeight() {
|
||||
return islandHeight;
|
||||
return 5;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -628,7 +564,7 @@ public class Settings implements WorldSettings {
|
||||
*/
|
||||
@Override
|
||||
public GameMode getDefaultGameMode() {
|
||||
return defaultGameMode;
|
||||
return GameMode.SURVIVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -652,7 +588,7 @@ public class Settings implements WorldSettings {
|
||||
*/
|
||||
@Override
|
||||
public int getNetherSpawnRadius() {
|
||||
return netherSpawnRadius;
|
||||
return 32;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -990,13 +926,6 @@ public class Settings implements WorldSettings {
|
||||
this.islandStartZ = islandStartZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param islandHeight the islandHeight to set
|
||||
*/
|
||||
public void setIslandHeight(int islandHeight) {
|
||||
this.islandHeight = islandHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param maxIslands the maxIslands to set
|
||||
*/
|
||||
@ -1004,13 +933,6 @@ public class Settings implements WorldSettings {
|
||||
this.maxIslands = maxIslands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param defaultGameMode the defaultGameMode to set
|
||||
*/
|
||||
public void setDefaultGameMode(GameMode defaultGameMode) {
|
||||
this.defaultGameMode = defaultGameMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param netherGenerate the netherGenerate to set
|
||||
*/
|
||||
@ -1018,13 +940,6 @@ public class Settings implements WorldSettings {
|
||||
this.netherGenerate = netherGenerate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param netherSpawnRadius the netherSpawnRadius to set
|
||||
*/
|
||||
public void setNetherSpawnRadius(int netherSpawnRadius) {
|
||||
this.netherSpawnRadius = netherSpawnRadius;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param endGenerate the endGenerate to set
|
||||
*/
|
||||
@ -1465,14 +1380,7 @@ public class Settings implements WorldSettings {
|
||||
*/
|
||||
@Override
|
||||
public boolean isPasteMissingIslands() {
|
||||
return pasteMissingIslands;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pasteMissingIslands the pasteMissingIslands to set
|
||||
*/
|
||||
public void setPasteMissingIslands(boolean pasteMissingIslands) {
|
||||
this.pasteMissingIslands = pasteMissingIslands;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1673,20 +1581,6 @@ public class Settings implements WorldSettings {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the allowStructures
|
||||
*/
|
||||
public boolean isAllowStructures() {
|
||||
return allowStructures;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allowStructures the allowStructures to set
|
||||
*/
|
||||
public void setAllowStructures(boolean allowStructures) {
|
||||
this.allowStructures = allowStructures;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the onJoinResetAdvancements
|
||||
*/
|
||||
@ -1773,62 +1667,6 @@ public class Settings implements WorldSettings {
|
||||
this.broadcastAdvancements = broadcastAdvancements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the generateSurface
|
||||
*/
|
||||
public boolean isGenerateSurface() {
|
||||
return generateSurface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param generateSurface the generateSurface to set
|
||||
*/
|
||||
public void setGenerateSurface(boolean generateSurface) {
|
||||
this.generateSurface = generateSurface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the generateCaves
|
||||
*/
|
||||
public boolean isGenerateCaves() {
|
||||
return generateCaves;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param generateCaves the generateCaves to set
|
||||
*/
|
||||
public void setGenerateCaves(boolean generateCaves) {
|
||||
this.generateCaves = generateCaves;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the generateDecorations
|
||||
*/
|
||||
public boolean isGenerateDecorations() {
|
||||
return generateDecorations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param generateDecorations the generateDecorations to set
|
||||
*/
|
||||
public void setGenerateDecorations(boolean generateDecorations) {
|
||||
this.generateDecorations = generateDecorations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the generateMobs
|
||||
*/
|
||||
public boolean isGenerateMobs() {
|
||||
return generateMobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param generateMobs the generateMobs to set
|
||||
*/
|
||||
public void setGenerateMobs(boolean generateMobs) {
|
||||
this.generateMobs = generateMobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the denyVisitorAdvancements
|
||||
*/
|
||||
@ -1847,85 +1685,42 @@ public class Settings implements WorldSettings {
|
||||
* @return the seedX
|
||||
*/
|
||||
public int getSeedX() {
|
||||
return seedX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param seedX the seedX to set
|
||||
*/
|
||||
public void setSeedX(int seedX) {
|
||||
this.seedX = seedX;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the seedZ
|
||||
*/
|
||||
public int getSeedZ() {
|
||||
return seedZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param seedZ the seedZ to set
|
||||
*/
|
||||
public void setSeedZ(int seedZ) {
|
||||
this.seedZ = seedZ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the netherSeedX
|
||||
*/
|
||||
public int getNetherSeedX() {
|
||||
return netherSeedX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param netherSeedX the netherSeedX to set
|
||||
*/
|
||||
public void setNetherSeedX(int netherSeedX) {
|
||||
this.netherSeedX = netherSeedX;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the netherSeedZ
|
||||
*/
|
||||
public int getNetherSeedZ() {
|
||||
return netherSeedZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param netherSeedZ the netherSeedZ to set
|
||||
*/
|
||||
public void setNetherSeedZ(int netherSeedZ) {
|
||||
this.netherSeedZ = netherSeedZ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endSeedX
|
||||
*/
|
||||
public int getEndSeedX() {
|
||||
return endSeedX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param endSeedX the endSeedX to set
|
||||
*/
|
||||
public void setEndSeedX(int endSeedX) {
|
||||
this.endSeedX = endSeedX;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endSeedZ
|
||||
*/
|
||||
public int getEndSeedZ() {
|
||||
return endSeedZ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param endSeedZ the endSeedZ to set
|
||||
*/
|
||||
public void setEndSeedZ(int endSeedZ) {
|
||||
this.endSeedZ = endSeedZ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -125,7 +125,8 @@ public abstract class AbstractBoxedChunkGenerator extends ChunkGenerator {
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateMobs() {
|
||||
return this.addon.getSettings().isGenerateMobs();
|
||||
return true;
|
||||
//return this.addon.getSettings().isGenerateMobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,6 +44,8 @@ import net.minecraft.world.level.block.entity.TileEntity;
|
||||
import world.bentobox.bentobox.BentoBox;
|
||||
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
|
||||
import world.bentobox.bentobox.api.events.island.IslandCreatedEvent;
|
||||
import world.bentobox.bentobox.api.events.island.IslandDeleteEvent;
|
||||
import world.bentobox.bentobox.api.events.island.IslandResettedEvent;
|
||||
import world.bentobox.bentobox.database.objects.Island;
|
||||
import world.bentobox.bentobox.util.Pair;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
@ -57,6 +59,7 @@ import world.bentobox.boxed.objects.BoxedStructureBlock;
|
||||
*/
|
||||
public class NewAreaListener implements Listener {
|
||||
|
||||
private static final List<BlockFace> CARDINALS = List.of(BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST);
|
||||
private final Boxed addon;
|
||||
private File structureFile;
|
||||
private Queue<Item> itemsToBuild = new LinkedList<>();
|
||||
@ -103,7 +106,7 @@ public class NewAreaListener implements Listener {
|
||||
for (String struct : list) {
|
||||
Structure s = Bukkit.getStructureManager().loadStructure(NamespacedKey.fromString(struct));
|
||||
if (s == null) {
|
||||
BentoBox.getInstance().log("Now loading group from: " + struct);
|
||||
//addon.log("Now loading group from: " + struct);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,7 +115,15 @@ public class NewAreaListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onIslandCreated(IslandCreatedEvent event) {
|
||||
Island island = event.getIsland();
|
||||
setUpIsland(event.getIsland());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onIslandReset(IslandResettedEvent event) {
|
||||
setUpIsland(event.getIsland());
|
||||
}
|
||||
|
||||
private void setUpIsland(Island island) {
|
||||
// Check if this island is in this game
|
||||
if (!(addon.inWorld(island.getWorld()))) {
|
||||
return;
|
||||
@ -128,6 +139,7 @@ public class NewAreaListener implements Listener {
|
||||
place("structure",config.getConfigurationSection(env), center, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void place(String string, ConfigurationSection section, Location center, Environment env) {
|
||||
@ -163,7 +175,7 @@ public class NewAreaListener implements Listener {
|
||||
Location l = new Location(world, x, y, z);
|
||||
itemsToBuild.add(new Item(name, s, l, rot, mirror));
|
||||
} else {
|
||||
addon.logError("Structure file syntax error: " + name + " " + vector);
|
||||
addon.logError("Structure file syntax error: " + vector + ": " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,7 +216,7 @@ public class NewAreaListener implements Listener {
|
||||
Block b = loc.getWorld().getBlockAt(x, y, z);
|
||||
if (b.getType().equals(Material.JIGSAW)) {
|
||||
// I would like to read the data from the block and do something with it!
|
||||
processJigsaw(b);
|
||||
processJigsaw(b, structureRotation);
|
||||
} else if (b.getType().equals(Material.STRUCTURE_BLOCK)) {
|
||||
processStructureBlock(b);
|
||||
}
|
||||
@ -239,12 +251,15 @@ public class NewAreaListener implements Listener {
|
||||
}
|
||||
|
||||
private static final Map<Integer, EntityType> BUTCHER_ANIMALS = Map.of(0, EntityType.COW, 1, EntityType.SHEEP, 2, EntityType.PIG);
|
||||
private static void processJigsaw(Block b) {
|
||||
private static void processJigsaw(Block b, StructureRotation structureRotation) {
|
||||
String data = nmsData(b);
|
||||
BoxedJigsawBlock bjb = gson.fromJson(data, BoxedJigsawBlock.class);
|
||||
BentoBox.getInstance().logDebug("Jigsaw: " + bjb);
|
||||
BlockData bd = Bukkit.createBlockData(bjb.getFinal_state());
|
||||
b.setType(bd.getMaterial());
|
||||
//BentoBox.getInstance().logDebug("Jigsaw: " + bjb);
|
||||
//BentoBox.getInstance().logDebug("FinalState: " + bjb.getFinal_state());
|
||||
String finalState = correctDirection(bjb.getFinal_state(), structureRotation);
|
||||
//BentoBox.getInstance().logDebug("FinalState after rotation: " + finalState);
|
||||
BlockData bd = Bukkit.createBlockData(finalState);
|
||||
b.setBlockData(bd);
|
||||
EntityType type =
|
||||
switch (bjb.getPool()) {
|
||||
case "minecraft:bastion/mobs/piglin" -> EntityType.PIGLIN;
|
||||
@ -257,6 +272,7 @@ public class NewAreaListener implements Listener {
|
||||
case "minecraft:village/common/cows" -> EntityType.COW;
|
||||
case "minecraft:village/common/iron_golem" -> EntityType.IRON_GOLEM;
|
||||
case "minecraft:village/common/butcher_animals" -> BUTCHER_ANIMALS.get(new Random().nextInt(3));
|
||||
case "minecraft:village/common/animals" -> BUTCHER_ANIMALS.get(new Random().nextInt(3));
|
||||
default -> null;
|
||||
};
|
||||
if (bjb.getPool().contains("zombie/villagers")) {
|
||||
@ -266,11 +282,70 @@ public class NewAreaListener implements Listener {
|
||||
}
|
||||
// Spawn it
|
||||
if (type != null && b.getWorld().spawnEntity(b.getRelative(BlockFace.UP).getLocation(), type) != null) {
|
||||
BentoBox.getInstance().logDebug("Spawned a " + type + " at " + b.getRelative(BlockFace.UP).getLocation());
|
||||
//BentoBox.getInstance().logDebug("Spawned a " + type + " at " + b.getRelative(BlockFace.UP).getLocation());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Corrects the direction of a block based on the structure's rotation
|
||||
* @param finalState - the final block state of the block, which may include a facing: direction
|
||||
* @param sr - the structure's rotation
|
||||
* @return a rewritten blockstate with the updated direction, if required
|
||||
*/
|
||||
private static String correctDirection(String finalState, StructureRotation sr) {
|
||||
if (sr.equals(StructureRotation.NONE)) {
|
||||
// No change
|
||||
return finalState;
|
||||
}
|
||||
BlockFace oldDirection = getDirection(finalState);
|
||||
BlockFace newDirection = getNewDirection(oldDirection, sr);
|
||||
if (newDirection.equals(BlockFace.SELF)) {
|
||||
// No change - shouldn't happen, but just in case
|
||||
return finalState;
|
||||
}
|
||||
return finalState.replace(oldDirection.name().toLowerCase(Locale.ENGLISH), newDirection.name().toLowerCase(Locale.ENGLISH));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the direction based on the StructureRotation
|
||||
* @param oldDirection the old direction to adjust
|
||||
* @param sr the structure rotation
|
||||
* @return the new direction, or SELF if something weird happens
|
||||
*/
|
||||
private static BlockFace getNewDirection(BlockFace oldDirection, StructureRotation sr) {
|
||||
if (sr.equals(StructureRotation.CLOCKWISE_180)) {
|
||||
return oldDirection.getOppositeFace();
|
||||
} else if (sr.equals(StructureRotation.CLOCKWISE_90)) {
|
||||
return switch(oldDirection) {
|
||||
case EAST -> BlockFace.SOUTH;
|
||||
case NORTH -> BlockFace.EAST;
|
||||
case SOUTH -> BlockFace.WEST;
|
||||
case WEST -> BlockFace.NORTH;
|
||||
default -> BlockFace.SELF;
|
||||
};
|
||||
} else if (sr.equals(StructureRotation.COUNTERCLOCKWISE_90)) {
|
||||
return switch(oldDirection) {
|
||||
case EAST -> BlockFace.NORTH;
|
||||
case NORTH -> BlockFace.WEST;
|
||||
case SOUTH -> BlockFace.EAST;
|
||||
case WEST -> BlockFace.SOUTH;
|
||||
default -> BlockFace.SELF;
|
||||
};
|
||||
}
|
||||
return BlockFace.SELF;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks for north, south, east, west in the blockstate.
|
||||
* @param finalState - the final block state of the block
|
||||
* @return direction, if found, otherwise SELF
|
||||
*/
|
||||
private static BlockFace getDirection(String finalState) {
|
||||
return CARDINALS.stream().filter(bf -> finalState.contains(bf.name().toLowerCase(Locale.ENGLISH))).findFirst().orElse(BlockFace.SELF);
|
||||
}
|
||||
|
||||
private static String nmsData(Block block) {
|
||||
Location w = block.getLocation();
|
||||
CraftWorld cw = (CraftWorld) w.getWorld(); // CraftWorld is NMS one
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Boxed Configuration 2.0.2-SNAPSHOT-LOCAL
|
||||
# Boxed Configuration ${version}
|
||||
boxed:
|
||||
command:
|
||||
# Player Command. What command users will run to access their area.
|
||||
@ -31,35 +31,6 @@ world:
|
||||
# World seed.
|
||||
# /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds.
|
||||
seed: 602103456450
|
||||
seed-start:
|
||||
normal:
|
||||
# Area seed center. This is where the areas are copied from.
|
||||
x: 0
|
||||
z: 0
|
||||
nether:
|
||||
# Nether area seed center. This is where the areas are copied from.
|
||||
x: 0
|
||||
z: 0
|
||||
end:
|
||||
# End area seed center. This is where the areas are copied from.
|
||||
x: 0
|
||||
z: 0
|
||||
# Generate surface
|
||||
# /!\ In order to apply the changes made to this option, you must restart your server. Reloading BentoBox or the server won't work.
|
||||
generate-surface: true
|
||||
# Generate caves
|
||||
# /!\ In order to apply the changes made to this option, you must restart your server. Reloading BentoBox or the server won't work.
|
||||
generate-caves: true
|
||||
# Generate Decorations
|
||||
# /!\ In order to apply the changes made to this option, you must restart your server. Reloading BentoBox or the server won't work.
|
||||
generate-decorations: true
|
||||
# Generate mobs
|
||||
# /!\ In order to apply the changes made to this option, you must restart your server. Reloading BentoBox or the server won't work.
|
||||
generate-mobs: true
|
||||
# Allow surface structures - villages, shipwrecks, broken portals, etc.
|
||||
# These will be randomly placed, so may not be available for every player.
|
||||
# /!\ In order to apply the changes made to this option, you must restart your server. Reloading BentoBox or the server won't work.
|
||||
allow-structures: false
|
||||
# World difficulty setting - PEACEFUL, EASY, NORMAL, HARD
|
||||
# Other plugins may override this setting
|
||||
difficulty: NORMAL
|
||||
@ -90,15 +61,9 @@ world:
|
||||
# If none of this makes sense, leave it at 0,0.
|
||||
start-x: 0
|
||||
start-z: 0
|
||||
# Area height - Lowest is 5.
|
||||
# It is the y coordinate of the bedrock block in the blueprint.
|
||||
area-height: 8
|
||||
# Maximum number of player areas in the world. Set to -1 or 0 for unlimited.
|
||||
# If the number of areas is greater than this number, it will stop players from joining the world.
|
||||
max-areas: -1
|
||||
# The default game mode for this world. Players will be set to this mode when they create
|
||||
# a new area for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR
|
||||
default-game-mode: SURVIVAL
|
||||
# The maximum number of players a player can ban at any one time in this game mode.
|
||||
# The permission boxed.ban.maxlimit.X where X is a number can also be used per player
|
||||
# -1 = unlimited
|
||||
@ -110,18 +75,13 @@ world:
|
||||
# Note that with a standard nether all players arrive at the same portal and entering a
|
||||
# portal will return them back to their areas.
|
||||
generate: true
|
||||
# Nether spawn protection radius - this is the distance around the nether spawn
|
||||
# that will be public from player interaction (breaking blocks, pouring lava etc.)
|
||||
# Minimum is 0 (not recommended), maximum is 100. Default is 25.
|
||||
# Only applies to vanilla nether
|
||||
spawn-radius: 32
|
||||
# This option indicates if nether portals should be linked via dimensions.
|
||||
# Option will simulate vanilla portal mechanics that links portals together
|
||||
# or creates a new portal, if there is not a portal in that dimension.
|
||||
# Added since 1.0.3.
|
||||
create-and-link-portals: true
|
||||
end:
|
||||
# End Nether - if this is false, the end world will not be made and access to
|
||||
# End World - if this is false, the end world will not be made and access to
|
||||
# the end will not occur. Other plugins may still enable portal usage.
|
||||
generate: false
|
||||
# Mob white list - these mobs will NOT be removed when logging in or doing /boxed
|
||||
@ -168,6 +128,7 @@ world:
|
||||
TRADING: true
|
||||
EGGS: false
|
||||
ITEM_DROP: true
|
||||
CHEST: false
|
||||
NOTE_BLOCK: true
|
||||
ENTER_EXIT_MESSAGES: true
|
||||
FLINT_AND_STEEL: false
|
||||
@ -242,8 +203,8 @@ world:
|
||||
BREAK_HOPPERS: 500
|
||||
FURNACE: 500
|
||||
MONSTER_SPAWNERS_SPAWN: 500
|
||||
ANVIL: 500
|
||||
MINECART: 500
|
||||
ANVIL: 500
|
||||
FISH_SCOOPING: 500
|
||||
FIRE_IGNITE: 500
|
||||
END_PORTAL: 500
|
||||
@ -255,11 +216,11 @@ world:
|
||||
BREAK_SPAWNERS: 500
|
||||
LEVER: 0
|
||||
ELYTRA: 0
|
||||
RIDING: 500
|
||||
CAKE: 500
|
||||
HURT_MONSTERS: 0
|
||||
RIDING: 500
|
||||
NAME_TAG: 500
|
||||
ARMOR_STAND: 500
|
||||
NAME_TAG: 500
|
||||
TRADING: 0
|
||||
EGGS: 500
|
||||
ITEM_DROP: 0
|
||||
@ -267,10 +228,10 @@ world:
|
||||
FLINT_AND_STEEL: 500
|
||||
NETHER_PORTAL: 0
|
||||
LECTERN: 500
|
||||
ITEM_PICKUP: 0
|
||||
CROP_TRAMPLE: 500
|
||||
BREWING: 500
|
||||
ITEM_PICKUP: 0
|
||||
DROPPER: 500
|
||||
BREWING: 500
|
||||
TNT_PRIMING: 500
|
||||
COLLECT_WATER: 500
|
||||
BUTTON: 0
|
||||
@ -278,18 +239,18 @@ world:
|
||||
COMMAND_RANKS: 500
|
||||
BEACON: 500
|
||||
TRAPDOOR: 500
|
||||
EXPERIENCE_BOTTLE_THROWING: 500
|
||||
PRESSURE_PLATE: 0
|
||||
EXPERIENCE_BOTTLE_THROWING: 500
|
||||
DYE: 500
|
||||
ITEM_FRAME: 500
|
||||
PLACE_BLOCKS: 500
|
||||
CRAFTING: 0
|
||||
ENCHANTING: 500
|
||||
ANIMAL_SPAWNERS_SPAWN: 500
|
||||
SHEARING: 500
|
||||
ANIMAL_SPAWNERS_SPAWN: 500
|
||||
ENCHANTING: 500
|
||||
BOAT: 0
|
||||
BED: 500
|
||||
SPAWN_EGGS: 500
|
||||
BED: 500
|
||||
MILKING: 500
|
||||
DISPENSER: 500
|
||||
GATE: 0
|
||||
@ -300,8 +261,8 @@ world:
|
||||
MOUNT_INVENTORY: 500
|
||||
CHORUS_FRUIT: 500
|
||||
CONTAINER: 500
|
||||
POTION_THROWING: 500
|
||||
JUKEBOX: 500
|
||||
POTION_THROWING: 500
|
||||
# These are the default settings for new areas
|
||||
default-area-settings:
|
||||
PVP_END: false
|
||||
@ -313,8 +274,8 @@ world:
|
||||
MONSTER_NATURAL_SPAWN: true
|
||||
FIRE_IGNITE: true
|
||||
FIRE_SPREAD: true
|
||||
ANIMAL_SPAWNERS_SPAWN: true
|
||||
FIRE_BURNING: true
|
||||
ANIMAL_SPAWNERS_SPAWN: true
|
||||
PVP_OVERWORLD: false
|
||||
# These settings/flags are hidden from users
|
||||
# Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings
|
||||
@ -446,11 +407,6 @@ area:
|
||||
# Toggles whether the player should be teleported automatically to his area when it is created.
|
||||
# If set to false, the player will be told his area is ready but will have to teleport to his area using the command.
|
||||
teleport-player-to-area-when-created: true
|
||||
# Create Nether or End areas if they are missing when a player goes through a portal.
|
||||
# Nether and End areas are usually pasted when a player makes their area, but if they are
|
||||
# missing for some reason, you can switch this on.
|
||||
# Note that bedrock removal glitches can exploit this option.
|
||||
create-missing-nether-end-areas: false
|
||||
commands:
|
||||
# List of commands to run when a player joins an area or creates one.
|
||||
# These commands are run by the console, unless otherwise stated using the [SUDO] prefix,
|
||||
@ -492,11 +448,11 @@ area:
|
||||
on-respawn: []
|
||||
sethome:
|
||||
nether:
|
||||
# Allow setting home in the nether. Only available on nether areas, not vanilla nether.
|
||||
# Allow setting home in the nether.
|
||||
allow: true
|
||||
require-confirmation: true
|
||||
the-end:
|
||||
# Allow setting home in the end. Only available on end areas, not vanilla end.
|
||||
# Allow setting home in the end.
|
||||
allow: true
|
||||
require-confirmation: true
|
||||
deaths:
|
||||
@ -512,7 +468,7 @@ protection:
|
||||
# Geo restrict mobs.
|
||||
# Mobs that exit the area space where they were spawned will be removed.
|
||||
geo-limit-settings: []
|
||||
# Boxed blocked mobs.
|
||||
# Blocked mobs.
|
||||
# List of mobs that should not spawn in Boxed.
|
||||
block-mobs: []
|
||||
# Invincible visitors. List of damages that will not affect visitors.
|
||||
|
@ -2,12 +2,15 @@ normal:
|
||||
0,64,80: village/plains/houses/plains_masons_house_1,CLOCKWISE_90
|
||||
-38,63,20: ruined_portal/portal_5
|
||||
3,58,-60: shipwreck/rightsideup_backhalf
|
||||
16,67,23: village/plains/houses/plains_cartographer_1
|
||||
-17,56,0: shipwreck/rightsideup_full_degraded,CLOCKWISE_180
|
||||
16,67,13: village/plains/houses/plains_cartographer_1
|
||||
-66,63,17: igloo/top
|
||||
-34,52,-35: underwater_ruin/warm_5
|
||||
80,71,113: pillager_outpost/watchtower
|
||||
-34,52,-35: underwater_ruin/warm_1
|
||||
33,69,-34: village/savanna/town_centers/savanna_meeting_point_1
|
||||
26,70,-41: village/savanna/houses/savanna_medium_house_2,NONE,NONE
|
||||
42,69,-21: village/savanna/houses/savanna_large_farm_2,NONE,NONE
|
||||
13,69,-37: village/savanna/houses/savanna_animal_pen_2,CLOCKWISE_180,NONE
|
||||
53,71,-23: village/savanna/houses/savanna_small_house_4,NONE,NONE
|
||||
34,69,-29: village/common/iron_golem
|
||||
41,69,-26: village/common/animals/cat_calico
|
||||
35,69,-22: village/common/animals/cat_calico
|
||||
@ -19,7 +22,13 @@ normal:
|
||||
15,70,108: village/desert/houses/desert_butcher_shop_1
|
||||
10,70,112: village/desert/houses/desert_temple_1,COUNTERCLOCKWISE_90
|
||||
-71,63,107: igloo/top
|
||||
-25,57,-30: shipwreck/rightsideup_full_degraded,CLOCKWISE_180
|
||||
80,71,113: pillager_outpost/watchtower
|
||||
15,67,16: village/plains/villagers/unemployed,NONE,NONE
|
||||
51,76,22: ruined_portal/portal_6,NONE,NONE
|
||||
-26,70,33: village/snowy/houses/snowy_library_1,CLOCKWISE_180,NONE
|
||||
-31,71,30: village/plains/villagers/unemployed,CLOCKWISE_180,NONE
|
||||
-3,65,84: village/plains/villagers/unemployed,CLOCKWISE_180,NONE
|
||||
|
||||
nether:
|
||||
16,32,0: bastion/bridge/starting_pieces/entrance
|
||||
62,33,-17: bastion/hoglin_stable/walls/wall_base
|
||||
|
@ -10,7 +10,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -90,15 +89,6 @@ public class SettingsTest {
|
||||
assertEquals(123, s.getIslandStartZ());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setIslandHeight(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetIslandHeight() {
|
||||
s.setIslandHeight(123);
|
||||
assertEquals(123, s.getIslandHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setMaxIslands(int)}.
|
||||
*/
|
||||
@ -108,15 +98,6 @@ public class SettingsTest {
|
||||
assertEquals(123, s.getMaxIslands());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setDefaultGameMode(org.bukkit.GameMode)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetDefaultGameMode() {
|
||||
s.setDefaultGameMode(GameMode.CREATIVE);
|
||||
assertEquals(GameMode.CREATIVE, s.getDefaultGameMode());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setNetherGenerate(boolean)}.
|
||||
*/
|
||||
@ -126,15 +107,6 @@ public class SettingsTest {
|
||||
assertTrue(s.isNetherGenerate());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setNetherSpawnRadius(int)}.
|
||||
*/
|
||||
@Test
|
||||
public void testSetNetherSpawnRadius() {
|
||||
s.setNetherSpawnRadius(123);
|
||||
assertEquals(123, s.getNetherSpawnRadius());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link world.bentobox.boxed.Settings#setEndGenerate(boolean)}.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user