Added logging for wolf variants and cat sit states

This commit is contained in:
Intelli 2025-03-21 16:49:50 -06:00
parent 6ff24ad347
commit 16b7d35fac
5 changed files with 76 additions and 2 deletions

View file

@ -108,6 +108,16 @@ public class BukkitAdapter implements BukkitInterface {
return false;
}
@Override
public void getWolfVariant(org.bukkit.entity.Wolf wolf, List<Object> info) {
// Base implementation does nothing - Wolf variants only exist in 1.21+
}
@Override
public void setWolfVariant(org.bukkit.entity.Wolf wolf, Object value) {
// Base implementation does nothing - Wolf variants only exist in 1.21+
}
@Override
public EntityType getEntityType(Material material) {
switch (material) {

View file

@ -241,6 +241,28 @@ public interface BukkitInterface {
*/
boolean setEntityMeta(Entity entity, Object value, int count);
/**
* Gets the wolf variant and adds it to the info list.
* Only implemented in Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param info
* The list to add the variant information to
*/
void getWolfVariant(org.bukkit.entity.Wolf wolf, List<Object> info);
/**
* Sets the wolf variant from the provided value.
* Only implemented in Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param value
* The variant value to set
*/
void setWolfVariant(org.bukkit.entity.Wolf wolf, Object value);
/**
* Gets the frame type for an entity.
*

View file

@ -1,7 +1,6 @@
package net.coreprotect.bukkit;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bukkit.Bukkit;
@ -126,4 +125,38 @@ public class Bukkit_v1_21 extends Bukkit_v1_20 implements BukkitInterface {
// return RegistryAccess.registryAccess().getRegistry(RegistryKey.CAT_VARIANT).get((NamespacedKey)value);
return Bukkit.getRegistry((Class) tClass).get(namespacedKey);
}
/**
* Gets the wolf variant and adds it to the info list.
* This functionality is specific to Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param info
* The list to add the variant information to
*/
@Override
public void getWolfVariant(org.bukkit.entity.Wolf wolf, List<Object> info) {
// Add the variant to the info list
info.add(getRegistryKey(wolf.getVariant()));
}
/**
* Sets the wolf variant from the provided value.
* This functionality is specific to Minecraft 1.21+.
*
* @param wolf
* The wolf entity
* @param value
* The variant value to set
*/
@Override
public void setWolfVariant(org.bukkit.entity.Wolf wolf, Object value) {
if (value instanceof String) {
value = getRegistryValue((String) value, org.bukkit.entity.Wolf.Variant.class);
}
org.bukkit.entity.Wolf.Variant variant = (org.bukkit.entity.Wolf.Variant) value;
wolf.setVariant(variant);
}
}