mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 14:51:27 +01:00
[ci skip] Move logic in our patches to ItemType/BlockType (#10772)
This commit is contained in:
parent
c7e42591dd
commit
98853ee548
@ -10,10 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||||
* @throws IllegalArgumentException if {@link Material#isBlock()} is false
|
|
||||||
*/
|
*/
|
||||||
boolean isCollidable(@org.jetbrains.annotations.NotNull Material material);
|
@org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);
|
||||||
|
// Paper end
|
||||||
+
|
+
|
||||||
|
+ // Paper start - namespaced key biome methods
|
||||||
+ /**
|
+ /**
|
||||||
+ * Gets the {@link NamespacedKey} for the biome at the given location.
|
+ * Gets the {@link NamespacedKey} for the biome at the given location.
|
||||||
+ *
|
+ *
|
||||||
@ -40,5 +41,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @throws IllegalStateException if no biome by the given key is registered.
|
+ * @throws IllegalStateException if no biome by the given key is registered.
|
||||||
+ */
|
+ */
|
||||||
+ void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
+ void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
||||||
// Paper end
|
+ // Paper end - namespaced key biome methods
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||||
|
// Paper end - namespaced key biome methods
|
||||||
|
|
||||||
String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic);
|
String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); // Paper - fix custom stats criteria creation
|
||||||
// Paper end
|
|
||||||
+
|
+
|
||||||
+ // Paper start - spawn egg color visibility
|
+ // Paper start - spawn egg color visibility
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
Date: Thu, 4 Nov 2021 11:50:35 -0700
|
Date: Thu, 4 Nov 2021 11:50:35 -0700
|
||||||
Subject: [PATCH] Add isCollidable methods to various places
|
Subject: [PATCH] Add hasCollision methods to various places
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||||
@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/Material.java
|
--- a/src/main/java/org/bukkit/Material.java
|
||||||
+++ b/src/main/java/org/bukkit/Material.java
|
+++ b/src/main/java/org/bukkit/Material.java
|
||||||
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
||||||
public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
|
|
||||||
return this.getDefaultAttributeModifiers(equipmentSlot);
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end - item default attributes API
|
||||||
|
|
||||||
|
+ // Paper start - isCollidable API
|
||||||
+ /**
|
+ /**
|
||||||
+ * Checks if this material is collidable.
|
+ * Checks if this material is collidable.
|
||||||
+ *
|
+ *
|
||||||
@ -20,30 +20,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ * @throws IllegalArgumentException if {@link #isBlock()} is false
|
+ * @throws IllegalArgumentException if {@link #isBlock()} is false
|
||||||
+ */
|
+ */
|
||||||
+ public boolean isCollidable() {
|
+ public boolean isCollidable() {
|
||||||
+ return Bukkit.getUnsafe().isCollidable(this);
|
+ if (this.isBlock()) {
|
||||||
|
+ return this.asBlockType().hasCollision();
|
||||||
|
+ }
|
||||||
|
+ throw new IllegalArgumentException(this + " isn't a block type");
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - isCollidable API
|
||||||
|
|
||||||
/**
|
|
||||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
|
||||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
|
||||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
|
||||||
* @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first)
|
|
||||||
*/
|
|
||||||
@org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);
|
|
||||||
+
|
+
|
||||||
+ /**
|
/**
|
||||||
+ * Checks if this material is collidable.
|
* Do not use for any reason.
|
||||||
+ *
|
*
|
||||||
+ * @param material the material to check
|
|
||||||
+ * @return true if collidable
|
|
||||||
+ * @throws IllegalArgumentException if {@link Material#isBlock()} is false
|
|
||||||
+ */
|
|
||||||
+ boolean isCollidable(@org.jetbrains.annotations.NotNull Material material);
|
|
||||||
// Paper end
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/block/Block.java
|
--- a/src/main/java/org/bukkit/block/Block.java
|
||||||
@ -80,3 +66,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ boolean isCollidable();
|
+ boolean isCollidable();
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/block/BlockType.java
|
||||||
|
+++ b/src/main/java/org/bukkit/block/BlockType.java
|
||||||
|
@@ -0,0 +0,0 @@ public interface BlockType extends Keyed, Translatable, net.kyori.adventure.tran
|
||||||
|
@Override
|
||||||
|
@NotNull String getTranslationKey();
|
||||||
|
// Paper end - add Translatable
|
||||||
|
+
|
||||||
|
+ // Paper start - hasCollision API
|
||||||
|
+ /**
|
||||||
|
+ * Checks if this block type has collision.
|
||||||
|
+ * <p>
|
||||||
|
+ * @return false if this block never has collision, true if it <b>might</b> have collision
|
||||||
|
+ */
|
||||||
|
+ boolean hasCollision();
|
||||||
|
+ // Paper end - hasCollision API
|
||||||
|
}
|
@ -157,21 +157,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
AIR(9648, 0),
|
AIR(9648, 0),
|
||||||
STONE(22948),
|
STONE(22948),
|
||||||
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable {
|
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable {
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end
|
||||||
|
|
||||||
|
+ // Paper start - add Translatable
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public @NotNull String translationKey() {
|
+ public @NotNull String translationKey() {
|
||||||
+ if (this.isItem()) {
|
+ if (this.isItem()) {
|
||||||
+ return Bukkit.getUnsafe().getItemTranslationKey(this);
|
+ return java.util.Objects.requireNonNull(this.asItemType()).translationKey();
|
||||||
+ } else {
|
+ } else {
|
||||||
+ return Bukkit.getUnsafe().getBlockTranslationKey(this);
|
+ return java.util.Objects.requireNonNull(this.asBlockType()).translationKey();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - add Translatable
|
||||||
|
+
|
||||||
/**
|
/**
|
||||||
|
* Do not use for any reason.
|
||||||
|
*
|
||||||
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable {
|
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable {
|
||||||
* material
|
* material
|
||||||
* @see #getBlockTranslationKey()
|
* @see #getBlockTranslationKey()
|
||||||
@ -309,6 +311,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ String getTranslationKey();
|
+ String getTranslationKey();
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/block/BlockType.java b/src/main/java/org/bukkit/block/BlockType.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/block/BlockType.java
|
||||||
|
+++ b/src/main/java/org/bukkit/block/BlockType.java
|
||||||
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
* changes may occur. Do not use this API in plugins.
|
||||||
|
*/
|
||||||
|
@ApiStatus.Internal
|
||||||
|
-public interface BlockType extends Keyed, Translatable {
|
||||||
|
+public interface BlockType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add translatable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Typed represents a subtype of {@link BlockType}s that have a known block
|
||||||
|
@@ -0,0 +0,0 @@ public interface BlockType extends Keyed, Translatable {
|
||||||
|
@Nullable
|
||||||
|
@Deprecated
|
||||||
|
Material asMaterial();
|
||||||
|
+
|
||||||
|
+ // Paper start - add Translatable
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link #translationKey()} and {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)}
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(forRemoval = true)
|
||||||
|
+ @Override
|
||||||
|
+ @NotNull String getTranslationKey();
|
||||||
|
+ // Paper end - add Translatable
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
|
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||||
@ -517,3 +546,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/inventory/ItemType.java
|
||||||
|
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
|
||||||
|
@@ -0,0 +0,0 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
* changes may occur. Do not use this API in plugins.
|
||||||
|
*/
|
||||||
|
@ApiStatus.Internal
|
||||||
|
-public interface ItemType extends Keyed, Translatable {
|
||||||
|
+public interface ItemType extends Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - add Translatable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Typed represents a subtype of {@link ItemType}s that have a known item meta type
|
||||||
|
@@ -0,0 +0,0 @@ public interface ItemType extends Keyed, Translatable {
|
||||||
|
@Nullable
|
||||||
|
@Deprecated
|
||||||
|
Material asMaterial();
|
||||||
|
+
|
||||||
|
+ // Paper start - add Translatable
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link #translationKey()} and {@link net.kyori.adventure.text.Component#translatable(net.kyori.adventure.translation.Translatable)}
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(forRemoval = true)
|
||||||
|
+ @Override
|
||||||
|
+ @NotNull String getTranslationKey();
|
||||||
|
+ // Paper end - add Translatable
|
||||||
|
}
|
||||||
|
@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/Material.java
|
--- a/src/main/java/org/bukkit/Material.java
|
||||||
+++ b/src/main/java/org/bukkit/Material.java
|
+++ b/src/main/java/org/bukkit/Material.java
|
||||||
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
||||||
public io.papermc.paper.inventory.ItemRarity getItemRarity() {
|
|
||||||
return new org.bukkit.inventory.ItemStack(this).getRarity();
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end - item rarity API
|
||||||
|
|
||||||
|
+ // Paper start - item default attributes API
|
||||||
+ /**
|
+ /**
|
||||||
+ * Returns an immutable multimap of attributes for the slot.
|
+ * Returns an immutable multimap of attributes for the slot.
|
||||||
+ * {@link #isItem()} must be true for this material.
|
+ * {@link #isItem()} must be true for this material.
|
||||||
@ -28,6 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
|
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
|
||||||
+ return this.getDefaultAttributeModifiers(equipmentSlot);
|
+ return this.getDefaultAttributeModifiers(equipmentSlot);
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - item default attributes API
|
||||||
|
+
|
||||||
/**
|
/**
|
||||||
|
* Do not use for any reason.
|
||||||
|
*
|
||||||
|
@ -9,12 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||||
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
@@ -0,0 +0,0 @@ public interface UnsafeValues {
|
||||||
* @throws IllegalStateException if no biome by the given key is registered.
|
|
||||||
*/
|
*/
|
||||||
void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);
|
||||||
|
// Paper end - namespaced key biome methods
|
||||||
+
|
+
|
||||||
+ String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic);
|
+ String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); // Paper - fix custom stats criteria creation
|
||||||
// Paper end
|
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/scoreboard/Criteria.java b/src/main/java/org/bukkit/scoreboard/Criteria.java
|
diff --git a/src/main/java/org/bukkit/scoreboard/Criteria.java b/src/main/java/org/bukkit/scoreboard/Criteria.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/Material.java
|
--- a/src/main/java/org/bukkit/Material.java
|
||||||
+++ b/src/main/java/org/bukkit/Material.java
|
+++ b/src/main/java/org/bukkit/Material.java
|
||||||
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
@@ -0,0 +0,0 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
||||||
return Bukkit.getUnsafe().getBlockTranslationKey(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end - add Translatable
|
||||||
|
|
||||||
|
+ // Paper start - item rarity API
|
||||||
+ /**
|
+ /**
|
||||||
+ * Returns the item rarity for the item. The Material <b>MUST</b> be an Item not a block.
|
+ * Returns the item rarity for the item. The Material <b>MUST</b> be an Item not a block.
|
||||||
+ * Use {@link #isItem()} before this.
|
+ * Use {@link #isItem()} before this.
|
||||||
@ -63,9 +63,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public io.papermc.paper.inventory.ItemRarity getItemRarity() {
|
+ public io.papermc.paper.inventory.ItemRarity getItemRarity() {
|
||||||
+ return new org.bukkit.inventory.ItemStack(this).getRarity();
|
+ return new org.bukkit.inventory.ItemStack(this).getRarity();
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - item rarity API
|
||||||
|
+
|
||||||
/**
|
/**
|
||||||
|
* Do not use for any reason.
|
||||||
|
*
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/ItemRarity.java b/src/main/java/org/bukkit/inventory/ItemRarity.java
|
diff --git a/src/main/java/org/bukkit/inventory/ItemRarity.java b/src/main/java/org/bukkit/inventory/ItemRarity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/ItemRarity.java
|
--- a/src/main/java/org/bukkit/inventory/ItemRarity.java
|
||||||
|
@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
Preconditions.checkArgument(material.isBlock(), material + " is not a block");
|
|
||||||
return getBlock(material).hasCollision;
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end
|
||||||
|
|
||||||
|
+ // Paper start - namespaced key biome methods
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) {
|
+ public org.bukkit.NamespacedKey getBiomeKey(org.bukkit.RegionAccessor accessor, int x, int y, int z) {
|
||||||
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
+ org.bukkit.craftbukkit.CraftRegionAccessor cra = (org.bukkit.craftbukkit.CraftRegionAccessor) accessor;
|
||||||
@ -26,6 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
||||||
+ cra.setBiome(x, y, z, biomeBase);
|
+ cra.setBiome(x, y, z, biomeBase);
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - namespaced key biome methods
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
|
public String get(Class<?> aClass, String s) {
|
||||||
|
if (aClass == Enchantment.class) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
Date: Thu, 4 Nov 2021 11:50:40 -0700
|
Date: Thu, 4 Nov 2021 11:50:40 -0700
|
||||||
Subject: [PATCH] Add isCollidable methods to various places
|
Subject: [PATCH] Add hasCollision methods to various places
|
||||||
|
|
||||||
== AT ==
|
== AT ==
|
||||||
public net.minecraft.world.level.block.state.BlockBehaviour hasCollision
|
public net.minecraft.world.level.block.state.BlockBehaviour hasCollision
|
||||||
@ -38,20 +38,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ public class CraftBlockType<B extends BlockData> implements BlockType.Typed<B>,
|
||||||
var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
|
return this.block.getDescriptionId();
|
||||||
return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
|
|
||||||
}
|
}
|
||||||
|
// Paper end - add Translatable
|
||||||
+
|
+
|
||||||
|
+ // Paper start - hasCollision API
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean isCollidable(Material material) {
|
+ public boolean hasCollision() {
|
||||||
+ Preconditions.checkArgument(material.isBlock(), material + " is not a block");
|
+ return this.block.hasCollision;
|
||||||
+ return getBlock(material).hasCollision;
|
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - hasCollision API
|
||||||
|
}
|
||||||
@Override
|
|
@ -25,6 +25,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockType.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftBlockType<B extends BlockData> implements BlockType.Typed<B>,
|
||||||
|
public Material asMaterial() {
|
||||||
|
return Registry.MATERIAL.get(this.key);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Paper start - add Translatable
|
||||||
|
+ @Override
|
||||||
|
+ public String translationKey() {
|
||||||
|
+ return this.block.getDescriptionId();
|
||||||
|
+ }
|
||||||
|
+ // Paper end - add Translatable
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
|
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
|
||||||
@ -41,6 +57,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
|
||||||
|
public Material asMaterial() {
|
||||||
|
return Registry.MATERIAL.get(this.key);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Paper start - add Translatable
|
||||||
|
+ @Override
|
||||||
|
+ public String translationKey() {
|
||||||
|
+ return this.item.getDescriptionId();
|
||||||
|
+ }
|
||||||
|
+ // Paper end - add Translatable
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||||
|
@ -9,15 +9,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
|
|
||||||
cra.setBiome(x, y, z, biomeBase);
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end - namespaced key biome methods
|
||||||
|
|
||||||
|
+ // Paper start - fix custom stats criteria creation
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public String getStatisticCriteriaKey(org.bukkit.Statistic statistic) {
|
+ public String getStatisticCriteriaKey(org.bukkit.Statistic statistic) {
|
||||||
+ if (statistic.getType() != org.bukkit.Statistic.Type.UNTYPED) return "minecraft.custom:minecraft." + statistic.getKey().getKey();
|
+ if (statistic.getType() != org.bukkit.Statistic.Type.UNTYPED) return "minecraft.custom:minecraft." + statistic.getKey().getKey();
|
||||||
+ return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName();
|
+ return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName();
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - fix custom stats criteria creation
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
|
public String get(Class<?> aClass, String s) {
|
||||||
|
if (aClass == Enchantment.class) {
|
||||||
|
@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName();
|
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - fix custom stats criteria creation
|
||||||
|
|
||||||
+ // Paper start - expose itemstack tooltip lines
|
+ // Paper start - expose itemstack tooltip lines
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public java.util.List<net.kyori.adventure.text.Component> computeTooltipLines(final ItemStack itemStack, final io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, final org.bukkit.entity.Player player) {
|
+ public java.util.List<net.kyori.adventure.text.Component> computeTooltipLines(final ItemStack itemStack, final io.papermc.paper.inventory.tooltip.TooltipContext tooltipContext, final org.bukkit.entity.Player player) {
|
||||||
@ -26,6 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ return lines.stream().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).toList();
|
+ return lines.stream().map(io.papermc.paper.adventure.PaperAdventure::asAdventure).toList();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - expose itemstack tooltip lines
|
+ // Paper end - expose itemstack tooltip lines
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
public String get(Class<?> aClass, String s) {
|
public String get(Class<?> aClass, String s) {
|
||||||
|
if (aClass == Enchantment.class) {
|
||||||
|
Loading…
Reference in New Issue
Block a user