SPIGOT-7011, SPIGOT-7065: Overhaul of structures

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
Bukkit/Spigot
2022-07-01 20:41:02 +10:00
parent 515ae6f2cc
commit 24ea881685
11 changed files with 289 additions and 1 deletions

View File

@@ -0,0 +1,61 @@
package org.bukkit.generator.structure;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.jetbrains.annotations.NotNull;
/**
* Represent a Structure from the world.
*
* Listed structures are present in the default server. Depending on the server
* there might be additional structures present (for example structures added by
* data packs), which can be received via {@link Registry#STRUCTURE}.
*/
public abstract class Structure implements Keyed {
public static final Structure PILLAGER_OUTPOST = getStructure("pillager_outpost");
public static final Structure MINESHAFT = getStructure("mineshaft");
public static final Structure MINESHAFT_MESA = getStructure("mineshaft_mesa");
public static final Structure MANSION = getStructure("mansion");
public static final Structure JUNGLE_PYRAMID = getStructure("jungle_pyramid");
public static final Structure DESERT_PYRAMID = getStructure("desert_pyramid");
public static final Structure IGLOO = getStructure("igloo");
public static final Structure SHIPWRECK = getStructure("shipwreck");
public static final Structure SHIPWRECK_BEACHED = getStructure("shipwreck_beached");
public static final Structure SWAMP_HUT = getStructure("swamp_hut");
public static final Structure STRONGHOLD = getStructure("stronghold");
public static final Structure MONUMENT = getStructure("monument");
public static final Structure OCEAN_RUIN_COLD = getStructure("ocean_ruin_cold");
public static final Structure OCEAN_RUIN_WARM = getStructure("ocean_ruin_warm");
public static final Structure FORTRESS = getStructure("fortress");
public static final Structure NETHER_FOSSIL = getStructure("nether_fossil");
public static final Structure END_CITY = getStructure("end_city");
public static final Structure BURIED_TREASURE = getStructure("buried_treasure");
public static final Structure BASTION_REMNANT = getStructure("bastion_remnant");
public static final Structure VILLAGE_PLAINS = getStructure("village_plains");
public static final Structure VILLAGE_DESERT = getStructure("village_desert");
public static final Structure VILLAGE_SAVANNA = getStructure("village_savanna");
public static final Structure VILLAGE_SNOWY = getStructure("village_snowy");
public static final Structure VILLAGE_TAIGA = getStructure("village_taiga");
public static final Structure RUINED_PORTAL = getStructure("ruined_portal");
public static final Structure RUINED_PORTAL_DESERT = getStructure("ruined_portal_desert");
public static final Structure RUINED_PORTAL_JUNGLE = getStructure("ruined_portal_jungle");
public static final Structure RUINED_PORTAL_SWAMP = getStructure("ruined_portal_swamp");
public static final Structure RUINED_PORTAL_MOUNTAIN = getStructure("ruined_portal_mountain");
public static final Structure RUINED_PORTAL_OCEAN = getStructure("ruined_portal_ocean");
public static final Structure RUINED_PORTAL_NETHER = getStructure("ruined_portal_nether");
public static final Structure ANCIENT_CITY = getStructure("ancient_city");
private static Structure getStructure(String name) {
return Registry.STRUCTURE.get(NamespacedKey.minecraft(name));
}
/**
* Returns the type of the structure.
*
* @return the type of structure
*/
@NotNull
public abstract StructureType getStructureType();
}

View File

@@ -0,0 +1,37 @@
package org.bukkit.generator.structure;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
/**
* Represent a StructureType of a {@link Structure}.
*
* Listed structure types are present in the default server. Depending on the
* server there might be additional structure types present (for example
* structure types added by data packs), which can be received via
* {@link Registry#STRUCTURE_TYPE}.
*/
public abstract class StructureType implements Keyed {
public static final StructureType BURIED_TREASURE = getStructureType("buried_treasure");
public static final StructureType DESERT_PYRAMID = getStructureType("desert_pyramid");
public static final StructureType END_CITY = getStructureType("end_city");
public static final StructureType FORTRESS = getStructureType("fortress");
public static final StructureType IGLOO = getStructureType("igloo");
public static final StructureType JIGSAW = getStructureType("jigsaw");
public static final StructureType JUNGLE_TEMPLE = getStructureType("jungle_temple");
public static final StructureType MINESHAFT = getStructureType("mineshaft");
public static final StructureType NETHER_FOSSIL = getStructureType("nether_fossil");
public static final StructureType OCEAN_MONUMENT = getStructureType("ocean_monument");
public static final StructureType OCEAN_RUIN = getStructureType("ocean_ruin");
public static final StructureType RUINED_PORTAL = getStructureType("ruined_portal");
public static final StructureType SHIPWRECK = getStructureType("shipwreck");
public static final StructureType STRONGHOLD = getStructureType("stronghold");
public static final StructureType SWAMP_HUT = getStructureType("swamp_hut");
public static final StructureType WOODLAND_MANSION = getStructureType("woodland_mansion");
private static StructureType getStructureType(String name) {
return Registry.STRUCTURE_TYPE.get(NamespacedKey.minecraft(name));
}
}

View File

@@ -0,0 +1,5 @@
/**
* Classes to facilitate world {@link org.bukkit.generator.structure.Structure}
* generation.
*/
package org.bukkit.generator.structure;