mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 03:55:30 +01:00
Use ResourceLocation.tryParse for SoundEvent
This commit is contained in:
parent
c9696cc6c1
commit
f27fe08c9c
@ -1777,8 +1777,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: SoundEffect.a.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
return snd;
|
||||||
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd
|
||||||
|
: SoundEffect.a.get(data.contains(":") ? new MinecraftKey(data.split(":")[0], data.split(":")[1])
|
||||||
|
: new MinecraftKey(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(NetworkManager network) {
|
public static void initNetworkManager(NetworkManager network) {
|
||||||
|
@ -1836,8 +1836,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: SoundEffect.a.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
return snd;
|
||||||
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd
|
||||||
|
: SoundEffect.a.get(data.contains(":") ? new MinecraftKey(data.split(":")[0], data.split(":")[1])
|
||||||
|
: new MinecraftKey(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(NetworkManager network) {
|
public static void initNetworkManager(NetworkManager network) {
|
||||||
|
@ -1844,8 +1844,12 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: SoundEffect.a.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
return snd;
|
||||||
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd
|
||||||
|
: SoundEffect.a.get(data.contains(":") ? new MinecraftKey(data.split(":")[0], data.split(":")[1])
|
||||||
|
: new MinecraftKey(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(NetworkManager network) {
|
public static void initNetworkManager(NetworkManager network) {
|
||||||
|
@ -1934,8 +1934,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: IRegistry.SOUND_EVENT.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
return snd;
|
||||||
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd
|
||||||
|
: IRegistry.SOUND_EVENT.get(data.contains(":") ? MinecraftKey.a(data) : new MinecraftKey(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(NetworkManager network) {
|
public static void initNetworkManager(NetworkManager network) {
|
||||||
|
@ -2015,8 +2015,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: IRegistry.SOUND_EVENT.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
return snd;
|
||||||
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd
|
||||||
|
: IRegistry.SOUND_EVENT.get(data.contains(":") ? MinecraftKey.a(data) : new MinecraftKey(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(NetworkManager network) {
|
public static void initNetworkManager(NetworkManager network) {
|
||||||
|
@ -2059,8 +2059,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: IRegistry.SOUND_EVENT.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
return snd;
|
||||||
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd
|
||||||
|
: IRegistry.SOUND_EVENT.get(data.contains(":") ? MinecraftKey.a(data) : new MinecraftKey(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(NetworkManager network) {
|
public static void initNetworkManager(NetworkManager network) {
|
||||||
|
@ -2052,8 +2052,11 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
public static SoundEffect getSoundEffect(NPC npc, SoundEffect snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: IRegistry.SOUND_EVENT.get(new MinecraftKey(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
return snd;
|
||||||
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd
|
||||||
|
: IRegistry.SOUND_EVENT.get(data.contains(":") ? MinecraftKey.a(data) : new MinecraftKey(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(NetworkManager network) {
|
public static void initNetworkManager(NetworkManager network) {
|
||||||
|
@ -372,8 +372,8 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CHUNKMAP_UPDATE_PLAYER_STATUS.invoke(
|
CHUNKMAP_UPDATE_PLAYER_STATUS.invoke(((ServerChunkCache) handle.level.getChunkSource()).chunkMap, handle,
|
||||||
((ServerChunkCache) ((ServerLevel) handle.level).getChunkSource()).chunkMap, handle, !remove);
|
!remove);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -2059,9 +2059,10 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: Registry.SOUND_EVENT
|
return snd;
|
||||||
.get(new ResourceLocation(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd : Registry.SOUND_EVENT.get(ResourceLocation.tryParse(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(Connection network) {
|
public static void initNetworkManager(Connection network) {
|
||||||
|
@ -2068,9 +2068,10 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: Registry.SOUND_EVENT
|
return snd;
|
||||||
.get(new ResourceLocation(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd : Registry.SOUND_EVENT.get(ResourceLocation.tryParse(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(Connection network) {
|
public static void initNetworkManager(Connection network) {
|
||||||
|
@ -934,22 +934,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return handle.valid && handle.isAlive();
|
return handle.valid && handle.isAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
|
|
||||||
org.bukkit.entity.Entity mount, double offset) {
|
|
||||||
offset += getRidingHeightOffset(entity, mount) + 0.5;
|
|
||||||
sendPacket(player,
|
|
||||||
new ClientboundBundlePacket(List.of(
|
|
||||||
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
|
||||||
List.of(new SynchedEntityData.DataItem<>(INTERACTION_WIDTH, 0f).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, (float) offset).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(DATA_POSE, Pose.CROAKING).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(DATA_NAME_VISIBLE, true).value())),
|
|
||||||
new ClientboundSetPassengersPacket(getHandle(mount)),
|
|
||||||
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
|
||||||
List.of(new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, 999999f).value())))));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
@ -1314,6 +1298,22 @@ public class NMSImpl implements NMSBridge {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
|
||||||
|
org.bukkit.entity.Entity mount, double offset) {
|
||||||
|
offset += getRidingHeightOffset(entity, mount) + 0.5;
|
||||||
|
sendPacket(player,
|
||||||
|
new ClientboundBundlePacket(List.of(
|
||||||
|
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
||||||
|
List.of(new SynchedEntityData.DataItem<>(INTERACTION_WIDTH, 0f).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, (float) offset).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(DATA_POSE, Pose.CROAKING).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(DATA_NAME_VISIBLE, true).value())),
|
||||||
|
new ClientboundSetPassengersPacket(getHandle(mount)),
|
||||||
|
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
||||||
|
List.of(new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, 999999f).value())))));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
@ -2295,9 +2295,10 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: BuiltInRegistries.SOUND_EVENT
|
return snd;
|
||||||
.get(new ResourceLocation(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd : BuiltInRegistries.SOUND_EVENT.get(ResourceLocation.tryParse(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initNetworkManager(Connection network) {
|
public static void initNetworkManager(Connection network) {
|
||||||
|
@ -911,22 +911,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return handle.valid && handle.isAlive();
|
return handle.valid && handle.isAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
|
|
||||||
org.bukkit.entity.Entity mount, double offset) {
|
|
||||||
offset += getRidingHeightOffset(entity, mount);
|
|
||||||
sendPacket(player,
|
|
||||||
new ClientboundBundlePacket(List.of(
|
|
||||||
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
|
||||||
List.of(new SynchedEntityData.DataItem<>(INTERACTION_WIDTH, 0f).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, (float) offset).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(DATA_POSE, Pose.CROAKING).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(DATA_NAME_VISIBLE, true).value())),
|
|
||||||
new ClientboundSetPassengersPacket(getHandle(mount)),
|
|
||||||
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
|
||||||
List.of(new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, 999999f).value())))));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
@ -1301,6 +1285,22 @@ public class NMSImpl implements NMSBridge {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
|
||||||
|
org.bukkit.entity.Entity mount, double offset) {
|
||||||
|
offset += getRidingHeightOffset(entity, mount);
|
||||||
|
sendPacket(player,
|
||||||
|
new ClientboundBundlePacket(List.of(
|
||||||
|
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
||||||
|
List.of(new SynchedEntityData.DataItem<>(INTERACTION_WIDTH, 0f).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, (float) offset).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(DATA_POSE, Pose.CROAKING).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(DATA_NAME_VISIBLE, true).value())),
|
||||||
|
new ClientboundSetPassengersPacket(getHandle(mount)),
|
||||||
|
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
||||||
|
List.of(new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, 999999f).value())))));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
@ -2297,9 +2297,10 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: BuiltInRegistries.SOUND_EVENT
|
return snd;
|
||||||
.get(new ResourceLocation(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd : BuiltInRegistries.SOUND_EVENT.get(ResourceLocation.tryParse(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLeashed(NPC npc, Supplier<Boolean> isLeashed, Mob entity) {
|
public static boolean isLeashed(NPC npc, Supplier<Boolean> isLeashed, Mob entity) {
|
||||||
|
@ -58,7 +58,7 @@ import net.minecraft.world.phys.AABB;
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class EntityHumanNPC extends ServerPlayer implements NPCHolder, SkinnableEntity, ForwardingMobAI {
|
public class EntityHumanNPC extends ServerPlayer implements NPCHolder, SkinnableEntity, ForwardingMobAI {
|
||||||
private MobAI ai;
|
private final MobAI ai;
|
||||||
private int jumpTicks = 0;
|
private int jumpTicks = 0;
|
||||||
private final CitizensNPC npc;
|
private final CitizensNPC npc;
|
||||||
private boolean setBukkitEntity;
|
private boolean setBukkitEntity;
|
||||||
@ -73,12 +73,13 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
ai = new BasicMobAI(this);
|
ai = new BasicMobAI(this);
|
||||||
skinTracker = new SkinPacketTracker(this);
|
skinTracker = new SkinPacketTracker(this);
|
||||||
try {
|
try {
|
||||||
GAMEMODE_SETTING.invoke(gameMode, GameType.SURVIVAL, null);
|
GAMEMODE_SETTER.invoke(gameMode, GameType.SURVIVAL, null);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
initialise(minecraftServer, ci);
|
initialise(minecraftServer, ci);
|
||||||
} else {
|
} else {
|
||||||
|
ai = null;
|
||||||
skinTracker = null;
|
skinTracker = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -474,6 +475,6 @@ public class EntityHumanNPC extends ServerPlayer implements NPCHolder, Skinnable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final float EPSILON = 0.003F;
|
private static final float EPSILON = 0.003F;
|
||||||
private static final MethodHandle GAMEMODE_SETTING = NMS.getFirstMethodHandle(ServerPlayerGameMode.class, true,
|
private static final MethodHandle GAMEMODE_SETTER = NMS.getFirstMethodHandle(ServerPlayerGameMode.class, true,
|
||||||
GameType.class, GameType.class);
|
GameType.class, GameType.class);
|
||||||
}
|
}
|
||||||
|
@ -890,22 +890,6 @@ public class NMSImpl implements NMSBridge {
|
|||||||
return handle.valid && handle.isAlive();
|
return handle.valid && handle.isAlive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
|
|
||||||
org.bukkit.entity.Entity mount, double offset) {
|
|
||||||
offset += getRidingHeightOffset(entity, mount);
|
|
||||||
sendPacket(player,
|
|
||||||
new ClientboundBundlePacket(List.of(
|
|
||||||
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
|
||||||
List.of(new SynchedEntityData.DataItem<>(INTERACTION_WIDTH, 0f).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, (float) offset).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(DATA_POSE, Pose.CROAKING).value(),
|
|
||||||
new SynchedEntityData.DataItem<>(DATA_NAME_VISIBLE, true).value())),
|
|
||||||
new ClientboundSetPassengersPacket(getHandle(mount)),
|
|
||||||
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
|
||||||
List.of(new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, 999999f).value())))));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load(CommandManager manager) {
|
public void load(CommandManager manager) {
|
||||||
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
registerTraitWithCommand(manager, EnderDragonTrait.class);
|
||||||
@ -1279,6 +1263,22 @@ public class NMSImpl implements NMSBridge {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void positionInteractionText(org.bukkit.entity.Player player, org.bukkit.entity.Entity entity,
|
||||||
|
org.bukkit.entity.Entity mount, double offset) {
|
||||||
|
offset += getRidingHeightOffset(entity, mount);
|
||||||
|
sendPacket(player,
|
||||||
|
new ClientboundBundlePacket(List.of(
|
||||||
|
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
||||||
|
List.of(new SynchedEntityData.DataItem<>(INTERACTION_WIDTH, 0f).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, (float) offset).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(DATA_POSE, Pose.CROAKING).value(),
|
||||||
|
new SynchedEntityData.DataItem<>(DATA_NAME_VISIBLE, true).value())),
|
||||||
|
new ClientboundSetPassengersPacket(getHandle(mount)),
|
||||||
|
new ClientboundSetEntityDataPacket(entity.getEntityId(),
|
||||||
|
List.of(new SynchedEntityData.DataItem<>(INTERACTION_HEIGHT, 999999f).value())))));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerEntityClass(Class<?> clazz) {
|
public void registerEntityClass(Class<?> clazz) {
|
||||||
if (ENTITY_REGISTRY == null)
|
if (ENTITY_REGISTRY == null)
|
||||||
@ -2283,9 +2283,10 @@ public class NMSImpl implements NMSBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
public static SoundEvent getSoundEffect(NPC npc, SoundEvent snd, NPC.Metadata meta) {
|
||||||
return npc == null || !npc.data().has(meta) ? snd
|
if (npc == null)
|
||||||
: BuiltInRegistries.SOUND_EVENT.get(
|
return snd;
|
||||||
ResourceLocation.withDefaultNamespace(npc.data().get(meta, snd == null ? "" : snd.toString())));
|
String data = npc.data().get(meta);
|
||||||
|
return data == null ? snd : BuiltInRegistries.SOUND_EVENT.get(ResourceLocation.tryParse(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLeashed(NPC npc, Supplier<Boolean> isLeashed, Mob entity) {
|
public static boolean isLeashed(NPC npc, Supplier<Boolean> isLeashed, Mob entity) {
|
||||||
|
Loading…
Reference in New Issue
Block a user