geforkt von Mirrors/Paper
prevent duplicate EntityInsideBlockEvent in fire
Dieser Commit ist enthalten in:
Ursprung
56e3949c61
Commit
62b6e85d1a
@ -4,11 +4,11 @@
|
||||
@Override
|
||||
protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) {
|
||||
if (!level.isClientSide && projectile.isOnFire() && this.canBeLit(state)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, hit.getBlockPos(), projectile).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, hit.getBlockPos(), projectile).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
setLit(level, state, hit.getBlockPos(), true);
|
||||
}
|
||||
}
|
||||
|
@ -44,8 +44,8 @@
|
||||
- level.setBlock(pos.below(), blockState.setValue(LEAVES, BambooLeaves.SMALL), 3);
|
||||
- level.setBlock(blockPos, blockState1.setValue(LEAVES, BambooLeaves.NONE), 3);
|
||||
+ // CraftBukkit start - moved down
|
||||
+ // world.setBlock(blockposition.below(), (IBlockData) iblockdata1.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.SMALL), 3);
|
||||
+ // world.setBlock(blockposition1, (IBlockData) iblockdata2.setValue(BlockBamboo.LEAVES, BlockPropertyBambooSize.NONE), 3);
|
||||
+ // level.setBlock(pos.below(), blockState.setValue(LEAVES, BambooLeaves.SMALL), 3);
|
||||
+ // level.setBlock(blockPos, blockState1.setValue(LEAVES, BambooLeaves.NONE), 3);
|
||||
+ shouldUpdateOthers = true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -8,11 +8,10 @@
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
@@ -128,6 +_,8 @@
|
||||
@@ -128,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) {
|
||||
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
if (!entity.fireImmune()) {
|
||||
if (entity.getRemainingFireTicks() < 0) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
private static final int CHECK_TICK_DELAY = 5;
|
||||
private int openCount;
|
||||
private double maxInteractionRange;
|
||||
+ public boolean opened; // CraftBukki
|
||||
+ public boolean opened; // CraftBukkit
|
||||
|
||||
protected abstract void onOpen(Level level, BlockPos pos, BlockState state);
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
+ public void openerAPICountChanged(Level level, BlockPos blockPos, BlockState blockState, int count, int openCount) {
|
||||
+ this.openerCountChanged(level, blockPos, blockState, count, openCount);
|
||||
+ }
|
||||
+ // CraftBukkit en
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected abstract boolean isOwnContainer(Player player);
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(level, pos, oldPower, newPower);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit en
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (i == 0) {
|
||||
this.onOpen(level, pos, state);
|
||||
|
@ -43,7 +43,7 @@
|
||||
+ if (this.level == null) return null;
|
||||
+ return io.papermc.paper.util.MCUtil.toLocation(this.level, this.worldPosition);
|
||||
+ }
|
||||
+ // CraftBukkit en
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public CrafterBlockEntity(BlockPos pos, BlockState state) {
|
||||
super(BlockEntityType.CRAFTER, pos, state);
|
||||
|
@ -122,7 +122,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -239,18 +_,54 @@
|
||||
@@ -239,18 +_,56 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,12 +175,14 @@
|
||||
|
||||
item.setCount(count);
|
||||
- if (count == 1) {
|
||||
+ // Spigot start
|
||||
+ item.shrink(origCount - itemStack.getCount());
|
||||
+ if (count <= level.spigotConfig.hopperAmount) {
|
||||
+ // Spigot end
|
||||
container.setItem(slot, item);
|
||||
}
|
||||
}
|
||||
@@ -260,12 +_,21 @@
|
||||
@@ -260,12 +_,20 @@
|
||||
|
||||
public static boolean addItem(Container container, ItemEntity item) {
|
||||
boolean flag = false;
|
||||
@ -188,8 +190,7 @@
|
||||
+ org.bukkit.event.inventory.InventoryPickupItemEvent event = new org.bukkit.event.inventory.InventoryPickupItemEvent(
|
||||
+ container.getOwner().getInventory(), (org.bukkit.entity.Item) item.getBukkitEntity()
|
||||
+ );
|
||||
+ item.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ if (!event.callEvent()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -65,7 +65,7 @@
|
||||
- .ifPresent(holder -> this.jukeboxSongPlayer.setSongWithoutPlaying((Holder<JukeboxSong>)holder, 0L));
|
||||
- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
|
||||
+ this.jukeboxSongPlayer.song = null; // CraftBukkit - reset
|
||||
+ JukeboxSong.fromStack(this.level != null ? this.level.registryAccess() : org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry(), stack) // Paper - fallback to other RegistyrAccess if no level
|
||||
+ JukeboxSong.fromStack(this.level != null ? this.level.registryAccess() : org.bukkit.craftbukkit.CraftRegistry.getMinecraftRegistry(), stack) // Paper - fallback to other RegistryAccess if no level
|
||||
+ .ifPresent(holder -> this.jukeboxSongPlayer.setSongWithoutPlaying((Holder<JukeboxSong>)holder, ticksSinceSongStarted)); // CraftBukkit - passed ticks since song started
|
||||
+ // CraftBukkit start - add null check for level
|
||||
+ if (this.level != null) {
|
||||
|
@ -72,7 +72,7 @@
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
- return 1;
|
||||
+ return maxStack;
|
||||
+ return this.maxStack; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,7 @@
|
||||
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
|
||||
} else {
|
||||
LOGGER.warn("Player {} just tried to change non-editable sign", player.getName().getString());
|
||||
+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < 32 * 32) // Paper - Dont send far away sign update
|
||||
+ if (player.distanceToSqr(this.getBlockPos().getX(), this.getBlockPos().getY(), this.getBlockPos().getZ()) < Mth.square(32)) // Paper - Don't send far away sign update
|
||||
+ ((net.minecraft.server.level.ServerPlayer) player).connection.send(this.getUpdatePacket()); // CraftBukkit
|
||||
}
|
||||
}
|
||||
@ -158,7 +158,7 @@
|
||||
+ } : this.commandSource;
|
||||
+ // Paper end - Fix commands from signs not firing command events
|
||||
+ // CraftBukkit - this
|
||||
+ return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, string, (Component) component, world.getServer(), player); // Paper - Fix commands from signs not firing command events
|
||||
+ return new CommandSourceStack(commandSource, Vec3.atCenterOf(pos), Vec2.ZERO, (ServerLevel) world, 2, string, component, world.getServer(), player); // Paper - Fix commands from signs not firing command events
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,14 +29,14 @@
|
||||
+ LoadingCache<com.mojang.datafixers.util.Pair<java.util.UUID, @org.jetbrains.annotations.Nullable GameProfile>, CompletableFuture<Optional<GameProfile>>> loadingCache = profileCacheById; // Paper - player profile events
|
||||
return loadingCache != null && !optional.isEmpty()
|
||||
- ? loadingCache.getUnchecked(optional.get().getId()).thenApply(optional1 -> optional1.or(() -> optional))
|
||||
+ ? loadingCache.getUnchecked(new com.mojang.datafixers.util.Pair<>(optional.get().getId(), optional.get())).thenApply(optional1 -> optional1.or(() -> optional)) // Paper - player profile events
|
||||
+ ? loadingCache.getUnchecked(new com.mojang.datafixers.util.Pair<>(optional.get().getId(), optional.get())).thenApply(optional1 -> optional1.or(() -> optional)) // Paper - player profile events
|
||||
: CompletableFuture.completedFuture(Optional.empty());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
- static CompletableFuture<Optional<GameProfile>> fetchProfileById(UUID id, Services services, BooleanSupplier cacheUninitialized) {
|
||||
+ static CompletableFuture<Optional<GameProfile>> fetchProfileById(com.mojang.datafixers.util.Pair<java.util.UUID, @org.jetbrains.annotations.Nullable GameProfile> id, Services services, BooleanSupplier cacheUninitialized) { // Pape
|
||||
+ static CompletableFuture<Optional<GameProfile>> fetchProfileById(com.mojang.datafixers.util.Pair<java.util.UUID, @org.jetbrains.annotations.Nullable GameProfile> id, Services services, BooleanSupplier cacheUninitialized) { // Paper
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
if (cacheUninitialized.getAsBoolean()) {
|
||||
return Optional.empty();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren