Follow up on block entities

This commit is contained in:
Bjarne Koll 2024-12-13 20:17:05 +01:00
parent b95e27be6c
commit 4091c6ac4d
No known key found for this signature in database
GPG key ID: 9576DAF3FDDB088F
3 changed files with 4 additions and 4 deletions

View file

@ -35,7 +35,7 @@
private static void makeRaidersGlow(Level level, BlockPos pos, List<LivingEntity> raiders) { private static void makeRaidersGlow(Level level, BlockPos pos, List<LivingEntity> raiders) {
- raiders.stream().filter(raider -> isRaiderWithinRange(pos, raider)).forEach(BellBlockEntity::glow); - raiders.stream().filter(raider -> isRaiderWithinRange(pos, raider)).forEach(BellBlockEntity::glow);
+ // Paper start - call bell resonate event and bell reveal raider event + // Paper start - call bell resonate event and bell reveal raider event
+ final List<org.bukkit.entity.LivingEntity> inRangeRaiders = raiders.stream().filter(raider -> isRaiderWithinRange(pos, raider)).map(e -> e.getBukkitEntity()).toList(); + final List<org.bukkit.entity.LivingEntity> inRangeRaiders = raiders.stream().filter(raider -> isRaiderWithinRange(pos, raider)).map(e -> (org.bukkit.entity.LivingEntity) e.getBukkitEntity()).toList();
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(level, pos, inRangeRaiders).forEach(e -> glow(e, pos)); + org.bukkit.craftbukkit.event.CraftEventFactory.handleBellResonateEvent(level, pos, inRangeRaiders).forEach(e -> glow(e, pos));
+ // Paper end - call bell resonate event and bell reveal raider event + // Paper end - call bell resonate event and bell reveal raider event
} }

View file

@ -24,7 +24,7 @@
+ } + }
+ +
+ @Override + @Override
+ public List<org.bukkit.entity.HumanEntity> getViewers() { + public java.util.List<org.bukkit.entity.HumanEntity> getViewers() {
+ return this.transaction; + return this.transaction;
+ } + }
+ +

View file

@ -76,7 +76,7 @@
+ +
+ org.bukkit.inventory.Inventory destinationInventory; + org.bukkit.inventory.Inventory destinationInventory;
+ // Have to special case large chests as they work oddly + // Have to special case large chests as they work oddly
+ if (attachedContainer instanceof final CompoundContainer compoundContainer) { + if (attachedContainer instanceof final net.minecraft.world.CompoundContainer compoundContainer) {
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest(compoundContainer); + destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest(compoundContainer);
+ } else if (attachedContainer.getOwner() != null) { + } else if (attachedContainer.getOwner() != null) {
+ destinationInventory = attachedContainer.getOwner().getInventory(); + destinationInventory = attachedContainer.getOwner().getInventory();
@ -140,7 +140,7 @@
+ +
+ org.bukkit.inventory.Inventory sourceInventory; + org.bukkit.inventory.Inventory sourceInventory;
+ // Have to special case large chests as they work oddly + // Have to special case large chests as they work oddly
+ if (container instanceof final CompoundContainer compoundContainer) { + if (container instanceof final net.minecraft.world.CompoundContainer compoundContainer) {
+ sourceInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest(compoundContainer); + sourceInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest(compoundContainer);
+ } else if (container.getOwner() != null) { + } else if (container.getOwner() != null) {
+ sourceInventory = container.getOwner().getInventory(); + sourceInventory = container.getOwner().getInventory();