Add registry entry and builders

This commit is contained in:
Bjarne Koll
2024-06-13 23:45:32 +02:00
parent a1b891dd88
commit 45d04f9749
8 changed files with 477 additions and 3 deletions

View File

@@ -18,10 +18,12 @@ public class CraftGameEvent extends GameEvent implements Handleable<net.minecraf
}
private final NamespacedKey key;
private final net.minecraft.resources.ResourceKey<net.minecraft.world.level.gameevent.GameEvent> handleKey; // Paper
private final net.minecraft.world.level.gameevent.GameEvent handle;
public CraftGameEvent(NamespacedKey key, net.minecraft.world.level.gameevent.GameEvent handle) {
this.key = key;
this.handleKey = net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.GAME_EVENT, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(key)); // Paper
this.handle = handle;
}
@@ -30,6 +32,18 @@ public class CraftGameEvent extends GameEvent implements Handleable<net.minecraf
return this.handle;
}
// Paper start
@Override
public int getRange() {
return this.handle.notificationRadius();
}
@Override
public int getVibrationLevel() {
return net.minecraft.world.level.gameevent.vibrations.VibrationSystem.getGameEventFrequency(this.handleKey);
}
// Paper end
@NotNull
@Override
public NamespacedKey getKey() {