1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: MiniDigger | Martin <admin@minidigger.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
@@ -34,7 +34,6 @@ public final class CraftEvil {
|
||||
}
|
||||
|
||||
private CraftEvil() {
|
||||
//
|
||||
}
|
||||
|
||||
public static void setDurability(ItemStack itemStack, short durability) {
|
||||
|
||||
@@ -35,10 +35,7 @@ import org.bukkit.material.MaterialData;
|
||||
/**
|
||||
* This class may seem unnecessarily slow and complicated/repetitive however it
|
||||
* is able to handle a lot more edge cases and invertible transformations (many
|
||||
* of which are not immediately obvious) than any other alternative. If you do
|
||||
* make changes to this class please make sure to contribute them back
|
||||
* https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse so
|
||||
* that all may benefit.
|
||||
* of which are not immediately obvious) than any other alternative.
|
||||
*
|
||||
* @deprecated legacy use only
|
||||
*/
|
||||
@@ -56,7 +53,6 @@ public final class CraftLegacy {
|
||||
private static final Map<Block, MaterialData> blockToMaterial = new HashMap<>(1024);
|
||||
|
||||
private CraftLegacy() {
|
||||
//
|
||||
}
|
||||
|
||||
public static Material toLegacy(Material material) {
|
||||
@@ -82,10 +78,10 @@ public final class CraftLegacy {
|
||||
|
||||
if (mappedData == null && material.isBlock()) {
|
||||
Block block = CraftMagicNumbers.getBlock(material);
|
||||
BlockState blockData = block.defaultBlockState();
|
||||
BlockState state = block.defaultBlockState();
|
||||
|
||||
// Try exact match first
|
||||
mappedData = CraftLegacy.dataToMaterial.get(blockData);
|
||||
mappedData = CraftLegacy.dataToMaterial.get(state);
|
||||
// Fallback to any block
|
||||
if (mappedData == null) {
|
||||
mappedData = CraftLegacy.blockToMaterial.get(block);
|
||||
@@ -153,22 +149,22 @@ public final class CraftLegacy {
|
||||
return Items.AIR;
|
||||
}
|
||||
|
||||
public static byte toLegacyData(BlockState blockData) {
|
||||
return CraftLegacy.toLegacy(blockData).getData();
|
||||
public static byte toLegacyData(BlockState state) {
|
||||
return CraftLegacy.toLegacy(state).getData();
|
||||
}
|
||||
|
||||
public static Material toLegacyMaterial(BlockState blockData) {
|
||||
return CraftLegacy.toLegacy(blockData).getItemType();
|
||||
public static Material toLegacyMaterial(BlockState state) {
|
||||
return CraftLegacy.toLegacy(state).getItemType();
|
||||
}
|
||||
|
||||
public static MaterialData toLegacy(BlockState blockData) {
|
||||
public static MaterialData toLegacy(BlockState state) {
|
||||
MaterialData mappedData;
|
||||
|
||||
// Try exact match first
|
||||
mappedData = CraftLegacy.dataToMaterial.get(blockData);
|
||||
mappedData = CraftLegacy.dataToMaterial.get(state);
|
||||
// Fallback to any block
|
||||
if (mappedData == null) {
|
||||
mappedData = CraftLegacy.blockToMaterial.get(blockData.getBlock());
|
||||
mappedData = CraftLegacy.blockToMaterial.get(state.getBlock());
|
||||
}
|
||||
|
||||
return (mappedData == null) ? new MaterialData(Material.LEGACY_AIR) : mappedData;
|
||||
@@ -261,7 +257,6 @@ public final class CraftLegacy {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
//
|
||||
}
|
||||
|
||||
static {
|
||||
@@ -353,7 +348,7 @@ public final class CraftLegacy {
|
||||
Optional<CompoundTag> propMap = blockTag.getElement("Properties").result();
|
||||
if (propMap.isPresent()) {
|
||||
CompoundTag properties = propMap.get();
|
||||
for (String dataKey : properties.getAllKeys()) {
|
||||
for (String dataKey : properties.keySet()) {
|
||||
Property state = states.getProperty(dataKey);
|
||||
|
||||
if (state == null) {
|
||||
@@ -361,8 +356,8 @@ public final class CraftLegacy {
|
||||
continue;
|
||||
}
|
||||
|
||||
Preconditions.checkState(!properties.getString(dataKey).isEmpty(), "Empty data string");
|
||||
Optional opt = state.getValue(properties.getString(dataKey));
|
||||
Preconditions.checkState(properties.getString(dataKey).isPresent(), "Empty data string");
|
||||
Optional opt = state.getValue(properties.getStringOr(dataKey, ""));
|
||||
Preconditions.checkArgument(opt.isPresent(), "No state value %s for %s", properties.getString(dataKey), dataKey);
|
||||
|
||||
blockData = blockData.setValue(state, (Comparable) opt.get());
|
||||
@@ -444,8 +439,4 @@ public final class CraftLegacy {
|
||||
// Git hash: 42f6cdf4c5dcdd52a27543403dcd17fb60311621
|
||||
return 0 <= material.getId() && material.getId() < 256;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.err.println("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package org.bukkit.craftbukkit.legacy;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
import org.bukkit.Keyed;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.banner.PatternType;
|
||||
import org.bukkit.craftbukkit.CraftRegistry;
|
||||
import org.bukkit.craftbukkit.legacy.fieldrename.FieldRenameData;
|
||||
import org.bukkit.craftbukkit.legacy.reroute.DoNotReroute;
|
||||
import org.bukkit.craftbukkit.legacy.reroute.InjectPluginVersion;
|
||||
import org.bukkit.craftbukkit.legacy.reroute.RequireCompatibility;
|
||||
import org.bukkit.craftbukkit.legacy.reroute.RerouteMethodName;
|
||||
import org.bukkit.craftbukkit.legacy.reroute.RerouteStatic;
|
||||
import org.bukkit.craftbukkit.util.ApiVersion;
|
||||
@@ -61,7 +57,6 @@ public class FieldRename {
|
||||
//}
|
||||
// Paper end
|
||||
|
||||
// Paper start - DisplaySlot
|
||||
@DoNotReroute
|
||||
public static String convertDisplaySlot(final String from) {
|
||||
if (from.startsWith("SIDEBAR_") && !from.startsWith("SIDEBAR_TEAM_")) {
|
||||
@@ -69,7 +64,6 @@ public class FieldRename {
|
||||
}
|
||||
return from;
|
||||
}
|
||||
// Paper end - DisplaySlot
|
||||
|
||||
// PatternType
|
||||
private static final FieldRenameData PATTERN_TYPE_DATA = FieldRenameData.Builder.newBuilder()
|
||||
@@ -175,7 +169,7 @@ public class FieldRename {
|
||||
.change("DROPPED_ITEM", "ITEM")
|
||||
.change("LEASH_HITCH", "LEASH_KNOT")
|
||||
.change("ENDER_SIGNAL", "EYE_OF_ENDER")
|
||||
.change("SPLASH_POTION", "POTION")
|
||||
.change("POTION", "SPLASH_POTION")
|
||||
.change("THROWN_EXP_BOTTLE", "EXPERIENCE_BOTTLE")
|
||||
.change("PRIMED_TNT", "TNT")
|
||||
.change("FIREWORK", "FIREWORK_ROCKET")
|
||||
@@ -453,6 +447,7 @@ public class FieldRename {
|
||||
private static final FieldRenameData ITEM_FLAG_DATA = FieldRenameData.Builder.newBuilder()
|
||||
.forAllVersions()
|
||||
.change("HIDE_POTION_EFFECTS", "HIDE_ADDITIONAL_TOOLTIP")
|
||||
.change("HIDE_ITEM_SPECIFICS", "HIDE_ADDITIONAL_TOOLTIP")
|
||||
.build();
|
||||
|
||||
@DoNotReroute
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.bukkit.craftbukkit.legacy.enums;
|
||||
|
||||
/**
|
||||
* A crash dummy to use, instead of the old enums which matured to Abstracthood or Interfacehood and the baby enums which are still growing.
|
||||
* A crash dummy to use, instead of the old enums which matured to Abstracthood or Interfacehood and the baby enums which are still growing.
|
||||
*/
|
||||
public enum DummyEnum {
|
||||
}
|
||||
|
||||
@@ -11,22 +11,22 @@ public record RerouteArgument(Type type, Type sourceType, boolean injectPluginNa
|
||||
* <br>
|
||||
* References:
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-4.html#jvms-4.3.2-200">Interpretation of field descriptors</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.3.2-200">Interpretation of field descriptors</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.iload">iload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.iload_n">{@literal iload_<n> Opcode}</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.iload">iload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.iload_n">{@literal iload_<n> Opcode}</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.lload">lload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.lload_n">{@literal lload_<n> Opcode}</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.lload">lload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.lload_n">{@literal lload_<n> Opcode}</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.fload">fload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.fload">{@literal fload_<n> Opcode}</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.fload">fload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.fload_n">{@literal fload_<n> Opcode}</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.dload">dload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.dload_n">{@literal dload_<n> Opcode}</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.dload">dload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.dload_n">{@literal dload_<n> Opcode}</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.aload">aload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.aload_n">{@literal aload_<n> Opcode}</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.aload">aload Opcode</a> /
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.aload_n">{@literal aload_<n> Opcode}</a>
|
||||
*
|
||||
* @return the opcode of the type
|
||||
*/
|
||||
|
||||
@@ -10,19 +10,19 @@ public record RerouteReturn(Type type) {
|
||||
* <br>
|
||||
* References:
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-4.html#jvms-4.3.2-200">Interpretation of field descriptors</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-4.html#jvms-4.3.2-200">Interpretation of field descriptors</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.return">return Opcode</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.return">return Opcode</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.ireturn">ireturn Opcode</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.ireturn">ireturn Opcode</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.lreturn">lreturn Opcode</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.lreturn">lreturn Opcode</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.freturn">freturn Opcode</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.freturn">freturn Opcode</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.dreturn">dreturn Opcode</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.dreturn">dreturn Opcode</a>
|
||||
* <br>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-6.html#jvms-6.5.areturn">areturn Opcode</a>
|
||||
* <a href="https://docs.oracle.com/javase/specs/jvms/se21/html/jvms-6.html#jvms-6.5.areturn">areturn Opcode</a>
|
||||
*
|
||||
* @return the opcode of the type
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user