Merge branch 'master' into enums-to-registers

# Conflicts:
#	src/main/java/org/bukkit/GameEvent.java
#	src/main/java/org/bukkit/Sound.java
#	src/main/java/org/bukkit/Tag.java
This commit is contained in:
DerFrZocker 2023-09-23 15:35:59 +02:00
commit ada679e73f
No known key found for this signature in database
GPG key ID: 713F71FFFE1DDF91
14 changed files with 72 additions and 18 deletions

View file

@ -5,7 +5,7 @@
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.20.1-R0.1-SNAPSHOT</version> <version>1.20.2-R0.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Bukkit</name> <name>Bukkit</name>
@ -35,14 +35,14 @@
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<version>31.1-jre</version> <version>32.1.2-jre</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- bundled with Minecraft, should be kept in sync --> <!-- bundled with Minecraft, should be kept in sync -->
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>2.10</version> <version>2.10.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- bundled with Minecraft, should be kept in sync --> <!-- bundled with Minecraft, should be kept in sync -->
@ -55,7 +55,7 @@
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
<version>2.0</version> <version>2.2</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- not part of the API proper --> <!-- not part of the API proper -->

View file

@ -32,8 +32,11 @@ public abstract class GameEvent implements Keyed {
public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact"); public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact");
public static final GameEvent ENTITY_MOUNT = getEvent("entity_mount"); public static final GameEvent ENTITY_MOUNT = getEvent("entity_mount");
public static final GameEvent ENTITY_PLACE = getEvent("entity_place"); public static final GameEvent ENTITY_PLACE = getEvent("entity_place");
public static final GameEvent ENTITY_ROAR = getEvent("entity_roar"); public static final GameEvent ENTITY_ACTION = getEvent("entity_action");
public static final GameEvent ENTITY_SHAKE = getEvent("entity_shake"); @Deprecated
public static final GameEvent ENTITY_ROAR = getEvent("entity_action");
@Deprecated
public static final GameEvent ENTITY_SHAKE = getEvent("entity_action");
public static final GameEvent EQUIP = getEvent("equip"); public static final GameEvent EQUIP = getEvent("equip");
public static final GameEvent EXPLODE = getEvent("explode"); public static final GameEvent EXPLODE = getEvent("explode");
public static final GameEvent FLAP = getEvent("flap"); public static final GameEvent FLAP = getEvent("flap");
@ -57,6 +60,7 @@ public abstract class GameEvent implements Keyed {
public static final GameEvent STEP = getEvent("step"); public static final GameEvent STEP = getEvent("step");
public static final GameEvent SWIM = getEvent("swim"); public static final GameEvent SWIM = getEvent("swim");
public static final GameEvent TELEPORT = getEvent("teleport"); public static final GameEvent TELEPORT = getEvent("teleport");
public static final GameEvent UNEQUIP = getEvent("unequip");
public static final GameEvent RESONATE_1 = getEvent("resonate_1"); public static final GameEvent RESONATE_1 = getEvent("resonate_1");
public static final GameEvent RESONATE_2 = getEvent("resonate_2"); public static final GameEvent RESONATE_2 = getEvent("resonate_2");
public static final GameEvent RESONATE_3 = getEvent("resonate_3"); public static final GameEvent RESONATE_3 = getEvent("resonate_3");

View file

@ -206,6 +206,10 @@ public final class GameRule<T> {
* Whether vines will spread. * Whether vines will spread.
*/ */
public static final GameRule<Boolean> DO_VINES_SPREAD = new GameRule<>("doVinesSpread", Boolean.class); public static final GameRule<Boolean> DO_VINES_SPREAD = new GameRule<>("doVinesSpread", Boolean.class);
/**
* Whether ender pearls will vanish on player death.
*/
public static final GameRule<Boolean> ENDER_PEARLS_VANISH_ON_DEATH = new GameRule<>("enderPearlsVanishOnDeath", Boolean.class);
// Numerical rules // Numerical rules
/** /**

View file

@ -1193,7 +1193,10 @@ public enum Material implements Keyed, Translatable {
GREEN_TERRACOTTA(4105), GREEN_TERRACOTTA(4105),
RED_TERRACOTTA(5086), RED_TERRACOTTA(5086),
BLACK_TERRACOTTA(26691), BLACK_TERRACOTTA(26691),
BARRIER(26453), /**
* BlockData: {@link Waterlogged}
*/
BARRIER(26453, Waterlogged.class),
/** /**
* BlockData: {@link Light} * BlockData: {@link Light}
*/ */

View file

@ -3,6 +3,7 @@ package org.bukkit;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
@ -11,7 +12,6 @@ import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Consumer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;

View file

@ -262,6 +262,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all terracotta. * Vanilla block tag representing all terracotta.
*/ */
Tag<BlockType<?>> TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("terracotta"), BlockType.class); Tag<BlockType<?>> TERRACOTTA = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("terracotta"), BlockType.class);
/**
* Vanilla block tag representing all concrete powder.
*/
Tag<BlockType<?>> CONCRETE_POWDER = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("concrete_powder"), BlockType.class);
/** /**
* Vanilla block tag representing all blocks which complete the find tree * Vanilla block tag representing all blocks which complete the find tree
* tutorial. * tutorial.
@ -501,6 +505,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla block tag representing all blocks that play combination step sounds. * Vanilla block tag representing all blocks that play combination step sounds.
*/ */
Tag<BlockType<?>> COMBINATION_STEP_SOUND_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("combination_step_sound_blocks"), BlockType.class); Tag<BlockType<?>> COMBINATION_STEP_SOUND_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("combination_step_sound_blocks"), BlockType.class);
/**
* Vanilla block tag representing all blocks that play step sounds with camels on sand.
*/
Tag<BlockType<?>> CAMEL_SAND_STEP_SOUND_BLOCKS = Bukkit.getTag(REGISTRY_BLOCKS, NamespacedKey.minecraft("camel_sand_step_sound_blocks"), BlockType.class);
/** /**
* Vanilla block tag representing all blocks that block vibration signals. * Vanilla block tag representing all blocks that block vibration signals.
*/ */
@ -952,6 +960,10 @@ public interface Tag<T extends Keyed> extends Keyed {
* Vanilla tag representing entities which are dismounted when underwater. * Vanilla tag representing entities which are dismounted when underwater.
*/ */
Tag<EntityType<?>> ENTITY_TYPES_DISMOUNTS_UNDERWATER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("dismounts_underwater"), EntityType.class); Tag<EntityType<?>> ENTITY_TYPES_DISMOUNTS_UNDERWATER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("dismounts_underwater"), EntityType.class);
/**
* Vanilla tag representing entities which are not controlled by their mount.
*/
Tag<EntityType<?>> ENTITY_TYPES_NON_CONTROLLING_RIDER = Bukkit.getTag(REGISTRY_ENTITY_TYPES, NamespacedKey.minecraft("non_controlling_rider"), EntityType.class);
/** /**
* Returns whether or not this tag has an entry for the specified item. * Returns whether or not this tag has an entry for the specified item.

View file

@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate; import java.util.function.Predicate;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -33,7 +34,6 @@ import org.bukkit.persistence.PersistentDataHolder;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.messaging.PluginMessageRecipient; import org.bukkit.plugin.messaging.PluginMessageRecipient;
import org.bukkit.util.BoundingBox; import org.bukkit.util.BoundingBox;
import org.bukkit.util.Consumer;
import org.bukkit.util.RayTraceResult; import org.bukkit.util.RayTraceResult;
import org.bukkit.util.StructureSearchResult; import org.bukkit.util.StructureSearchResult;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -521,7 +521,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
* @param delegate A class to call for each block changed as a result of * @param delegate A class to call for each block changed as a result of
* this method * this method
* @return true if the tree was created successfully, otherwise false * @return true if the tree was created successfully, otherwise false
* @see #generateTree(org.bukkit.Location, java.util.Random, org.bukkit.TreeType, org.bukkit.util.Consumer) * @see #generateTree(org.bukkit.Location, java.util.Random, org.bukkit.TreeType, java.util.function.Consumer)
* @deprecated this method does not handle tile entities (bee nests) * @deprecated this method does not handle tile entities (bee nests)
*/ */
@Deprecated @Deprecated

View file

@ -57,6 +57,10 @@ public abstract class Attribute extends OldEnum<Attribute> implements Keyed {
* Luck bonus of an Entity. * Luck bonus of an Entity.
*/ */
public static final Attribute GENERIC_LUCK = getAttribute("generic.luck"); public static final Attribute GENERIC_LUCK = getAttribute("generic.luck");
/**
* Maximum absorption of an Entity.
*/
MAX_ABSORPTION("generic.max_absorption"),
/** /**
* Strength with which a horse will jump. * Strength with which a horse will jump.
*/ */

View file

@ -1,10 +1,14 @@
package org.bukkit.inventory.meta; package org.bukkit.inventory.meta;
import java.util.List; import java.util.List;
import org.bukkit.MinecraftExperimental;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@MinecraftExperimental
@ApiStatus.Experimental
public interface BundleMeta extends ItemMeta { public interface BundleMeta extends ItemMeta {
/** /**
@ -24,7 +28,7 @@ public interface BundleMeta extends ItemMeta {
/** /**
* Sets the items stored in this item. * Sets the items stored in this item.
* * <br>
* Removes all items when given null. * Removes all items when given null.
* *
* @param items the items to set * @param items the items to set

View file

@ -222,7 +222,7 @@ public final class MapCursor {
/** /**
* Represents the standard types of map cursors. More may be made * Represents the standard types of map cursors. More may be made
* available by resource packs - the value is used by the client as an * available by resource packs - the value is used by the client as an
* index in the file './misc/mapicons.png' from minecraft.jar or from a * index in the file './assets/minecraft/textures/map/map_icons.png' from minecraft.jar or from a
* resource pack. * resource pack.
*/ */
public enum Type { public enum Type {
@ -252,7 +252,15 @@ public final class MapCursor {
BANNER_GREEN(23), BANNER_GREEN(23),
BANNER_RED(24), BANNER_RED(24),
BANNER_BLACK(25), BANNER_BLACK(25),
RED_X(26); RED_X(26),
DESERT_VILLAGE(27),
PLAINS_VILLAGE(28),
SAVANNA_VILLAGE(29),
SNOWY_VILLAGE(30),
TAIGA_VILLAGE(31),
JUNGLE_TEMPLE(32),
SWAMP_HUT(33),
;
private byte value; private byte value;

View file

@ -34,7 +34,9 @@ public interface DataPack extends Keyed {
* This is related to the server version to work. * This is related to the server version to work.
* *
* @return the pack version * @return the pack version
* @deprecated packs can support multiple versions
*/ */
@Deprecated
public int getPackFormat(); public int getPackFormat();
/** /**

View file

@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableMap;
import java.util.Map; import java.util.Map;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.NamespacedKey;
import org.bukkit.configuration.serialization.ConfigurationSerializable; import org.bukkit.configuration.serialization.ConfigurationSerializable;
import org.bukkit.configuration.serialization.SerializableAs; import org.bukkit.configuration.serialization.SerializableAs;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -108,8 +109,14 @@ public class PotionEffect implements ConfigurationSerializable {
@NotNull @NotNull
private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) { private static PotionEffectType getEffectType(@NotNull Map<?, ?> map) {
int type = getInt(map, TYPE); PotionEffectType effect;
PotionEffectType effect = PotionEffectType.getById(type); if (map.get(TYPE) instanceof String) {
String type = (String) map.get(TYPE);
effect = PotionEffectType.getByKey(NamespacedKey.fromString(type));
} else {
int type = getInt(map, TYPE);
effect = PotionEffectType.getById(type);
}
if (effect != null) { if (effect != null) {
return effect; return effect;
} }
@ -136,7 +143,7 @@ public class PotionEffect implements ConfigurationSerializable {
@NotNull @NotNull
public Map<String, Object> serialize() { public Map<String, Object> serialize() {
return ImmutableMap.<String, Object>builder() return ImmutableMap.<String, Object>builder()
.put(TYPE, type.getId()) .put(TYPE, type.getKey().toString())
.put(DURATION, duration) .put(DURATION, duration)
.put(AMPLIFIER, amplifier) .put(AMPLIFIER, amplifier)
.put(AMBIENT, ambient) .put(AMBIENT, ambient)

View file

@ -34,7 +34,7 @@ public class PotionEffectTypeWrapper extends PotionEffectType {
*/ */
@NotNull @NotNull
public PotionEffectType getType() { public PotionEffectType getType() {
return PotionEffectType.getById(getId()); return PotionEffectType.getByKey(getKey());
} }
@Override @Override

View file

@ -5,13 +5,19 @@ package org.bukkit.util;
* result. * result.
* *
* @param <T> the type of the input to the operation * @param <T> the type of the input to the operation
* @deprecated Use {@link java.util.function.Consumer} instead
*/ */
public interface Consumer<T> { // Bukkit developer note (NOT plugin developers):
// NEVER use this consumer in the API.
// API methods which use this consumer will be remapped to Java's consumer at runtime, resulting in an error.
@Deprecated
public interface Consumer<T> extends java.util.function.Consumer<T> {
/** /**
* Performs this operation on the given argument. * Performs this operation on the given argument.
* *
* @param t the input argument * @param t the input argument
*/ */
@Override
void accept(T t); void accept(T t);
} }