Merge remote-tracking branch 'origin/2.X' into 2.X

This commit is contained in:
Pyrbu 2023-06-23 23:12:31 +02:00
commit 16c48043b4
5 changed files with 7 additions and 7 deletions

@ -26,5 +26,5 @@ public interface MetadataFactory {
Collection<EntityData> name(Component name); Collection<EntityData> name(Component name);
EntityData noGravity(); EntityData noGravity();
EntityData pose(EntityPose pose); EntityData pose(EntityPose pose);
EntityData shaking(); EntityData shaking(boolean enabled);
} }

@ -15,7 +15,7 @@ public class V1_17MetadataFactory extends V1_16MetadataFactory {
} }
@Override @Override
public EntityData shaking() { public EntityData shaking(boolean enabled) {
return newEntityData(7, EntityDataTypes.INT, 140); return newEntityData(7, EntityDataTypes.INT, enabled ? 140 : 0);
} }
} }

@ -41,7 +41,7 @@ public class V1_8MetadataFactory implements MetadataFactory {
} }
@Override @Override
public EntityData shaking() { public EntityData shaking(boolean enabled) {
throw new UnsupportedOperationException("The shaking entity data isn't supported on this version"); throw new UnsupportedOperationException("The shaking entity data isn't supported on this version");
} }

@ -136,7 +136,7 @@ public class NpcRegistryImpl implements NpcRegistry {
if (npcIdLookupMap.containsKey(id)) throw new IllegalArgumentException("An npc with the id " + id + " already exists!"); if (npcIdLookupMap.containsKey(id)) throw new IllegalArgumentException("An npc with the id " + id + " already exists!");
NpcImpl npc = new NpcImpl(UUID.randomUUID(), configManager, textSerializer, world, type, location, packetFactory); NpcImpl npc = new NpcImpl(UUID.randomUUID(), configManager, textSerializer, world, type, location, packetFactory);
NpcEntryImpl entry = new NpcEntryImpl(id, npc); NpcEntryImpl entry = new NpcEntryImpl(id, npc);
npcIdLookupMap.put(id, entry); register(entry);
return entry; return entry;
} }
@ -144,7 +144,7 @@ public class NpcRegistryImpl implements NpcRegistry {
public void delete(String id) { public void delete(String id) {
id = id.toLowerCase(); id = id.toLowerCase();
if (!npcIdLookupMap.containsKey(id)) return; if (!npcIdLookupMap.containsKey(id)) return;
npcIdLookupMap.remove(id).getNpc().delete(); unregister(npcIdLookupMap.get(id));
} }
public void unload() { public void unload() {

@ -24,7 +24,7 @@ public class V1_17PacketFactory extends V1_16PacketFactory {
properties.hasProperty(propertyRegistry.getByName("glow", Boolean.class)), properties.hasProperty(propertyRegistry.getByName("glow", Boolean.class)),
properties.getProperty(propertyRegistry.getByName("invisible", Boolean.class)), properties.getProperty(propertyRegistry.getByName("invisible", Boolean.class)),
false)); false));
if (properties.getProperty(propertyRegistry.getByName("shaking", Boolean.class))) add(data, metadataFactory.shaking()); add(data, metadataFactory.shaking(properties.getProperty(propertyRegistry.getByName("shaking", Boolean.class))));
return data; return data;
} }
} }