Update to Minecraft 1.20.5

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2024-04-24 01:15:00 +10:00
parent 899f2acb84
commit f3502f6dac
54 changed files with 1814 additions and 741 deletions

View File

@@ -0,0 +1,12 @@
package org.bukkit.block;
import org.bukkit.MinecraftExperimental;
import org.jetbrains.annotations.ApiStatus;
/**
* Represents a captured state of a trial spawner.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface Vault extends TileState {
}

View File

@@ -3,6 +3,7 @@ package org.bukkit.block.banner;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Keyed;
import org.bukkit.MinecraftExperimental;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.jetbrains.annotations.Contract;
@@ -50,7 +51,11 @@ public enum PatternType implements Keyed {
FLOWER("flo", "flower"),
MOJANG("moj", "mojang"),
GLOBE("glb", "globe"),
PIGLIN("pig", "piglin");
PIGLIN("pig", "piglin"),
@MinecraftExperimental
FLOW("flw", "flow"),
@MinecraftExperimental
GUSTER("gus", "guster");
private final String identifier;
private final NamespacedKey key;
@@ -82,7 +87,7 @@ public enum PatternType implements Keyed {
* @deprecated magic value
*/
@NotNull
@Deprecated
@Deprecated(forRemoval = true)
public String getIdentifier() {
return identifier;
}
@@ -98,7 +103,7 @@ public enum PatternType implements Keyed {
*/
@Contract("null -> null")
@Nullable
@Deprecated
@Deprecated(forRemoval = true)
public static PatternType getByIdentifier(@Nullable String identifier) {
return byString.get(identifier);
}

View File

@@ -7,6 +7,8 @@ import org.jetbrains.annotations.NotNull;
/**
* 'trial_spawner_state' indicates the current operational phase of the spawner.
* <br>
* 'ominous' indicates if the block has ominous effects.
*/
@MinecraftExperimental
@ApiStatus.Experimental
@@ -27,6 +29,20 @@ public interface TrialSpawner extends BlockData {
*/
void setTrialSpawnerState(@NotNull State state);
/**
* Gets the value of the 'ominous' property.
*
* @return the 'ominous' value
*/
boolean isOminous();
/**
* Sets the value of the 'ominous' property.
*
* @param ominous the new 'ominous' value
*/
void setOminous(boolean ominous);
public enum State {
INACTIVE,

View File

@@ -0,0 +1,53 @@
package org.bukkit.block.data.type;
import org.bukkit.MinecraftExperimental;
import org.bukkit.block.data.Directional;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* 'vault_state' indicates the current operational phase of the vault block.
* <br>
* 'ominous' indicates if the block has ominous effects.
*/
@MinecraftExperimental
@ApiStatus.Experimental
public interface Vault extends Directional {
/**
* Gets the value of the 'vault_state' property.
*
* @return the 'vault_state' value
*/
@NotNull
State getTrialSpawnerState();
/**
* Sets the value of the 'vault_state' property.
*
* @param state the new 'vault_state' value
*/
void setTrialSpawnerState(@NotNull State state);
/**
* Gets the value of the 'ominous' property.
*
* @return the 'ominous' value
*/
boolean isOminous();
/**
* Sets the value of the 'ominous' property.
*
* @param ominous the new 'ominous' value
*/
void setOminous(boolean ominous);
public enum State {
INACTIVE,
ACTIVE,
UNLOCKING,
EJECTING
}
}

View File

@@ -1,7 +1,11 @@
package org.bukkit.block.spawner;
import com.google.common.base.Preconditions;
import java.util.Map;
import org.bukkit.entity.EntitySnapshot;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.loot.LootTable;
import org.bukkit.loot.LootTables;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -13,13 +17,19 @@ public class SpawnerEntry {
private EntitySnapshot snapshot;
private int spawnWeight;
private SpawnRule spawnRule;
private Equipment equipment;
public SpawnerEntry(@NotNull EntitySnapshot snapshot, int spawnWeight, @Nullable SpawnRule spawnRule) {
this(snapshot, spawnWeight, spawnRule, null);
}
public SpawnerEntry(@NotNull EntitySnapshot snapshot, int spawnWeight, @Nullable SpawnRule spawnRule, @Nullable Equipment equipment) {
Preconditions.checkArgument(snapshot != null, "Snapshot cannot be null");
this.snapshot = snapshot;
this.spawnWeight = spawnWeight;
this.spawnRule = spawnRule;
this.equipment = equipment;
}
/**
@@ -82,4 +92,75 @@ public class SpawnerEntry {
public void setSpawnRule(@Nullable SpawnRule spawnRule) {
this.spawnRule = spawnRule;
}
/**
* Gets the equipment which will be applied to the spawned entity.
*
* @return the equipment, or null
*/
@Nullable
public Equipment getEquipment() {
return equipment;
}
/**
* Sets the equipment which will be applied to the spawned entity.
*
* @param equipment new equipment, or null
*/
public void setEquipment(@Nullable Equipment equipment) {
this.equipment = equipment;
}
/**
* Represents the equipment loot table applied to a spawned entity.
*/
public static class Equipment {
private LootTable equipmentLootTable;
private final Map<EquipmentSlot, Float> dropChances;
public Equipment(@NotNull LootTable equipmentLootTable, @NotNull Map<EquipmentSlot, Float> dropChances) {
this.equipmentLootTable = equipmentLootTable;
this.dropChances = dropChances;
}
/**
* Set the loot table for the entity.
* <br>
* To remove a loot table use null. Do not use {@link LootTables#EMPTY}
* to clear a LootTable.
*
* @param table this {@link org.bukkit.entity.Mob} will have.
*/
public void setEquipmentLootTable(@NotNull LootTable table) {
this.equipmentLootTable = table;
}
/**
* Gets the loot table for the entity.
* <br>
*
* If an entity does not have a loot table, this will return null, NOT
* an empty loot table.
*
* @return the loot table for this entity.
*/
@NotNull
public LootTable getEquipmentLootTable() {
return this.equipmentLootTable;
}
/**
* Gets a mutable map of the drop chances for each slot of the entity.
* If non-null, the entity's drop chances will be overridden with the
* given value.
*
* @return mutable map of drop chances
*/
@NotNull
public Map<EquipmentSlot, Float> getDropChances() {
return this.dropChances;
}
}
}