From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: AlphaKR93 Date: Sat, 2 Nov 2024 15:09:42 +0900 Subject: [PATCH] Remove persist 'isClientSide' flag diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java index fa7b784a89626e8528c249d7889a598bd7ee3d49..bfb4d26549ce1d7e89a175dd9f2bf6b40adee5ef 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/BlockStarLightEngine.java @@ -46,7 +46,7 @@ public final class BlockStarLightEngine extends StarLightEngine { @Override protected boolean canUseChunk(final ChunkAccess chunk) { - return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (this.isClientSide || chunk.isLightCorrect()); + return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (/*this.isClientSide ||*/ chunk.isLightCorrect()); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java index f9aef289e9a2d6f63c98c72c56ef32b8793f57f4..7bd27bceb90b1f612a393dc55ecd455f00498fdb 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/SkyStarLightEngine.java @@ -229,7 +229,7 @@ public final class SkyStarLightEngine extends StarLightEngine { @Override protected boolean canUseChunk(final ChunkAccess chunk) { // can only use chunks for sky stuff if their sections have been init'd - return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (this.isClientSide || chunk.isLightCorrect()); + return chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT) && (/*this.isClientSide ||*/ chunk.isLightCorrect()); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java index 8aeb5fb87f94a35659347a09a638420699b52a6f..ef40af5c6ac60fe00c05adcb664c811b28330819 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightEngine.java @@ -124,7 +124,7 @@ public abstract class StarLightEngine { protected final boolean skylightPropagator; protected final int emittedLightMask; - protected final boolean isClientSide; + // protected final boolean isClientSide; // Plazma - Remove persist 'isClientSide' flag protected final Level world; protected final int minLightSection; @@ -135,7 +135,7 @@ public abstract class StarLightEngine { protected StarLightEngine(final boolean skylightPropagator, final Level world) { this.skylightPropagator = skylightPropagator; this.emittedLightMask = skylightPropagator ? 0 : 0xF; - this.isClientSide = world.isClientSide; + // this.isClientSide = world.isClientSide; // Plazma - Remove persist 'isClientSide' flag this.world = world; this.minLightSection = WorldUtil.getMinLightSection(world); this.maxLightSection = WorldUtil.getMaxLightSection(world); @@ -275,9 +275,11 @@ public abstract class StarLightEngine { Arrays.fill(this.nibbleCache, null); Arrays.fill(this.chunkCache, null); Arrays.fill(this.emptinessMapCache, null); + /* // Plazma - Remove persist 'isClientSide' flag if (this.isClientSide) { Arrays.fill(this.notifyUpdateCache, false); } + */ // Plazma - Remove persist 'isClientSide' flag } protected final BlockState getBlockState(final int worldX, final int worldY, final int worldZ) { @@ -318,6 +320,7 @@ public abstract class StarLightEngine { if (nibble != null) { nibble.set((worldX & 15) | ((worldZ & 15) << 4) | ((worldY & 15) << 8), level); + /* // Plazma - Remove persist 'isClientSide' flag if (this.isClientSide) { int cx1 = (worldX - 1) >> 4; int cx2 = (worldX + 1) >> 4; @@ -333,9 +336,11 @@ public abstract class StarLightEngine { } } } + */ // Plazma - Remove persist 'isClientSide' flag } } + /* // Plazma - Remove persist 'isClientSide' flag protected final void postLightUpdate(final int worldX, final int worldY, final int worldZ) { if (this.isClientSide) { int cx1 = (worldX - 1) >> 4; @@ -353,12 +358,14 @@ public abstract class StarLightEngine { } } } + */ // Plazma - Remove persist 'isClientSide' flag protected final void setLightLevel(final int sectionIndex, final int localIndex, final int worldX, final int worldY, final int worldZ, final int level) { final SWMRNibbleArray nibble = this.nibbleCache[sectionIndex]; if (nibble != null) { nibble.set(localIndex, level); + /* // Plazma - Remove persist 'isClientSide' flag if (this.isClientSide) { int cx1 = (worldX - 1) >> 4; int cx2 = (worldX + 1) >> 4; @@ -374,6 +381,7 @@ public abstract class StarLightEngine { } } } + */ // Plazma - Remove persist 'isClientSide' flag } } @@ -1166,7 +1174,7 @@ public abstract class StarLightEngine { } currentNibble.set(localIndex, targetLevel); - this.postLightUpdate(offX, offY, offZ); + //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 1) { if (queueLength >= queue.length) { @@ -1225,7 +1233,7 @@ public abstract class StarLightEngine { } currentNibble.set(localIndex, targetLevel); - this.postLightUpdate(offX, offY, offZ); + //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 1) { if (queueLength >= queue.length) { @@ -1331,7 +1339,7 @@ public abstract class StarLightEngine { } currentNibble.set(localIndex, 0); - this.postLightUpdate(offX, offY, offZ); + //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 0) { if (queueLength >= queue.length) { @@ -1414,7 +1422,7 @@ public abstract class StarLightEngine { } currentNibble.set(localIndex, 0); - this.postLightUpdate(offX, offY, offZ); + //this.postLightUpdate(offX, offY, offZ); // Plazma - Remove persist 'isClientSide' flag if (targetLevel > 0) { // we actually need to propagate 0 just in case we find a neighbour... if (queueLength >= queue.length) { diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java index 571db5f9bf94745a8afe2cd313e593fb15db5e37..43e42d265513feedc54f3780f37427a50d8f7df7 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java @@ -57,7 +57,7 @@ public final class StarLightInterface { private final LayerLightEventListener skyReader; private final LayerLightEventListener blockReader; - private final boolean isClientSide; + //private final boolean isClientSide; // Plazma - Remove persist 'isClientSide' flag public final int minSection; public final int maxSection; @@ -74,7 +74,7 @@ public final class StarLightInterface { this.world = lightAccess == null ? null : (Level)lightAccess.getLevel(); this.cachedSkyPropagators = hasSkyLight && lightAccess != null ? new ArrayDeque<>() : null; this.cachedBlockPropagators = hasBlockLight && lightAccess != null ? new ArrayDeque<>() : null; - this.isClientSide = !(this.world instanceof ServerLevel); + //this.isClientSide = !(this.world instanceof ServerLevel); // Plazma - Remove persist 'isClientSide' flag if (this.world == null) { this.minSection = -4; this.maxSection = 19; @@ -126,7 +126,7 @@ public final class StarLightInterface { @Override public DataLayer getDataLayerData(final SectionPos pos) { final ChunkAccess chunk = StarLightInterface.this.getAnyChunkNow(pos.getX(), pos.getZ()); - if (chunk == null || (!StarLightInterface.this.isClientSide && !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { + if (chunk == null || (/*!StarLightInterface.this.isClientSide &&*/ !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { // Plazma - Remove persist 'isClientSide' flag return null; } @@ -238,7 +238,7 @@ public final class StarLightInterface { final int minLightSection = this.minLightSection; final int maxLightSection = this.maxLightSection; - if (chunk == null || (!this.isClientSide && !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { + if (chunk == null || (/*!this.isClientSide &&*/ !chunk.isLightCorrect()) || !chunk.getPersistedStatus().isOrAfter(ChunkStatus.LIGHT)) { // Plazma - Remove persist 'isClientSide' flag return 15; } @@ -337,9 +337,11 @@ public final class StarLightInterface { return this.blockReader; } + /* // Plazma - Remove persist 'isClientSide' flag public boolean isClientSide() { return this.isClientSide; } + */ // Plazma - Remove persist 'isClientSide' flag public ChunkAccess getAnyChunkNow(final int chunkX, final int chunkZ) { if (this.world == null) { diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java index 8d82425ccbc30b3f4a59767ca72bf37311ddeda0..e137cc2e16a7b1532501bb3bb568236b427d171b 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java @@ -203,7 +203,7 @@ public class Commands { SayCommand.register(this.dispatcher); ScheduleCommand.register(this.dispatcher); ScoreboardCommand.register(this.dispatcher, commandRegistryAccess); - SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED); + SeedCommand.register(this.dispatcher, true); // Plazma - Remove persist 'isClientSide' flag SetBlockCommand.register(this.dispatcher, commandRegistryAccess); SetSpawnCommand.register(this.dispatcher); SetWorldSpawnCommand.register(this.dispatcher); @@ -234,12 +234,12 @@ public class Commands { WardenSpawnTrackerCommand.register(this.dispatcher); SpawnArmorTrimsCommand.register(this.dispatcher); ServerPackCommand.register(this.dispatcher); - if (environment.includeDedicated) { + //if (environment.includeDedicated) { // Plazma - Remove persist 'isClientSide' flag DebugConfigCommand.register(this.dispatcher); - } + //} // Plazma - Remove persist 'isClientSide' flag } - if (environment.includeDedicated) { + //if (environment.includeDedicated) { // Plazma - Remove persist 'isClientSide' flag BanIpCommands.register(this.dispatcher); BanListCommands.register(this.dispatcher); BanPlayerCommands.register(this.dispatcher); @@ -263,11 +263,13 @@ public class Commands { org.purpurmc.purpur.command.CompassCommand.register(this.dispatcher); // Purpur org.purpurmc.purpur.command.RamBarCommand.register(this.dispatcher); // Purpur org.purpurmc.purpur.command.RamCommand.register(this.dispatcher); // Purpur - } + //} // Plazma - Remove persist 'isClientSide' flag + /* // Plazma - Remove persist 'isClientSide' flag if (environment.includeIntegrated) { PublishCommand.register(this.dispatcher); } + */ // Plazma - Remove persist 'isClientSide' flag // Paper start - Vanilla command permission fixes for (final CommandNode node : this.dispatcher.getRoot().getChildren()) { @@ -731,18 +733,7 @@ public class Commands { } } - public static enum CommandSelection { - - ALL(true, true), DEDICATED(false, true), INTEGRATED(true, false); - - final boolean includeIntegrated; - final boolean includeDedicated; - - private CommandSelection(final boolean flag, final boolean flag1) { - this.includeIntegrated = flag; - this.includeDedicated = flag1; - } - } + public enum CommandSelection { ALL, DEDICATED, INTEGRATED } // Plazma - Remove persist 'isClientSide' flag @FunctionalInterface public interface ParseFunction { diff --git a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java index ee2c4c5265d96afe592c5007b0b6ad7649ce5190..2495456fae536d83afd8023f531aeb65ec10bf82 100644 --- a/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/src/main/java/net/minecraft/core/cauldron/CauldronInteraction.java @@ -72,7 +72,7 @@ public interface CauldronInteraction { PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS); if (potioncontents != null && potioncontents.is(Potions.WATER)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; @@ -86,7 +86,7 @@ public interface CauldronInteraction { // world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit world.playSound((Player) null, blockposition, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -102,7 +102,7 @@ public interface CauldronInteraction { }, SoundEvents.BUCKET_FILL, hitDirection); // Paper - add hitDirection }); map1.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack, hitDirection) -> { // Paper - add hitDirection - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) { return InteractionResult.SUCCESS; @@ -116,7 +116,7 @@ public interface CauldronInteraction { // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit world.playSound((Player) null, blockposition, SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, blockposition); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; }); @@ -127,7 +127,7 @@ public interface CauldronInteraction { PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS); if (potioncontents != null && potioncontents.is(Potions.WATER)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; @@ -139,7 +139,7 @@ public interface CauldronInteraction { // world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL)); // CraftBukkit world.playSound((Player) null, blockposition, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -218,7 +218,7 @@ public interface CauldronInteraction { if (!fullPredicate.test(state)) { return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - fire PlayerBucketFillEvent if (hitDirection != null) { org.bukkit.event.player.PlayerBucketEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerBucketFillEvent((net.minecraft.server.level.ServerLevel) world, player, pos, pos, hitDirection, stack, output.getItem(), hand); @@ -241,7 +241,7 @@ public interface CauldronInteraction { // world.setBlockAndUpdate(blockposition, Blocks.CAULDRON.defaultBlockState()); // CraftBukkit world.playSound((Player) null, pos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -253,7 +253,7 @@ public interface CauldronInteraction { } static InteractionResult emptyBucket(Level world, BlockPos pos, Player player, InteractionHand hand, ItemStack stack, BlockState state, SoundEvent soundEvent, @javax.annotation.Nullable net.minecraft.core.Direction hitDirection) { // Paper end - add hitDirection - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - fire PlayerBucketEmptyEvent ItemStack output = new ItemStack(Items.BUCKET); if (hitDirection != null) { @@ -277,7 +277,7 @@ public interface CauldronInteraction { // world.setBlockAndUpdate(blockposition, iblockdata); // CraftBukkit world.playSound((Player) null, pos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -300,7 +300,7 @@ public interface CauldronInteraction { if (!(block instanceof ShulkerBoxBlock)) { return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(state, world, pos, player, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) { return InteractionResult.SUCCESS; @@ -311,7 +311,7 @@ public interface CauldronInteraction { player.setItemInHand(hand, ItemUtils.createFilledResult(stack, player, itemstack1, false)); player.awardStat(Stats.CLEAN_SHULKER_BOX); // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } } @@ -322,7 +322,7 @@ public interface CauldronInteraction { if (bannerpatternlayers.layers().isEmpty()) { return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(state, world, pos, player, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) { return InteractionResult.SUCCESS; @@ -334,7 +334,7 @@ public interface CauldronInteraction { player.setItemInHand(hand, ItemUtils.createFilledResult(stack, player, itemstack1, false)); player.awardStat(Stats.CLEAN_BANNER); // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -346,7 +346,7 @@ public interface CauldronInteraction { } else if (!stack.has(DataComponents.DYED_COLOR)) { return InteractionResult.TRY_WITH_EMPTY_HAND; } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (!LayeredCauldronBlock.lowerFillLevel(state, world, pos, player, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) { return InteractionResult.SUCCESS; @@ -355,7 +355,7 @@ public interface CauldronInteraction { stack.remove(DataComponents.DYED_COLOR); player.awardStat(Stats.CLEAN_ARMOR); // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java index c6490554a3025f4de3f3218178fad76cd1848a19..e65245ab6c6c6f3fcb425f963f12cade3618e8e9 100644 --- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java @@ -542,7 +542,7 @@ public interface DispenseItemBehavior { if (!BoneMealItem.growCrop(stack, worldserver, blockposition) && !BoneMealItem.growWaterPlant(stack, worldserver, blockposition, (Direction) null)) { this.setSuccess(false); - } else if (!worldserver.isClientSide) { + } else /*if (!worldserver.isClientSide)*/ { // Plazma - Remove persist 'isClientSide' flag worldserver.levelEvent(1505, blockposition, 15); } // CraftBukkit start @@ -700,10 +700,10 @@ public interface DispenseItemBehavior { // CraftBukkit end if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) { - if (!worldserver.isClientSide) { + //if (!worldserver.isClientSide) { // Plazma - Remove persist 'isClientSide' flag worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3); worldserver.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition); - } + //} // Plazma - Remove persist 'isClientSide' flag stack.shrink(1); this.setSuccess(true); @@ -910,11 +910,11 @@ public interface DispenseItemBehavior { return result; } // Paper end - Call missing BlockDispenseEvent - if (!worldserver.isClientSide) { + //if (!worldserver.isClientSide) { // Plazma - Remove persist 'isClientSide' flag for (int k = 0; k < 5; ++k) { worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D); } - } + //} // Plazma - Remove persist 'isClientSide' flag worldserver.playSound((Player) null, blockposition, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); worldserver.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition); diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java index 65ed3d77a51b8299517e0c165403b0c5ac413475..5c7dbb218b6a9a7ccb2c9dbab93a7d8be26ee3e6 100644 --- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java +++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java @@ -60,7 +60,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { } // CraftBukkit end - if (!worldserver.isClientSide()) { + //if (!worldserver.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING)); this.setSuccess(ShearsDispenseItemBehavior.tryShearBeehive(worldserver, blockposition) || ShearsDispenseItemBehavior.tryShearLivingEntity(worldserver, blockposition, stack, bukkitBlock, craftItem)); // CraftBukkit @@ -68,7 +68,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { stack.hurtAndBreak(1, worldserver, (ServerPlayer) null, (item) -> { }); } - } + //} // Plazma - Remove persist 'isClientSide' flag return stack; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 6e9766aff9a9f2b578f5b8a6b42e206fb7ad1bc6..421b3c524a2828fdd8b0b95c37bce9b79fc7825d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -270,8 +270,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> list = TagLoader.loadTagsForExistingRegistries(resourcemanager, this.registries.compositeAccess(), io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.RELOAD); // Paper - tag lifecycle - add cause - return ReloadableServerResources.loadResources(resourcemanager, this.registries, list, this.worldData.enabledFeatures(), this.isDedicatedServer() ? Commands.CommandSelection.DEDICATED : Commands.CommandSelection.INTEGRATED, this.getFunctionCompilationLevel(), this.executor, this).whenComplete((datapackresources, throwable) -> { + return ReloadableServerResources.loadResources(resourcemanager, this.registries, list, this.worldData.enabledFeatures(), Commands.CommandSelection.DEDICATED, this.getFunctionCompilationLevel(), this.executor, this).whenComplete((datapackresources, throwable) -> { // Plazma - Remove persist 'isClientSide' flag if (throwable != null) { resourcemanager.close(); } @@ -2687,16 +2689,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason), true); i++; - } + //} // Plazma - Remove persist 'isClientSide' flag } if (i == 0) { diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 45fa867a22481bbba86e587767cfdb96d9691c49..5a9e2d55649679af44339afc8a1f84859ca73082 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -197,13 +197,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.info("Loading properties"); DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties(); - if (this.isSingleplayer()) { + /*if (this.isSingleplayer()) { // Plazma - Remove persist 'isClientSide' flag this.setLocalIp("127.0.0.1"); - } else { + } else {*/ // Plazma - Remove persist 'isClientSide' flag this.setUsesAuthentication(dedicatedserverproperties.onlineMode); this.setPreventProxyConnections(dedicatedserverproperties.preventProxyConnections); this.setLocalIp(dedicatedserverproperties.serverIp); - } + //} // Plazma - Remove persist 'isClientSide' flag // Spigot start this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings")); @@ -839,10 +839,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface SkullBlockEntity.clear(); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isSingleplayerOwner(GameProfile profile) { return false; } + */ // Plazma - Remove persist 'isClientSide' flag @Override public int getScaledTrackingDistance(int initialDistance) { @@ -875,11 +877,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface return this.settings.getProperties().serverResourcePackInfo; } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void endMetricsRecordingTick() { super.endMetricsRecordingTick(); this.debugSampleSubscriptionTracker.tick(this.getTickCount()); } + */ // Plazma - Remove persist 'isClientSide' flag @Override public SampleLogger getTickTimeLogger() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index a4421517b8136bb974e197eaa6dd0d83c2fdd0de..3a8b566aa44df367c6edacf371c0b7a2bd2548b6 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -679,9 +679,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.prepareWeather(); this.getWorldBorder().setAbsoluteMaxSize(minecraftserver.getAbsoluteMaxWorldSize()); this.raids = (Raids) this.getDataStorage().computeIfAbsent(Raids.factory(this), Raids.getFileId(this.dimensionTypeRegistration())); - if (!minecraftserver.isSingleplayer()) { + //if (!minecraftserver.isSingleplayer()) { // Plazma - Completely remove Mojang profiler iworlddataserver.setGameType(minecraftserver.getDefaultGameType()); - } + //} // Plazma - Completely remove Mojang profiler long l = minecraftserver.getWorldData().worldGenOptions().seed(); @@ -1149,43 +1149,37 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } private void announceSleepStatus() { - if (this.canSleepThroughNights()) { - if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) { - int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); - Component ichatmutablecomponent; - - if (this.sleepStatus.areEnoughSleeping(i)) { - // Purpur start - if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) { - return; - } - if (!org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) { - ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepSkippingNight)); - } else - ichatmutablecomponent = Component.translatable("sleep.skipping_night"); - } else { - if (org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) { - return; - } - if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) { - ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent, - net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())), - net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i))))); - } else - // Purpur end - ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i)); - } + // Plazma start - Remove persist 'isClientSide' flag + if (!this.canSleepThroughNights()) return; - Iterator iterator = this.players.iterator(); - - while (iterator.hasNext()) { - ServerPlayer entityplayer = (ServerPlayer) iterator.next(); + int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); + Component ichatmutablecomponent; - entityplayer.displayClientMessage(ichatmutablecomponent, true); - } + if (this.sleepStatus.areEnoughSleeping(i)) { + // Purpur start + if (org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.isBlank()) return; + if (!org.purpurmc.purpur.PurpurConfig.sleepSkippingNight.equalsIgnoreCase("default")) { + ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepSkippingNight)); + } else { + ichatmutablecomponent = Component.translatable("sleep.skipping_night"); } + } else { + if (org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.isBlank()) return; + if (!org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent.equalsIgnoreCase("default")) { + ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.sleepingPlayersPercent, + net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("count", Integer.toString(this.sleepStatus.amountSleeping())), + net.kyori.adventure.text.minimessage.tag.resolver.Placeholder.parsed("total", Integer.toString(this.sleepStatus.sleepersNeeded(i))))); + } else { + // Purpur end + ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i)); + } + } + + for (final ServerPlayer player : this.players) { + player.displayClientMessage(ichatmutablecomponent, true); } + // Plazma end - Remove persist 'isClientSide' flag } public void updateSleepingPlayerList() { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index e6001fadc04b63b82e20652bbb16cb1db5cf44bd..ba8ff8f39d3ba39db9c2ce6070cabe33381f4adb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1014,7 +1014,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate; } // Paper end - Configurable container update tick rate - if (!this.level().isClientSide && this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - Prevent opening inventories when frozen + if (/*!this.level().isClientSide &&*/ this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - Prevent opening inventories when frozen // Plazma - Remove persist 'isClientSide' flag this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - Inventory close reason this.containerMenu = this.inventoryMenu; } @@ -1462,7 +1462,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple } } // Purpur end - boolean flag = this.server.isDedicatedServer() && this.isPvpAllowed() && source.is(DamageTypeTags.IS_FALL); + boolean flag = this.isPvpAllowed() && source.is(DamageTypeTags.IS_FALL); // Plazma - Remove persist 'isClientSide' flag if (!flag && this.spawnInvulnerableTime > 0 && !source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { return false; diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java index a8484b9659f175cc20985bf66082616ceb31df4d..abd93a93e6c9367c022259d1ab3895e2764ac702 100644 --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java @@ -432,10 +432,12 @@ public class WorldGenRegion implements WorldGenLevel { return this.level.getWorldBorder(); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return false; } + */ // Plazma - Remove persist 'isClientSide' flag /** @deprecated */ @Deprecated diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java index 7d276c191b391bca24948ddb36b8b7d0f1f03b03..a71c220ea1c464c193029adb1a0d3e5c237442af 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -122,12 +122,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack this.onDisconnect(info, null); } public void onDisconnect(DisconnectionDetails info, @Nullable net.kyori.adventure.text.Component quitMessage) { + /* // Plazma - Remove persist 'isClientSide' flag // Paper end - Fix kick event leave message not being sent if (this.isSingleplayerOwner()) { ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out"); this.server.halt(false); } - + */ // Plazma - Remove persist 'isClientSide' flag } @Override @@ -154,7 +155,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack this.latency = (this.latency * 3 + i) / 4; this.keepAlivePending = false; - } else if (!this.isSingleplayerOwner()) { + } else /*if (!this.isSingleplayerOwner())*/ { // Plazma - Remove persist 'isClientSide' flag this.disconnectAsync(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - add proper async disconnect } @@ -295,7 +296,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } else // Purpur end - if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets + if (/*!this.isSingleplayerOwner() &&*/ elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets // Plazma - Remove persist 'isClientSide' flag if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause } else if (this.checkIfClosed(currentTime)) { // Paper @@ -466,9 +467,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } // Paper end - add proper async disconnect + /* // Plazma - Remove persist 'isClientSide' flag protected boolean isSingleplayerOwner() { return this.server.isSingleplayerOwner(this.playerProfile()); } + */ // Plazma - Remove persist 'isClientSide' flag protected abstract GameProfile playerProfile(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 91f161d27a45174b6f3c31440eea46ff81185203..ef7bc59e6b340c88a5379f9f4724b1c82bda4ef7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -590,7 +590,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper end - Prevent moving into unloaded chunks - if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { + if (d10 - d9 > Math.max(100.0D, Math.pow(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed, 2)) /*&& !this.isSingleplayerOwner()*/) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); this.send(new ClientboundMoveVehiclePacket(entity)); @@ -825,7 +825,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start - if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - configurable tab spam limits + if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) /*&& !this.server.isSingleplayerOwner(this.player.getGameProfile())*/) { // Paper - configurable tab spam limits // Plazma - Remove persist 'isClientSide' flag this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect return; } @@ -1702,9 +1702,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private boolean shouldCheckPlayerMovement0(boolean elytra) { // Plazma end - Add option to bypass moved to quickly check + /* // Plazma - Remove persist 'isClientSide' flag if (this.isSingleplayerOwner()) { return false; - } else if (this.player.isChangingDimension()) { + } else*/ if (this.player.isChangingDimension()) { // Plazma - Remove persist 'isClientSide' flag return false; } else { GameRules gamerules = this.player.serverLevel().getGameRules(); @@ -2654,7 +2655,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Spigot end // this.chatSpamThrottler.increment(); - if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { + if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) /*&& !this.server.isSingleplayerOwner(this.player.getGameProfile())*/) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit end this.disconnectAsync((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause // Paper - add proper async disconnect } @@ -3682,15 +3683,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); + /* // Plazma - Remove persist 'isClientSide' flag if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { // this.server.setDifficulty(packet.getDifficulty(), false); // Paper - per level difficulty; don't allow clients to change this } + */ // Plazma - Remove persist 'isClientSide' flag } @Override public void handleLockDifficulty(ServerboundLockDifficultyPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { + if (this.player.hasPermissions(2) /*|| this.isSingleplayerOwner()*/) { // Plazma - Remove persist 'isClientSide' flag this.server.setDifficultyLocked(packet.isLocked()); } } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index bb10892f33ba0d7fc3959debef1045073868f8b8..ab6a7d20f5473d8bffa7f8d136c1d55f17bbfaff 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -181,48 +181,39 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, } // Paper end - Validate usernames this.requestedUsername = packet.name(); - GameProfile gameprofile = this.server.getSingleplayerProfile(); - - if (gameprofile != null && this.requestedUsername.equalsIgnoreCase(gameprofile.getName())) { - this.startClientVerification(gameprofile); + // Plazma start - Remove persist 'isClientSide' flag + if (this.server.usesAuthentication() && !this.connection.isMemoryConnection()) { + this.state = ServerLoginPacketListenerImpl.State.KEY; + this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true)); } else { - if (this.server.usesAuthentication() && !this.connection.isMemoryConnection()) { - this.state = ServerLoginPacketListenerImpl.State.KEY; - this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true)); - } else { - // Paper start - Add Velocity IP Forwarding Support - if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { - this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); - net.minecraft.network.FriendlyByteBuf buf = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.buffer()); - buf.writeByte(com.destroystokyo.paper.proxy.VelocityProxy.MAX_SUPPORTED_FORWARDING_VERSION); - net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet1 = new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket(this.velocityLoginMessageId, new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket.PlayerInfoChannelPayload(com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, buf)); - this.connection.send(packet1); - return; - } - // Paper end - Add Velocity IP Forwarding Support - // CraftBukkit start - // Paper start - Cache authenticator threads - authenticatorPool.execute(new Runnable() { - - @Override - public void run() { - try { - GameProfile gameprofile = ServerLoginPacketListenerImpl.this.createOfflineProfile(ServerLoginPacketListenerImpl.this.requestedUsername); // Spigot - - gameprofile = ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); // Paper - Add more fields to AsyncPlayerPreLoginEvent - ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); - ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); - } catch (Exception ex) { - ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); - ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex); - } - } - }); - // Paper end - Cache authenticator threads - // CraftBukkit end + // Paper start - Add Velocity IP Forwarding Support + if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { + this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); + net.minecraft.network.FriendlyByteBuf buf = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.buffer()); + buf.writeByte(com.destroystokyo.paper.proxy.VelocityProxy.MAX_SUPPORTED_FORWARDING_VERSION); + net.minecraft.network.protocol.login.ClientboundCustomQueryPacket packet1 = new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket(this.velocityLoginMessageId, new net.minecraft.network.protocol.login.ClientboundCustomQueryPacket.PlayerInfoChannelPayload(com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, buf)); + this.connection.send(packet1); + return; } + // Paper end - Add Velocity IP Forwarding Support + // CraftBukkit start + // Paper start - Cache authenticator threads + authenticatorPool.execute(() -> { + try { + GameProfile gameprofile = ServerLoginPacketListenerImpl.this.createOfflineProfile(ServerLoginPacketListenerImpl.this.requestedUsername); // Spigot + gameprofile = ServerLoginPacketListenerImpl.this.callPlayerPreLoginEvents(gameprofile); // Paper - Add more fields to AsyncPlayerPreLoginEvent + ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); + ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); + } catch (Exception ex) { + ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); + ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex); + } + }); + // Paper end - Cache authenticator threads + // CraftBukkit end } + // Plazma end - Remove persist 'isClientSide' flag } void startClientVerification(GameProfile profile) { @@ -318,21 +309,21 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, // CraftBukkit end ServerLoginPacketListenerImpl.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId()); ServerLoginPacketListenerImpl.this.startClientVerification(gameprofile); - } else if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { + } /*else if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { // Plazma - Remove persist 'isClientSide' flag ServerLoginPacketListenerImpl.LOGGER.warn("Failed to verify username but will let them in anyway!"); ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(s1)); // Spigot - } else { + }*/ else { // Plazma - Remove persist 'isClientSide' flag ServerLoginPacketListenerImpl.this.disconnect(org.purpurmc.purpur.PurpurConfig.unverifiedUsername.equals("default") ? Component.translatable("multiplayer.disconnect.unverified_username") : io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.minimessage.MiniMessage.miniMessage().deserialize(org.purpurmc.purpur.PurpurConfig.unverifiedUsername))); // Purpur ServerLoginPacketListenerImpl.LOGGER.error("Username '{}' tried to join with an invalid session", s1); } } catch (AuthenticationUnavailableException authenticationunavailableexception) { - if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { + /*if (ServerLoginPacketListenerImpl.this.server.isSingleplayer()) { // Plazma - Remove persist 'isClientSide' flag ServerLoginPacketListenerImpl.LOGGER.warn("Authentication servers are down but will let them in anyway!"); ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(s1)); // Spigot - } else { + } else {*/ // Plazma - Remove persist 'isClientSide' flag ServerLoginPacketListenerImpl.this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.authenticationServersDown)); // Paper - Configurable kick message ServerLoginPacketListenerImpl.LOGGER.error("Couldn't verify username because servers are unavailable"); - } + //} // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - catch all exceptions } catch (Exception exception) { ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java index 653856d0b8dcf2baf4cc77a276f17c8cc1fa717e..1f2958d21c279ecb377b7c90ba643ea83e217eca 100644 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java @@ -275,7 +275,7 @@ public class OldUsersConverter { if (optional.isPresent()) { return (UUID) optional.get(); - } else if (!server.isSingleplayer() && server.usesAuthentication()) { + } else if (/*!server.isSingleplayer() &&*/ server.usesAuthentication()) { // Plazma - Remove persist 'isClientSide' flag final List list = Lists.newArrayList(); ProfileLookupCallback profilelookupcallback = new ProfileLookupCallback() { public void onProfileLookupSucceeded(GameProfile gameprofile) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 579f81ed04eeb6373b25e6794d3bf0c403891011..e0b70bac3018dc39e6c8e47171060332ec2f63f2 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -517,7 +517,7 @@ public abstract class PlayerList { CompoundTag nbttagcompound = this.server.getWorldData().getLoadedPlayerTag(); Optional optional; - if (this.server.isSingleplayerOwner(player.getGameProfile()) && nbttagcompound != null) { + if (/*this.server.isSingleplayerOwner(player.getGameProfile()) &&*/ nbttagcompound != null) { // Plazma - Remove persist 'isClientSide' flag optional = Optional.of(nbttagcompound); player.load(nbttagcompound); PlayerList.LOGGER.debug("loading single player"); @@ -1176,7 +1176,7 @@ public abstract class PlayerList { } public boolean isOp(GameProfile profile) { - return this.ops.contains(profile) || this.server.isSingleplayerOwner(profile) && this.server.getWorldData().isAllowCommands() || this.allowCommandsForAllPlayers; + return this.ops.contains(profile) || /*this.server.isSingleplayerOwner(profile) &&*/ this.server.getWorldData().isAllowCommands() || this.allowCommandsForAllPlayers; // Plazma - Remove persist 'isClientSide' flag } @Nullable diff --git a/src/main/java/net/minecraft/util/profiling/jfr/Environment.java b/src/main/java/net/minecraft/util/profiling/jfr/Environment.java index 5250e97ccfe3c5bcb98980d46d2257165ad508a6..17953a59188048ad3ab388d9713ada6148a682b6 100644 --- a/src/main/java/net/minecraft/util/profiling/jfr/Environment.java +++ b/src/main/java/net/minecraft/util/profiling/jfr/Environment.java @@ -3,7 +3,6 @@ package net.minecraft.util.profiling.jfr; import net.minecraft.server.MinecraftServer; public enum Environment { - CLIENT("client"), SERVER("server"); private final String description; @@ -13,7 +12,7 @@ public enum Environment { } public static Environment from(MinecraftServer server) { - return server.isDedicatedServer() ? SERVER : CLIENT; + return SERVER; // Plazma - Remove persist 'isClientSide' flag } public String getDescription() { diff --git a/src/main/java/net/minecraft/world/entity/AgeableMob.java b/src/main/java/net/minecraft/world/entity/AgeableMob.java index 119856b22df5bbcd4e5bf5f95645156f774c6168..809b72d0eb69f21d0d71515259e5e2f9d01d6232 100644 --- a/src/main/java/net/minecraft/world/entity/AgeableMob.java +++ b/src/main/java/net/minecraft/world/entity/AgeableMob.java @@ -32,7 +32,7 @@ public abstract class AgeableMob extends PathfinderMob { public void inactiveTick() { super.inactiveTick(); - if ( this.level().isClientSide || this.ageLocked ) + if ( /*this.level().isClientSide ||*/ this.ageLocked ) // Plazma - Remove persist 'isClientSide' flag { // CraftBukkit this.refreshDimensions(); } else @@ -82,7 +82,7 @@ public abstract class AgeableMob extends PathfinderMob { } public int getAge() { - return this.level().isClientSide ? ((Boolean) this.entityData.get(AgeableMob.DATA_BABY_ID) ? -1 : 1) : this.age; + return /*this.level().isClientSide ? ((Boolean) this.entityData.get(AgeableMob.DATA_BABY_ID) ? -1 : 1) :*/ this.age; // Plazma - Remove persist 'isClientSide' flag } public void ageUp(int age, boolean overGrow) { @@ -154,7 +154,7 @@ public abstract class AgeableMob extends PathfinderMob { @Override public void aiStep() { super.aiStep(); - if (this.level().isClientSide || this.ageLocked) { // CraftBukkit + if (/*this.level().isClientSide ||*/ this.ageLocked) { // CraftBukkit // Plazma - Remove persist 'isClientSide' flag if (this.forcedAgeTimer > 0) { if (this.forcedAgeTimer % 4 == 0) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java index 7eba7c0e7b8d2795abbe96b3d86a9c1a3b6b74a6..629212c180be71daa0db77f3a247468efadb0608 100644 --- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java +++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java @@ -87,9 +87,9 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { } public void setRadius(float radius) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.getEntityData().set(AreaEffectCloud.DATA_RADIUS, Mth.clamp(radius, 0.0F, 32.0F)); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -170,12 +170,14 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { if (world instanceof ServerLevel worldserver) { this.serverTick(worldserver); - } else { + } /*else { // Plazma - Remove persist 'isClientSide' flag this.clientTick(); } + */ // Plazma - Remove persist 'isClientSide' flag } + /* // Plazma - Remove persist 'isClientSide' flag private void clientTick() { boolean flag = this.isWaiting(); float f = this.getRadius(); @@ -215,6 +217,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { } } + */ // Plazma - Remove persist 'isClientSide' flag private void serverTick(ServerLevel world) { if (this.tickCount >= this.waitTime + this.duration) { diff --git a/src/main/java/net/minecraft/world/entity/Display.java b/src/main/java/net/minecraft/world/entity/Display.java index e6cbf4506c75046a89fad778e138b448fb4a29a9..adb30845aaf8f3f0f6ede5b8480ffcdd11b887db 100644 --- a/src/main/java/net/minecraft/world/entity/Display.java +++ b/src/main/java/net/minecraft/world/entity/Display.java @@ -147,6 +147,7 @@ public abstract class Display extends Entity { this.stopRiding(); } + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.updateStartTick) { this.updateStartTick = false; @@ -185,6 +186,7 @@ public abstract class Display extends Entity { } } } + */ // Plazma - Remove persist 'isClientSide' flag } protected abstract void updateRenderSubState(boolean shouldLerp, float lerpProgress); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index eaf53f5f4c33ca7a7a988e7bd04b7033e16f9529..99d15d6beed3e3d165e71e0955074cc09b02a333 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -581,7 +581,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Purpur start - copied from Mob - API for any mob to burn daylight public boolean isSunBurnTick() { - if (this.level().isDay() && !this.level().isClientSide) { + if (this.level().isDay() /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag float f = this.getLightLevelDependentMagicValue(); BlockPos blockposition = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ()); boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow; @@ -974,9 +974,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } this.checkBelowWorld(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setSharedFlagOnFire(this.remainingFireTicks > 0); - } + //} // Plazma - Remove persist 'isClientSide' flag this.firstTick = false; world = this.level(); @@ -1263,9 +1263,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess BlockPos blockposition = this.getOnPosLegacy(); BlockState iblockdata = this.level().getBlockState(blockposition); - if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { + //if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.checkFallDamage(vec3d1.y, this.onGround(), iblockdata, blockposition); - } + //} // Plazma - Remove persist 'isClientSide' flag if (this.isRemoved()) { gameprofilerfiller.pop(); @@ -1276,6 +1276,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z); } + /* // Plazma - Remove persist 'isClientSide' flag if (this.isControlledByLocalInstance()) { Block block = iblockdata.getBlock(); @@ -1283,6 +1284,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess block.updateEntityMovementAfterFallOn(this.level(), this); } } + */ // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) { @@ -1306,13 +1308,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // CraftBukkit end - if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { + //if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag Entity.MovementEmission entity_movementemission = this.getMovementEmission(); if (entity_movementemission.emitsAnything() && !this.isPassenger()) { this.applyMovementEmissionAndPlaySound(entity_movementemission, vec3d1, blockposition, iblockdata); } - } + //} // Plazma - Remove persist 'isClientSide' flag float f = this.getBlockSpeedFactor(); @@ -1442,9 +1444,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void extinguishFire() { - if (!this.level().isClientSide && this.wasOnFire) { + //if (!this.level().isClientSide && this.wasOnFire) { // Plazma - Remove persist 'isClientSide' flag this.playEntityOnFireExtinguishedSound(); - } + //} // Plazma - Remove persist 'isClientSide' flag this.clearFire(); } @@ -3125,7 +3127,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public InteractionResult interact(Player player, InteractionHand hand) { if (this.isAlive() && this instanceof Leashable leashable) { if (leashable.getLeashHolder() == player) { - if (!this.level().isClientSide()) { + //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag if (hand == InteractionHand.OFF_HAND && (level().purpurConfig.villagerCanBeLeashed || level().purpurConfig.wanderingTraderCanBeLeashed) && this instanceof net.minecraft.world.entity.npc.AbstractVillager) return InteractionResult.CONSUME; // Purpur // CraftBukkit start - fire PlayerUnleashEntityEvent // Paper start - Expand EntityUnleashEvent @@ -3138,7 +3140,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit end leashable.dropLeash(true, event.isDropLeash()); // Paper - Expand EntityUnleashEvent this.gameEvent(GameEvent.ENTITY_INTERACT, player); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -3146,7 +3148,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess ItemStack itemstack = player.getItemInHand(hand); if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) { - if (!this.level().isClientSide()) { + //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - fire PlayerLeashEntityEvent if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) { // ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item // Paper - Fix inventory desync @@ -3156,7 +3158,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // CraftBukkit end leashable.setLeashedTo(player, true); - } + //} // Plazma - Remove persist 'isClientSide' flag itemstack.shrink(1); return InteractionResult.SUCCESS; @@ -3228,7 +3230,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return false; } else if (!entity.couldAcceptPassenger()) { return false; - } else if (!force && !this.level().isClientSide() && !entity.type.canSerialize()) { // SPIGOT-7947: Allow force riding all entities + } else if (!force && /*!this.level().isClientSide() &&*/ !entity.type.canSerialize()) { // SPIGOT-7947: Allow force riding all entities // Plazma - Remove persist 'isClientSide' flag return false; } else { for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) { @@ -3323,7 +3325,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } else { List list = Lists.newArrayList(this.passengers); - if (!this.level().isClientSide && passenger instanceof Player && !(this.getFirstPassenger() instanceof Player)) { + if (/*!this.level().isClientSide &&*/ passenger instanceof Player && !(this.getFirstPassenger() instanceof Player)) { // Plazma - Remove persist 'isClientSide' flag list.add(0, passenger); } else { list.add(passenger); @@ -3527,20 +3529,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void handleDamageEvent(DamageSource damageSource) {} - public void handleEntityEvent(byte status) { - switch (status) { - case 53: - HoneyBlock.showSlideParticles(this); - default: - } - } + public void handleEntityEvent(byte status) {} // Plazma - Remove persist 'isClientSide' flag public void animateHurt(float yaw) {} public boolean isOnFire() { - boolean flag = this.level() != null && this.level().isClientSide; + // boolean flag = this.level() != null && this.level().isClientSide; // Plazma - Remove persist 'isClientSide' flag - return !this.fireImmune() && (this.remainingFireTicks > 0 || flag && this.getSharedFlag(0)); + return !this.fireImmune() && (this.remainingFireTicks > 0 /*|| flag && this.getSharedFlag(0)*/); // Plazma - Remove persist 'isClientSide' flag } public boolean isPassenger() { @@ -3628,7 +3624,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public boolean isCurrentlyGlowing() { - return this.level().isClientSide() ? this.getSharedFlag(6) : this.hasGlowingTag; + return /*this.level().isClientSide() ? this.getSharedFlag(6) :*/ this.hasGlowingTag; // Plazma - Remove persist 'isClientSide' flag } public boolean isInvisible() { @@ -4395,7 +4391,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.reapplyPosition(); boolean flag = entitysize1.width() <= 4.0F && entitysize1.height() <= 4.0F; - if (!this.level.isClientSide && !this.firstTick && !this.noPhysics && flag && (entitysize1.width() > entitysize.width() || entitysize1.height() > entitysize.height()) && !(this instanceof Player)) { + if (/*!this.level.isClientSide &&*/ !this.firstTick && !this.noPhysics && flag && (entitysize1.width() > entitysize.width() || entitysize1.height() > entitysize.height()) && !(this instanceof Player)) { // Plazma - Remove persist 'isClientSide' flag this.fudgePositionAfterSizeChange(entitysize); } @@ -4665,6 +4661,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } + /* // Plazma - Remove persist 'isClientSide' flag public boolean isControlledByOrIsLocalPlayer() { if (this instanceof Player entityhuman) { return entityhuman.isLocalPlayer(); @@ -4682,6 +4679,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.isEffectiveAi(); } } + */ // Plazma - Remove persist 'isClientSide' flag public boolean isControlledByClient() { net.minecraft.world.entity.LivingEntity entityliving = this.getControllingPassenger(); @@ -4689,9 +4687,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return entityliving != null && entityliving.isControlledByClient(); } + /* // Plazma - Remove persist 'isClientSide' flag public boolean isEffectiveAi() { return !this.level().isClientSide; } + */ // Plazma - Remove persist 'isClientSide' flag protected static Vec3 getCollisionHorizontalEscapeVector(double vehicleWidth, double passengerWidth, float passengerYaw) { double d2 = (vehicleWidth + passengerWidth + 9.999999747378752E-6D) / 2.0D; diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java index 1d50b03246d114c6583815205eeacb7ac8549aec..2ff0dc3823c1b0c4e2c26fbc7196f420286ed2e9 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -577,23 +577,24 @@ public class EntityType implements FeatureElement, EntityTypeT } public static void updateCustomEntityTag(Level world, @Nullable Player player, @Nullable Entity entity, CustomData nbt) { - MinecraftServer minecraftserver = world.getServer(); - - if (minecraftserver != null && entity != null) { - if (world.isClientSide || !entity.onlyOpCanSetNbt() || player != null && minecraftserver.getPlayerList().isOp(player.getGameProfile())) { - // Paper start - filter out protected tags - if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) { - nbt = nbt.update((compound) -> { - for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) { - tag.remove(compound); - } - }); - } - // Paper end - filter out protected tags + MinecraftServer server = world.getServer(); - nbt.loadInto(entity); - } + // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations + if (server == null || entity == null) return; + if (entity.onlyOpCanSetNbt() && (player == null || !server.getPlayerList().isOp(player.getGameProfile()))) return; + + // Paper start - filter out protected tags + if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) { + nbt = nbt.update((compound) -> { + for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) { + tag.remove(compound); + } + }); } + // Paper end - filter out protected tags + + nbt.loadInto(entity); + // Plazma end - Remove persist 'isClientSide' flag & Apply some optimizations } public boolean canSerialize() { diff --git a/src/main/java/net/minecraft/world/entity/FlyingMob.java b/src/main/java/net/minecraft/world/entity/FlyingMob.java index 255f0c078cf931ee0612358900fa73e6c43a9a66..dc0d2c31b0d6624cb8fe8fbc3b0ed0fb45f335b1 100644 --- a/src/main/java/net/minecraft/world/entity/FlyingMob.java +++ b/src/main/java/net/minecraft/world/entity/FlyingMob.java @@ -16,7 +16,7 @@ public abstract class FlyingMob extends Mob { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag if (this.isInWater()) { this.moveRelative(0.02F, movementInput); this.move(MoverType.SELF, this.getDeltaMovement()); @@ -41,7 +41,7 @@ public abstract class FlyingMob extends Mob { this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale((double)f)); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/Interaction.java b/src/main/java/net/minecraft/world/entity/Interaction.java index 221d73676fe2fd240a47cf312c1179e049298cac..bc991efa3d1845642df3741e650aa559c3f6edab 100644 --- a/src/main/java/net/minecraft/world/entity/Interaction.java +++ b/src/main/java/net/minecraft/world/entity/Interaction.java @@ -175,12 +175,14 @@ public class Interaction extends Entity implements Attackable, Targeting { @Override public InteractionResult interact(Player player, InteractionHand hand) { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return this.getResponse() ? InteractionResult.SUCCESS : InteractionResult.CONSUME; } else { + */ // Plazma - Remove persist 'isClientSide' flag this.interaction = new Interaction.PlayerAction(player.getUUID(), this.level().getGameTime()); return InteractionResult.CONSUME; - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java index 5f880a8809f9c20bc8e8c0b2d48590bab02cf077..4b3270614918103703f9a89170004f5ddcba5091 100644 --- a/src/main/java/net/minecraft/world/entity/Leashable.java +++ b/src/main/java/net/minecraft/world/entity/Leashable.java @@ -276,6 +276,7 @@ public interface Leashable { if (leashable_a == null) { return null; } else { + /* // Plazma - Remove persist 'isClientSide' flag if (leashable_a.delayedLeashHolderId != 0 && entity.level().isClientSide) { Entity entity1 = entity.level().getEntity(leashable_a.delayedLeashHolderId); @@ -283,6 +284,7 @@ public interface Leashable { leashable_a.setLeashHolder(entity1); } } + */ // Plazma - Remove persist 'isClientSide' flag return leashable_a.leashHolder; } diff --git a/src/main/java/net/minecraft/world/entity/LightningBolt.java b/src/main/java/net/minecraft/world/entity/LightningBolt.java index 12127b14babf646711d3a118416453c4f1ac1460..447bcaf2a13d0f6f2752de9862ae1276811a329d 100644 --- a/src/main/java/net/minecraft/world/entity/LightningBolt.java +++ b/src/main/java/net/minecraft/world/entity/LightningBolt.java @@ -88,10 +88,12 @@ public class LightningBolt extends Entity { public void tick() { super.tick(); if (!this.isEffect && this.life == 2) { // Paper - Properly handle lightning effects api + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_THUNDER, SoundSource.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F, false); this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.LIGHTNING_BOLT_IMPACT, SoundSource.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F, false); } else { + */ // Plazma - Remove persist 'isClientSide' flag Difficulty enumdifficulty = this.level().getDifficulty(); if (enumdifficulty == Difficulty.NORMAL || enumdifficulty == Difficulty.HARD) { @@ -101,7 +103,7 @@ public class LightningBolt extends Entity { this.powerLightningRod(); LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition(), this); // Paper - Call EntityChangeBlockEvent this.gameEvent(GameEvent.LIGHTNING_STRIKE); - } + //} // Plazma - Remove persist 'isClientSide' flag } --this.life; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 02288d8f3521756770351c02f623f9db02efd40c..05f5932b771cef2739f9effb9993c3cb4bdb1960 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -460,7 +460,7 @@ public abstract class LivingEntity extends Entity implements Attackable { ProfilerFiller gameprofilerfiller = Profiler.get(); gameprofilerfiller.push("livingEntityBaseTick"); - if (this.fireImmune() || this.level().isClientSide) { + if (this.fireImmune() /*|| this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.clearFire(); } @@ -508,7 +508,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } } - if (!this.level().isClientSide && this.isPassenger() && this.getVehicle() != null && this.getVehicle().dismountsUnderwater()) { + if (/*!this.level().isClientSide &&*/ this.isPassenger() && this.getVehicle() != null && this.getVehicle().dismountsUnderwater()) { // Plazma - Remove persist 'isClientSide' flag this.stopRiding(); } } else if (this.getAirSupply() < this.getMaxAirSupply()) { @@ -646,7 +646,7 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void tickDeath() { ++this.deathTime; - if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) { + if (this.deathTime >= 20 /*&& !this.level().isClientSide()*/ && !this.isRemoved()) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 60); this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause } @@ -760,7 +760,7 @@ public abstract class LivingEntity extends Entity implements Attackable { public void onEquipItem(EquipmentSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) { // CraftBukkit end - if (!this.level().isClientSide() && !this.isSpectator()) { + if (/*!this.level().isClientSide() &&*/ !this.isSpectator()) { // Plazma - Remove persist 'isClientSide' flag boolean flag = itemstack1.isEmpty() && itemstack.isEmpty(); if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) { @@ -875,7 +875,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } } // Paper end - Friction API - if (nbt.contains("attributes", 9) && this.level() != null && !this.level().isClientSide) { + if (nbt.contains("attributes", 9) && this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.getAttributes().load(nbt.getList("attributes", 10)); } @@ -983,7 +983,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (!mobeffect.tick(this, () -> { this.onEffectUpdated(mobeffect, true, (Entity) null); })) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect, null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EXPIRATION); if (event.isCancelled()) { @@ -992,7 +992,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // CraftBukkit end iterator.remove(); this.onEffectsRemoved(List.of(mobeffect)); - } + //} // Plazma - Remove persist 'isClientSide' flag } else if (mobeffect.getDuration() % 600 == 0) { this.onEffectUpdated(mobeffect, false, (Entity) null); } @@ -1013,10 +1013,10 @@ public abstract class LivingEntity extends Entity implements Attackable { // CraftBukkit end if (this.effectsDirty) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updateInvisibilityStatus(); this.updateGlowingStatus(); - } + //} // Plazma - Remove persist 'isClientSide' flag this.effectsDirty = false; } @@ -1151,9 +1151,10 @@ public abstract class LivingEntity extends Entity implements Attackable { public boolean removeAllEffects(EntityPotionEffectEvent.Cause cause) { // CraftBukkit end + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return false; - } else if (this.activeEffects.isEmpty()) { + } else*/ if (this.activeEffects.isEmpty()) { // Plazma - Remove persist 'isClientSide' flag return false; } else { // CraftBukkit start @@ -1326,10 +1327,10 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void onEffectAdded(MobEffectInstance effect, @Nullable Entity source) { this.effectsDirty = true; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag ((MobEffect) effect.getEffect().value()).addAttributeModifiers(this.getAttributes(), effect.getAmplifier()); this.sendEffectToPassengers(effect); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -1348,7 +1349,7 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void onEffectUpdated(MobEffectInstance effect, boolean reapplyEffect, @Nullable Entity source) { this.effectsDirty = true; - if (reapplyEffect && !this.level().isClientSide) { + if (reapplyEffect /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag MobEffect mobeffectlist = (MobEffect) effect.getEffect().value(); mobeffectlist.removeAttributeModifiers(this.getAttributes()); @@ -1356,15 +1357,15 @@ public abstract class LivingEntity extends Entity implements Attackable { this.refreshDirtyAttributes(); } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.sendEffectToPassengers(effect); - } + //} // Plazma - Remove persist 'isClientSide' flag } protected void onEffectsRemoved(Collection effects) { this.effectsDirty = true; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag Iterator iterator = effects.iterator(); while (iterator.hasNext()) { @@ -1385,7 +1386,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.refreshDirtyAttributes(); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -1918,7 +1919,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.stopSleeping(); } - if (!this.level().isClientSide && this.hasCustomName()) { + if (/*!this.level().isClientSide &&*/ this.hasCustomName()) { // Plazma - Remove persist 'isClientSide' flag if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot } @@ -2779,9 +2780,6 @@ public abstract class LivingEntity extends Entity implements Attackable { case 52: this.breakItem(this.getItemBySlot(EquipmentSlot.FEET)); break; - case 54: - HoneyBlock.showJumpParticles(this); - break; case 55: this.swapHandItems(); break; @@ -3092,7 +3090,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag FluidState fluid = this.level().getFluidState(this.blockPosition()); if ((this.isInWater() || this.isInLava()) && this.isAffectedByFluids() && !this.canStandOnFluid(fluid)) { @@ -3103,7 +3101,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.travelInAir(movementInput); } - } + //} // Plazma - Remove persist 'isClientSide' flag } private void travelInAir(Vec3 movementInput) { @@ -3116,12 +3114,14 @@ public abstract class LivingEntity extends Entity implements Attackable { if (mobeffect != null) { d0 += (0.05D * (double) (mobeffect.getAmplifier() + 1) - vec3d1.y) * 0.2D; + /* // Plazma - Remove persist 'isClientSide' flag } else if (this.level().isClientSide && !this.level().hasChunkAt(blockposition)) { if (this.getY() > (double) this.level().getMinY()) { d0 = -0.1D; } else { d0 = 0.0D; } + */ // Plazma - Remove persist 'isClientSide' flag } else { d0 -= this.getEffectiveGravity(); } @@ -3199,11 +3199,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.setDeltaMovement(this.updateFallFlyingMovement(vec3d)); this.move(MoverType.SELF, this.getDeltaMovement()); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double d1 = this.getDeltaMovement().horizontalDistance(); this.handleFallFlyingCollisions(d0, d1); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -3253,12 +3253,12 @@ public abstract class LivingEntity extends Entity implements Attackable { Vec3 vec3d1 = this.getRiddenInput(controllingPlayer, movementInput); this.tickRidden(controllingPlayer, vec3d1); - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.setSpeed(this.getRiddenSpeed(controllingPlayer)); this.travel(vec3d1); - } else { + /*} else { // Plazma - Remove persist 'isClientSide' flag this.setDeltaMovement(Vec3.ZERO); - } + }*/ // Plazma - Remove persist 'isClientSide' flag } @@ -3362,7 +3362,7 @@ public abstract class LivingEntity extends Entity implements Attackable { super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag int i = this.getArrowCount(); if (i > 0) { @@ -3397,7 +3397,7 @@ public abstract class LivingEntity extends Entity implements Attackable { if (this.isSleeping() && !this.checkBedExists()) { this.stopSleeping(); } - } + //} // Plazma - Remove persist 'isClientSide' flag if (!this.isRemoved()) { this.aiStep(); @@ -3655,9 +3655,10 @@ public abstract class LivingEntity extends Entity implements Attackable { if (this.lerpSteps > 0) { this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot); --this.lerpSteps; - } else if (!this.isEffectiveAi()) { + } /*else if (!this.isEffectiveAi()) { // Plazma - Remove persist 'isClientSide' flag this.setDeltaMovement(this.getDeltaMovement().scale(0.98D)); } + */ // Plazma - Remove persist 'isClientSide' flag if (this.lerpHeadSteps > 0) { this.lerpHeadRotationStep(this.lerpHeadSteps, this.lerpYHeadRot); @@ -3689,7 +3690,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.jumping = false; this.xxa = 0.0F; this.zza = 0.0F; - } else if (this.isEffectiveAi()) { + } else /*if (this.isEffectiveAi())*/ { // Plazma - Remove persist 'isClientSide' flag gameprofilerfiller.push("newAi"); this.serverAiStep(); gameprofilerfiller.pop(); @@ -3752,14 +3753,14 @@ public abstract class LivingEntity extends Entity implements Attackable { this.travel(vec3d1); } - if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { + // if (!this.level().isClientSide() || this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.applyEffectsFromBlocks(); - } + //} // Plazma - Remove persist 'isClientSide' flag this.calculateEntityAnimation(this instanceof FlyingAnimal); gameprofilerfiller.pop(); gameprofilerfiller.push("freezing"); - if (!this.level().isClientSide && !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API + if (/*!this.level().isClientSide &&*/ !this.isDeadOrDying() && !this.freezeLocked) { // Paper - Freeze Tick Lock API // Plazma - Remove persist 'isClientSide' flag int i = this.getTicksFrozen(); if (this.isInPowderSnow && this.canFreeze()) { @@ -3862,7 +3863,7 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void updateFallFlying() { this.checkSlowFallDistance(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (!this.canGlide()) { if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit this.setSharedFlag(7, false); @@ -3895,7 +3896,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.gameEvent(GameEvent.ELYTRA_GLIDE); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -3998,7 +3999,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.autoSpinAttackTicks = 0; } - if (!this.level().isClientSide && this.autoSpinAttackTicks <= 0) { + if (/*!this.level().isClientSide &&*/ this.autoSpinAttackTicks <= 0) { // Plazma - Remove persist 'isClientSide' flag this.setLivingEntityFlag(4, false); this.autoSpinAttackDmg = 0.0F; this.autoSpinAttackItemStack = null; @@ -4027,7 +4028,7 @@ public abstract class LivingEntity extends Entity implements Attackable { Entity entity = this.getVehicle(); super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation - if (entity != null && entity != this.getVehicle() && !this.level().isClientSide && entity.valid) { // Paper - don't process on world gen + if (entity != null && entity != this.getVehicle() /*&& !this.level().isClientSide*/ && entity.valid) { // Paper - don't process on world gen // Plazma - Remove persist 'isClientSide' flag this.dismountVehicle(entity); } @@ -4101,7 +4102,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void take(Entity item, int count) { - if (!item.isRemoved() && !this.level().isClientSide && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) { + if (!item.isRemoved() /*&& !this.level().isClientSide*/ && (item instanceof ItemEntity || item instanceof AbstractArrow || item instanceof ExperienceOrb)) { // Plazma - Remove persist 'isClientSide' flag ((ServerLevel) this.level()).getChunkSource().broadcastAndSend(this, new ClientboundTakeItemEntityPacket(item.getId(), this.getId(), count)); // Paper - broadcast with collector as source } @@ -4246,7 +4247,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper start - lag compensate eating // we add 1 to the expected time to avoid lag compensating when we should not final boolean shouldLagCompensate = this.useItem.has(DataComponents.FOOD) && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1L + this.totalEatTimeTicks) * 50L * (1000L * 1000L)); - if ((--this.useItemRemaining == 0 || shouldLagCompensate) && !this.level().isClientSide && !stack.useOnRelease()) { + if ((--this.useItemRemaining == 0 || shouldLagCompensate) /*&& !this.level().isClientSide*/ && !stack.useOnRelease()) { // Plazma - Remove persist 'isClientSide' flag this.useItemRemaining = 0; // Paper end - lag compensate eating this.completeUsingItem(); @@ -4290,11 +4291,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.useItemRemaining = this.totalEatTimeTicks = itemstack.getUseDuration(this); this.eatStartTime = System.nanoTime(); // Paper end - lag compensate eating - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); this.gameEvent(GameEvent.ITEM_INTERACT_START); - } + //} // Plazma - Remove persist 'isClientSide' flag } } @@ -4302,6 +4303,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { super.onSyncedDataUpdated(data); + /* // Plazma - Remove persist 'isClientSide' flag if (LivingEntity.SLEEPING_POS_ID.equals(data)) { if (this.level().isClientSide) { this.getSleepingPos().ifPresent(this::setPosToBed); @@ -4320,6 +4322,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // Paper end - lag compensate eating } } + */ // Plazma - Remove persist 'isClientSide' flag } @@ -4354,61 +4357,52 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void completeUsingItem() { - if (!this.level().isClientSide || this.isUsingItem()) { - InteractionHand enumhand = this.getUsedItemHand(); + // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations + InteractionHand enumhand = this.getUsedItemHand(); - if (!this.useItem.equals(this.getItemInHand(enumhand))) { - this.releaseUsingItem(); - } else { - if (!this.useItem.isEmpty() && this.isUsingItem()) { - this.startUsingItem(this.getUsedItemHand(), true); // Paper - Prevent consuming the wrong itemstack - // CraftBukkit start - fire PlayerItemConsumeEvent - ItemStack itemstack; - PlayerItemConsumeEvent event = null; // Paper - if (this instanceof ServerPlayer entityPlayer) { - org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem); - org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand); - event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper - this.level().getCraftServer().getPluginManager().callEvent(event); + if (!this.useItem.equals(this.getItemInHand(enumhand))) { + this.releaseUsingItem(); + return; + } - if (event.isCancelled()) { - // Update client - Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); - if (consumable != null) { - consumable.cancelUsingItem(entityPlayer, this.useItem); - } - entityPlayer.getBukkitEntity().updateInventory(); - entityPlayer.getBukkitEntity().updateScaledHealth(); - this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use - return; - } + if (this.useItem.isEmpty() || !this.isUsingItem()) return; - itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this); - } else { - itemstack = this.useItem.finishUsingItem(this.level(), this); - } - // Paper start - save the default replacement item and change it if necessary - final ItemStack defaultReplacement = itemstack; - if (event != null && event.getReplacement() != null) { - itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); - } - // Paper end - // CraftBukkit end + this.startUsingItem(this.getUsedItemHand(), true); // Paper - Prevent consuming the wrong itemstack - if (itemstack != this.useItem) { - this.setItemInHand(enumhand, itemstack); - } + // CraftBukkit start - fire PlayerItemConsumeEvent + ItemStack itemstack; + PlayerItemConsumeEvent event = null; // Paper + if (this instanceof ServerPlayer player) { + org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem); + org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand); - this.stopUsingItem(); - // Paper start - if (this instanceof ServerPlayer) { - ((ServerPlayer) this).getBukkitEntity().updateInventory(); - } - // Paper end - } + event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand); // Paper + this.level().getCraftServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + // Update client + Consumable consumable = this.useItem.get(DataComponents.CONSUMABLE); + if (consumable != null) consumable.cancelUsingItem(player, this.useItem); + + player.getBukkitEntity().updateInventory(); + player.getBukkitEntity().updateScaledHealth(); + this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use + return; } + + itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this); + } else { + itemstack = this.useItem.finishUsingItem(this.level(), this); } + + if (event != null && event.getReplacement() != null) itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); // Paper + // CraftBukkit end + + if (itemstack != this.useItem) this.setItemInHand(enumhand, itemstack); + this.stopUsingItem(); + + if (this instanceof ServerPlayer player) player.getBukkitEntity().updateInventory(); // Paper + // Plazma end - Remove persist 'isClientSide' flag & Apply some optimizations } public void handleExtraItemsCreatedOnUse(ItemStack stack) {} @@ -4438,14 +4432,14 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void stopUsingItem() { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag = this.isUsingItem(); this.setLivingEntityFlag(1, false); if (flag) { this.gameEvent(GameEvent.ITEM_INTERACT_FINISH); } - } + //} // Plazma - Remove persist 'isClientSide' flag this.useItem = ItemStack.EMPTY; // Paper start - lag compensate eating @@ -4883,7 +4877,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public boolean isCurrentlyGlowing() { - return !this.level().isClientSide() && this.hasEffect(MobEffects.GLOWING) || super.isCurrentlyGlowing(); + return /*!this.level().isClientSide() &&*/ this.hasEffect(MobEffects.GLOWING) || super.isCurrentlyGlowing(); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java index 331a75fee26e3fe2532e8661db282a0c207ddf9b..997c5b3deed7c55e5685fba76bcbb53e10e66d9f 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -444,11 +444,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } public void spawnAnim() { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.makePoofParticles(); } else { + */ // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 20); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -465,7 +467,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void tick() { super.tick(); - if (!this.level().isClientSide && this.tickCount % 5 == 0) { + if (/*!this.level().isClientSide &&*/ this.tickCount % 5 == 0) { // Plazma - Remove persist 'isClientSide' flag this.updateControlFlags(); } @@ -1678,10 +1680,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return flag1; } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isEffectiveAi() { return super.isEffectiveAi() && !this.isNoAi(); } + */ // Plazma - Remove persist 'isClientSide' flag public void setNoAi(boolean aiDisabled) { byte b0 = (Byte) this.entityData.get(Mob.DATA_MOB_FLAGS_ID); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java index 771bb96032149a8573d1de14fa2ab19012c82000..f268c787d6ecef639633fbc7a36676fd184ae7cd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java @@ -86,10 +86,10 @@ public class RemoveBlockGoal extends MoveToBlockGoal { if (this.ticksSinceReachedGoal > 0) { vec3d = this.removerMob.getDeltaMovement(); this.removerMob.setDeltaMovement(vec3d.x, 0.3D, vec3d.z); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag d0 = 0.08D; ((ServerLevel) world).sendParticles(new ItemParticleOption(ParticleTypes.ITEM, new ItemStack(Items.EGG)), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.7D, (double) blockposition1.getZ() + 0.5D, 3, ((double) randomsource.nextFloat() - 0.5D) * 0.08D, ((double) randomsource.nextFloat() - 0.5D) * 0.08D, ((double) randomsource.nextFloat() - 0.5D) * 0.08D, 0.15000000596046448D); - } + //} // Plazma - Remove persist 'isClientSide' flag } if (this.ticksSinceReachedGoal % 2 == 0) { @@ -107,7 +107,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { } // CraftBukkit end world.removeBlock(blockposition1, false); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag for (int i = 0; i < 20; ++i) { d0 = randomsource.nextGaussian() * 0.02D; double d1 = randomsource.nextGaussian() * 0.02D; @@ -117,7 +117,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { } this.playBreakSound(world, blockposition1); - } + //} // Plazma - Remove persist 'isClientSide' flag } ++this.ticksSinceReachedGoal; diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java index c8ffbbccbf20ce911a3d75fa860d5a1452c5e590..0d3f4702c8bf3d66b01b42c5da1761e93e1d6ed2 100644 --- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java +++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java @@ -48,9 +48,9 @@ public class Bat extends AmbientCreature { public Bat(EntityType type, Level world) { super(type, world); this.moveControl = new org.purpurmc.purpur.controller.FlyingWithSpacebarMoveControllerWASD(this, 0.075F); // Purpur - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setResting(true); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java index 9708ed3e00059fdf5d1d60e0c607d0ab153d1d3f..b9410b8c039d182d8764029a27b9c98de0c17bb8 100644 --- a/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java +++ b/src/main/java/net/minecraft/world/entity/animal/AbstractFish.java @@ -100,7 +100,7 @@ public abstract class AbstractFish extends WaterAnimal implements Bucketable { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance() && this.isInWater()) { + if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag this.moveRelative(getRider() != null ? getSpeed() : 0.01F, movementInput); // Purpur this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java index 9987d28ea145f6d0126cb4ea22001e0922fb51bd..45663e0d5ee361972b6c3ed9d3c8c294f5f2af43 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Animal.java +++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java @@ -158,7 +158,7 @@ public abstract class Animal extends AgeableMob { if (this.isFood(itemstack)) { int i = this.getAge(); - if (!this.level().isClientSide && i == 0 && this.canFallInLove() && (this.level().purpurConfig.animalBreedingCooldownSeconds <= 0 || !this.level().hasBreedingCooldown(player.getUUID(), this.getClass()))) { // Purpur + if (/*!this.level().isClientSide &&*/ i == 0 && this.canFallInLove() && (this.level().purpurConfig.animalBreedingCooldownSeconds <= 0 || !this.level().hasBreedingCooldown(player.getUUID(), this.getClass()))) { // Purpur // Plazma - Remove persist 'isClientSide' flag final ItemStack breedCopy = itemstack.copy(); // Paper - Fix EntityBreedEvent copying this.usePlayerItem(player, hand, itemstack); this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying @@ -173,9 +173,11 @@ public abstract class Animal extends AgeableMob { return InteractionResult.SUCCESS; } + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return InteractionResult.CONSUME; } + */ // Plazma - Remove persist 'isClientSide' flag } return super.mobInteract(player, hand); diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java index dc8df0912c1d18176e18a8f4dc43c4f60f81b659..6dec1720aea724baab541e26e14c9fa0646abdbf 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -576,7 +576,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public void aiStep() { super.aiStep(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.stayOutOfHiveCountdown > 0) { --this.stayOutOfHiveCountdown; } @@ -595,7 +595,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { if (this.tickCount % 20 == 0 && !this.isHiveValid()) { this.hivePos = null; } - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java b/src/main/java/net/minecraft/world/entity/animal/Bucketable.java index 4eca5996a867086be22d22d99db81ab001467516..dff6c0615defa87e7b4e01c0df2d0a5fdeb7ecbb 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bucketable.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bucketable.java @@ -118,9 +118,9 @@ public interface Bucketable { player.setItemInHand(hand, itemstack2); Level world = entity.level(); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer) player, itemstack1); - } + //} // Plazma - Remove persist 'isClientSide' flag entity.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause return Optional.of(InteractionResult.SUCCESS); diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java index 4aad4fdc80070f4000e929fff126714fc67050b0..721e450242a36b2c0998a78fa86a1cc40dcc9ee6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Cat.java +++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java @@ -451,22 +451,22 @@ public class Cat extends TamableAnimal implements VariantHolder 0.03D) { Vec3 vec3d = this.getViewVector(0.0F); float f = Mth.cos(this.getYRot() * 0.017453292F) * 0.3F; @@ -389,6 +390,7 @@ public class Dolphin extends AgeableWaterCreature { this.level().addParticle(ParticleTypes.DOLPHIN, this.getX() - vec3d.x * (double) f2 - (double) f, this.getY() - vec3d.y, this.getZ() - vec3d.z * (double) f2 - (double) f1, 0.0D, 0.0D, 0.0D); } } + */ // Plazma - Remove persist 'isClientSide' flag } } @@ -419,9 +421,9 @@ public class Dolphin extends AgeableWaterCreature { ItemStack itemstack = player.getItemInHand(hand); if (!itemstack.isEmpty() && itemstack.is(ItemTags.FISHES)) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.playSound(SoundEvents.DOLPHIN_EAT, 1.0F, 1.0F); - } + //} // Plazma - Remove persist 'isClientSide' flag if (this.isBaby()) { itemstack.consume(1, player); @@ -472,7 +474,7 @@ public class Dolphin extends AgeableWaterCreature { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance() && this.isInWater()) { + if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag this.moveRelative(this.getSpeed(), movementInput); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java index ac044be03494c3d6bad6bbc22321445e04d430cc..f25ce3f42157d7303304c39e3b990f6648a441f9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java +++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java @@ -257,7 +257,7 @@ public class Fox extends Animal implements VariantHolder { @Override public void aiStep() { - if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) { + if (/*!this.level().isClientSide &&*/ this.isAlive() /*&& this.isEffectiveAi()*/) { // Plazma - Remove persist 'isClientSide' flag ++this.ticksSinceEaten; ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND); @@ -559,14 +559,16 @@ public class Fox extends Animal implements VariantHolder { } private void spitOutItem(ItemStack stack) { - if (!stack.isEmpty() && !this.level().isClientSide) { - ItemEntity entityitem = new ItemEntity(this.level(), this.getX() + this.getLookAngle().x, this.getY() + 1.0D, this.getZ() + this.getLookAngle().z, stack); + // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations + if (stack.isEmpty()) return; - entityitem.setPickUpDelay(40); - entityitem.setThrower(this); - this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F); - this.spawnAtLocation((net.minecraft.server.level.ServerLevel) this.level(), entityitem); // Paper - Call EntityDropItemEvent - } + ItemEntity entityitem = new ItemEntity(this.level(), this.getX() + this.getLookAngle().x, this.getY() + 1.0D, this.getZ() + this.getLookAngle().z, stack); + + entityitem.setPickUpDelay(40); + entityitem.setThrower(this); + this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F); + this.spawnAtLocation((net.minecraft.server.level.ServerLevel) this.level(), entityitem); // Paper - Call EntityDropItemEvent + // Plazma - Remove persist 'isClientSide' flag & Apply some optimizations } private void dropItemStack(ItemStack stack) { @@ -601,7 +603,7 @@ public class Fox extends Animal implements VariantHolder { @Override public void tick() { super.tick(); - if (this.isEffectiveAi()) { + //if (this.isEffectiveAi()) { // Plazma - Remove persist 'isClientSide' flag boolean flag = this.isInWater(); if (flag || this.getTarget() != null || this.level().isThundering()) { @@ -618,7 +620,7 @@ public class Fox extends Animal implements VariantHolder { this.level().levelEvent(2001, blockposition, Block.getId(iblockdata)); } - } + //} // Plazma - Remove persist 'isClientSide' flag this.interestedAngleO = this.interestedAngle; if (this.isInterested()) { diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java index 9a6471d2f1eb1c8af006b70b6bba0b668220fb00..cf071f48fb9b3acb7fabe4295de979dfca1079b4 100644 --- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java +++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java @@ -162,9 +162,9 @@ public class IronGolem extends AbstractGolem implements NeutralMob { --this.offerFlowerTick; } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updatePersistentAnger((ServerLevel) this.level(), true); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java index dee59cb4b87845c940ee089aa932aa69dd2539d6..89527365aefb6077cf6b4f771ca47c054d0efb78 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java @@ -206,7 +206,7 @@ public class Ocelot extends Animal { if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && player.distanceToSqr((Entity) this) < 9.0D) { this.usePlayerItem(player, hand, itemstack); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, player).isCancelled()) { // CraftBukkit - added event call and isCancelled check this.setTrusting(true); this.spawnTrustingParticles(true); @@ -215,7 +215,7 @@ public class Ocelot extends Animal { this.spawnTrustingParticles(false); this.level().broadcastEntityEvent(this, (byte) 40); } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java index 83372c86bd54eedd9b136ddfcbfc67d303058c0a..2df413fce51db6360c2a55fde72061135e0bd3a9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java +++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java @@ -463,12 +463,12 @@ public class Panda extends Animal { if (this.isEating()) { this.addEatingParticles(); - if (!this.level().isClientSide && this.getEatCounter() > 80 && this.random.nextInt(20) == 1) { + if (/*!this.level().isClientSide &&*/ this.getEatCounter() > 80 && this.random.nextInt(20) == 1) { // Plazma - Remove persist 'isClientSide' flag if (this.getEatCounter() > 100 && this.getItemBySlot(EquipmentSlot.MAINHAND).is(ItemTags.PANDA_EATS_FROM_GROUND)) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); this.gameEvent(GameEvent.EAT); - } + //} // Plazma - Remove persist 'isClientSide' flag this.sit(false); } @@ -549,7 +549,7 @@ public class Panda extends Animal { if (this.rollCounter > 32) { this.roll(false); } else { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag Vec3 vec3d = this.getDeltaMovement(); if (this.rollCounter == 1) { @@ -563,7 +563,7 @@ public class Panda extends Animal { } else { this.setDeltaMovement(0.0D, this.onGround() ? 0.27D : vec3d.y, 0.0D); } - } + //} // Plazma - Remove persist 'isClientSide' flag } } @@ -705,7 +705,7 @@ public class Panda extends Animal { if (this.isBaby()) { this.usePlayerItem(player, hand, itemstack); this.ageUp((int) ((float) (-this.getAge() / 20) * 0.1F), true); - } else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) { + } else if (/*!this.level().isClientSide &&*/ this.getAge() == 0 && this.canFallInLove()) { // Plazma - Remove persist 'isClientSide' flag final ItemStack breedCopy = itemstack.copy(); // Paper - Fix EntityBreedEvent copying this.usePlayerItem(player, hand, itemstack); this.setInLove(player, breedCopy); // Paper - Fix EntityBreedEvent copying @@ -880,25 +880,19 @@ public class Panda extends Animal { @Override public boolean canUse() { - if (super.canUse() && this.panda.getUnhappyCounter() == 0) { - if (!this.canFindBamboo()) { - if (this.unhappyCooldown <= this.panda.tickCount) { - this.panda.setUnhappyCounter(32); - this.unhappyCooldown = this.panda.tickCount + 600; - if (this.panda.isEffectiveAi()) { - Player entityhuman = this.level.getNearestPlayer(Panda.BREED_TARGETING, this.panda); - - this.panda.lookAtPlayerGoal.setTarget(entityhuman); - } - } + // Plazma start - Remove persist 'isClientSide' flag + if (!super.canUse() && this.panda.getUnhappyCounter() != 0) return false; + if (this.canFindBamboo()) return true; - return false; - } else { - return true; - } - } else { - return false; - } + if (this.unhappyCooldown > this.panda.tickCount) return false; + + this.panda.setUnhappyCounter(32); + this.unhappyCooldown = this.panda.tickCount + 600; + Player player = this.level.getNearestPlayer(Panda.BREED_TARGETING, this.panda); + + this.panda.lookAtPlayerGoal.setTarget(player); + return false; + // Plazma end - Remove persist 'isClientSide' flag } private boolean canFindBamboo() { diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java index 28a9d267099f6c24f71dc5a11179d59c27265a88..a0a55f1da46f8e9be4e2a776678333eb5f8e42f6 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java @@ -329,22 +329,22 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder data) { + /* // Plazma - Remove persist 'isClientSide' flag if (Pig.DATA_BOOST_TIME.equals(data) && this.level().isClientSide) { this.steering.onSynced(); } + */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } @@ -207,9 +209,9 @@ public class Pig extends Animal implements ItemSteerable, Saddleable { } if (!flag && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.startRiding(this); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java index 86c44912a363401bdd716c22d24dfd7e92cfd0be..19726aff2672cbf59a474ffefd34d9b836d92db9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/PolarBear.java +++ b/src/main/java/net/minecraft/world/entity/animal/PolarBear.java @@ -263,6 +263,7 @@ public class PolarBear extends Animal implements NeutralMob { @Override public void tick() { super.tick(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.clientSideStandAnimation != this.clientSideStandAnimationO) { this.refreshDimensions(); @@ -275,14 +276,15 @@ public class PolarBear extends Animal implements NeutralMob { this.clientSideStandAnimation = Mth.clamp(this.clientSideStandAnimation - 1.0F, 0.0F, 6.0F); } } + */ // Plazma - Remove persist 'isClientSide' flag if (this.warningSoundTicks > 0) { this.warningSoundTicks--; } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updatePersistentAnger((ServerLevel)this.level(), true); - } + //} // Plazma - Remove persist 'isClientSide' flag // Purpur start if (isStanding() && --standTimer <= 0) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java index c5a39ea2ad0e5e5ac434d79c1a57e0068b8bc809..992f1a4e870c245823baaf34a7bb5e177fa68633 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java +++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java @@ -127,7 +127,7 @@ public class Pufferfish extends AbstractFish { @Override public void tick() { - if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) { + if (/*!this.level().isClientSide &&*/ this.isAlive() /*&& this.isEffectiveAi()*/) { // Plazma - Remove persist 'isClientSide' flag if (this.inflateCounter > 0) { boolean increase = true; // Paper - Add PufferFishStateChangeEvent if (this.getPuffState() == 0) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java index b3a0146ccfcda9fa33b91d33458086b510bb4d7b..034dec437d6a6df5664185de77245bd17fcdd59b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Rabbit.java +++ b/src/main/java/net/minecraft/world/entity/animal/Rabbit.java @@ -226,9 +226,9 @@ public class Rabbit extends Animal implements VariantHolder { } } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 1); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java index 38f651ab5f8e25e6d653a86dcb9875990651542a..0503f936d0d7194f110069adabff984f51af0a3a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java +++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java @@ -157,6 +157,7 @@ public class Sheep extends Animal implements Shearable { super.customServerAiStep(world); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void aiStep() { if (this.level().isClientSide) { @@ -165,6 +166,7 @@ public class Sheep extends Animal implements Shearable { super.aiStep(); } + */ // Plazma - Remove persist 'isClientSide' flag public static AttributeSupplier.Builder createAttributes() { return Animal.createAnimalAttributes().add(Attributes.MAX_HEALTH, 8.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D); diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java index 36a56553702fa6e4a2ac92b3639c210c94faee73..012c2dafb5a4fc420a7fec58b472374b933c0ded 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java @@ -168,16 +168,18 @@ public class Squid extends AgeableWaterCreature { this.oldTentacleAngle = this.tentacleAngle; this.tentacleMovement = this.tentacleMovement + this.tentacleSpeed; if ((double)this.tentacleMovement > Math.PI * 2) { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.tentacleMovement = (float) (Math.PI * 2); } else { + */ // Plazma - Remove persist 'isClientSide' flag this.tentacleMovement -= (float) (Math.PI * 2); if (this.random.nextInt(10) == 0) { this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; } this.level().broadcastEntityEvent(this, (byte)19); - } + //} // Plazma - Remove persist 'isClientSide' flag } if (this.isInWaterOrBubble()) { @@ -186,9 +188,9 @@ public class Squid extends AgeableWaterCreature { float f = this.tentacleMovement / (float) Math.PI; this.tentacleAngle = Mth.sin(f * f * (float) Math.PI) * (float) Math.PI * 0.25F; if ((double)f > 0.75) { - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.setDeltaMovement(this.movementVector); - } + //} // Plazma - Remove persist 'isClientSide' flag this.rotateSpeed = 1.0F; } else { @@ -196,9 +198,9 @@ public class Squid extends AgeableWaterCreature { } } else { this.tentacleAngle = 0.0F; - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); - } + //} // Plazma - Remove persist 'isClientSide' flag this.rotateSpeed *= 0.99F; } @@ -211,7 +213,7 @@ public class Squid extends AgeableWaterCreature { this.xBodyRot = this.xBodyRot + (-((float)Mth.atan2(d, vec3.y)) * (180.0F / (float)Math.PI) - this.xBodyRot) * 0.1F; } else { this.tentacleAngle = Mth.abs(Mth.sin(this.tentacleMovement)) * (float) Math.PI * 0.25F; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double e = this.getDeltaMovement().y; if (this.hasEffect(MobEffects.LEVITATION)) { e = 0.05 * (double)(this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1); @@ -220,7 +222,7 @@ public class Squid extends AgeableWaterCreature { } this.setDeltaMovement(0.0, e * 0.98F, 0.0); - } + //} // Plazma - Remove persist 'isClientSide' flag this.xBodyRot = this.xBodyRot + (-90.0F - this.xBodyRot) * 0.02F; } @@ -259,9 +261,9 @@ public class Squid extends AgeableWaterCreature { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag this.move(MoverType.SELF, this.getDeltaMovement()); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java index c9e307452a097329c26893673055cfb72a43e4c7..388c0068905e2ad138d5125ba17734b1be3a58fb 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java @@ -360,7 +360,7 @@ public class Turtle extends Animal { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance() && this.isInWater()) { + if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag this.moveRelative(0.1F, movementInput); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java index 420345f130a40c4f59a021a4bdce3e218dc87cde..14d3e09e8eca665d186f5d356158052b118c6848 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java +++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java @@ -370,16 +370,16 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder getLikedPlayer(LivingEntity allay) { Level level = allay.level(); - if (!level.isClientSide() && level instanceof ServerLevel serverLevel) { + if (/*!level.isClientSide() &&*/ level instanceof ServerLevel serverLevel) { // Plazma - Remove persist 'isClientSide' flag Optional optional = allay.getBrain().getMemory(MemoryModuleType.LIKED_PLAYER); if (optional.isPresent()) { if (serverLevel.getEntity(optional.get()) instanceof ServerPlayer serverPlayer diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java index 8500ac473581b90036578d66243c5313e2ce3ddf..7ac1ecd192e65a87a30acba509947f93cccfd709 100644 --- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java @@ -194,9 +194,11 @@ public class Armadillo extends Animal { @Override public void tick() { super.tick(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.setupAnimationStates(); } + */ // Plazma - Remove persist 'isClientSide' flag if (this.isScared()) { this.clampHeadRotationToBody(); @@ -247,12 +249,14 @@ public class Armadillo extends Animal { @Override public void handleEntityEvent(byte status) { + /* // Plazma - Remove persist 'isClientSide' flag if (status == 64 && this.level().isClientSide) { this.peekReceivedClient = true; this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ARMADILLO_PEEK, this.getSoundSource(), 1.0F, 1.0F, false); } else { + */ // Plazma - Remove persist 'isClientSide' flag super.handleEntityEvent(status); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java index 155f03818d91dbd4ef9f5549784472f2bffca5d8..ee9be9de7d64c9354b579dc22954058873e7ab5e 100644 --- a/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/src/main/java/net/minecraft/world/entity/animal/axolotl/Axolotl.java @@ -207,9 +207,11 @@ public class Axolotl extends Animal implements VariantHolder, B this.handleAirSupply(i); } + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.tickAnimations(); } + */ // Plazma - Remove persist 'isClientSide' flag } @@ -522,7 +524,7 @@ public class Axolotl extends Animal implements VariantHolder, B @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance() && this.isInWater()) { + if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag this.moveRelative(this.getSpeed(), movementInput); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java index 459a45f82c42b346a66bb1954e155a0970dcc30f..c11f9111933ec2e033cffcdf930983d505c3acab 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java @@ -195,9 +195,11 @@ public class Camel extends AbstractHorse { } } + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { this.setupAnimationStates(); } + */ // Plazma - Remove persist 'isClientSide' flag if (this.refuseToMove()) { this.clampHeadRotationToBody(); @@ -444,9 +446,9 @@ public class Camel extends AbstractHorse { if (flag2) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.ageUp(10); - } + //} // Plazma - Remove persist 'isClientSide' flag } if (!flag && !flag1 && !flag2) { @@ -672,9 +674,9 @@ public class Camel extends AbstractHorse { @Override public void openCustomInventoryScreen(Player player) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.openHorseInventory(this, this.inventory); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java index bd04af6311ca64d81c8829e731ac39a6486ee789..17ba0c6060ab56ab97b133565ebf86320ab52e1b 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java @@ -269,6 +269,7 @@ public class Frog extends Animal implements VariantHolder> { super.customServerAiStep(world); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { if (this.level().isClientSide()) { @@ -277,6 +278,7 @@ public class Frog extends Animal implements VariantHolder> { super.tick(); } + */ // Plazma - Remove persist 'isClientSide' flag @Override public void onSyncedDataUpdated(EntityDataAccessor data) { @@ -418,7 +420,7 @@ public class Frog extends Animal implements VariantHolder> { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance() && this.isInWater()) { + if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag this.moveRelative(this.getSpeed(), movementInput); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java index 1b0e80ae62b5c5d4e1fcac71b90f83f12fe4878a..4b9e57c271b5b4bdaa92f8da7e0770e2c1adba96 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -159,7 +159,7 @@ public class Tadpole extends AbstractFish { @Override public void aiStep() { super.aiStep(); - if (!this.level().isClientSide && !this.ageLocked) { // Paper + if (/*!this.level().isClientSide &&*/ !this.ageLocked) { // Paper // Plazma - Remove persist 'isClientSide' flag this.setAge(this.age + 1); } diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java index b258be16f32ffd58ac8406deac9423cb01ca9a5c..71c3f9fdbf8f364e5112c505f53c4be6fdc1ad21 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java @@ -491,9 +491,9 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } protected void syncSaddleToClients() { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setFlag(4, !this.inventory.getItem(0).isEmpty()); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -591,7 +591,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, @Override public void openCustomInventoryScreen(Player player) { - if (!this.level().isClientSide && (!this.isVehicle() || this.hasPassenger((Entity) player)) && this.isTamed()) { + if (/*!this.level().isClientSide &&*/ (!this.isVehicle() || this.hasPassenger((Entity) player)) && this.isTamed()) { // Plazma - Remove persist 'isClientSide' flag player.openHorseInventory(this, this.inventory); } @@ -604,7 +604,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, stack.consume(1, player); } - return (InteractionResult) (!flag && !this.level().isClientSide ? InteractionResult.PASS : InteractionResult.SUCCESS_SERVER); + return !flag /*&& !this.level().isClientSide*/ ? InteractionResult.PASS : InteractionResult.SUCCESS_SERVER; // Plazma - Remove persist 'isClientSide' flag } protected boolean handleEating(Player player, ItemStack item) { @@ -632,7 +632,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, f = 4.0F; short0 = 60; b0 = 5; - if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { + if (/*!this.level().isClientSide &&*/ this.isTamed() && this.getAge() == 0 && !this.isInLove()) { // Plazma - Remove persist 'isClientSide' flag flag = true; this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying } @@ -640,7 +640,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, f = 10.0F; short0 = 240; b0 = 10; - if (!this.level().isClientSide && this.isTamed() && this.getAge() == 0 && !this.isInLove()) { + if (/*!this.level().isClientSide &&*/ this.isTamed() && this.getAge() == 0 && !this.isInLove()) { // Plazma - Remove persist 'isClientSide' flag flag = true; this.setInLove(player, item.copy()); // Paper - Fix EntityBreedEvent copying } @@ -653,13 +653,13 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, if (this.isBaby() && short0 > 0) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.ageUp(short0); flag = true; - } + //} // Plazma - Remove persist 'isClientSide' flag } - if (b0 > 0 && (flag || !this.isTamed()) && this.getTemper() < this.getMaxTemper() && !this.level().isClientSide) { + if (b0 > 0 && (flag || !this.isTamed()) && this.getTemper() < this.getMaxTemper() /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.modifyTemper(b0); flag = true; } @@ -675,11 +675,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, protected void doPlayerRide(Player player) { this.setEating(false); this.setStanding(false); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.setYRot(this.getYRot()); player.setXRot(this.getXRot()); player.startRiding(this); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -768,7 +768,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, this.setFlag(64, false); } - if (this.isEffectiveAi() && this.standCounter > 0 && ++this.standCounter > 20) { + if (/*this.isEffectiveAi() &&*/ this.standCounter > 0 && ++this.standCounter > 20) { // Plazma - Remove persist 'isClientSide' flag this.standCounter = 0; this.setStanding(false); } @@ -868,10 +868,10 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } private void openMouth() { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.mouthCounter = 1; this.setFlag(64, true); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -898,10 +898,12 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, } public void standIfPossible() { - if (this.canPerformRearing() && this.isEffectiveAi()) { - this.standCounter = 1; - this.setStanding(true); - } + // Plazma start - Remove persist 'isClientSide' flag + if (!this.canPerformRearing()) return; + + this.standCounter = 1; + this.setStanding(true); + // Plazma end - Remove persist 'isClientSide' flag } @@ -931,7 +933,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, this.setRot(vec2f.y, vec2f.x); this.yRotO = this.yBodyRot = this.yHeadRot = this.getYRot(); - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag if (movementInput.z <= 0.0D) { this.gallopSoundCounter = 0; } @@ -944,7 +946,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener, this.playerJumpPendingScale = 0.0F; } - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java index 8401c7ae749f6300281cbd6b2bfc77f03d5eb9ea..818aa1e29392321533c0eb83b953a1231d430c84 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java @@ -267,18 +267,18 @@ public class Llama extends AbstractChestedHorse implements VariantHolder 0) { this.level().addParticle(ParticleTypes.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.ageUp(b0); - } + //} // Plazma - Remove persist 'isClientSide' flag flag = true; } if (b1 > 0 && (flag || !this.isTamed()) && this.getTemper() < this.getMaxTemper()) { flag = true; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.modifyTemper(b1); - } + //} // Plazma - Remove persist 'isClientSide' flag } if (flag && !this.isSilent()) { diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java b/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java index 1d765ad53a9d8dd388106bc0cb02f4919a1f8173..40437c169a06c7dbf4950afcb575dec8adef33fa 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/TraderLlama.java @@ -138,9 +138,9 @@ public class TraderLlama extends Llama { @Override public void aiStep() { super.aiStep(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.maybeDespawn(); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java index 0bc7856065fdc599890f18f5a4e2f6c2b3d94ba7..a108cba43a7272f53cd53b885dc03874fbf27ba4 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -404,9 +404,11 @@ public class Sniffer extends Animal { @Override public void tick() { switch (this.getState().ordinal()) { + /* // Plazma - Remove persist 'isClientSide' flag case 4: this.playSearchingSound(); break; + */ // Plazma - Remove persist 'isClientSide' flag case 5: this.emitDiggingParticles(this.diggingAnimationState).dropSeed(); } @@ -432,12 +434,14 @@ public class Sniffer extends Animal { this.level().playSound((Player) null, (Entity) this, SoundEvents.SNIFFER_EAT, SoundSource.NEUTRAL, 1.0F, Mth.randomBetween(this.level().random, 0.8F, 1.2F)); } + /* // Plazma - Remove persist 'isClientSide' flag private void playSearchingSound() { if (this.level().isClientSide() && this.tickCount % 20 == 0) { this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.SNIFFER_SEARCHING, this.getSoundSource(), 1.0F, 1.0F, false); } } + */ // Plazma - Remove persist 'isClientSide' flag @Override protected void playStepSound(BlockPos pos, BlockState state) { diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java index c9e3bb91ff506a35551a58f469ad2849e6058668..d779f62ef6cd4f396225317b24c601e0536a9a94 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java @@ -221,6 +221,7 @@ public class EnderDragon extends Mob implements Enemy { return f1 <= -0.3F && f >= -0.3F; } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void onFlap() { if (this.level().isClientSide && !this.isSilent()) { @@ -228,6 +229,7 @@ public class EnderDragon extends Mob implements Enemy { } } + */ // Plazma - Remove persist 'isClientSide' flag @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { @@ -269,6 +271,7 @@ public class EnderDragon extends Mob implements Enemy { // Purpur end this.processFlappingMovement(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.setHealth(this.getHealth()); if (!this.isSilent() && !this.phaseManager.getCurrentPhase().isSitting() && --this.growlTime < 0) { @@ -276,6 +279,7 @@ public class EnderDragon extends Mob implements Enemy { this.growlTime = 200 + this.random.nextInt(200); } } + */ // Plazma - Remove persist 'isClientSide' flag if (this.dragonFight == null) { Level world = this.level(); @@ -386,9 +390,9 @@ public class EnderDragon extends Mob implements Enemy { this.phaseManager.getCurrentPhase().doClientTick(); } - if (!this.level().isClientSide()) { + //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag this.applyEffectsFromBlocks(); - } + //} // Plazma - Remove persist 'isClientSide' flag this.yBodyRot = this.getYRot(); Vec3[] avec3d = new Vec3[this.subEntities.length]; @@ -1132,9 +1136,11 @@ public class EnderDragon extends Mob implements Enemy { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { + /* // Plazma - Remove persist 'isClientSide' flag if (EnderDragon.DATA_PHASE.equals(data) && this.level().isClientSide) { this.phaseManager.setPhase(EnderDragonPhase.getById((Integer) this.getEntityData().get(EnderDragon.DATA_PHASE))); } + */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java index 5ed84f4199698dfe41abd7b9fc804bc3419078ef..e17304fd16632d2f478cf89f90ca2da3537fefd8 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager.java @@ -43,11 +43,11 @@ public class EnderDragonPhaseManager { // CraftBukkit end this.currentPhase = this.getPhase(type); - if (!this.dragon.level().isClientSide) { + //if (!this.dragon.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.dragon.getEntityData().set(EnderDragon.DATA_PHASE, type.getId()); - } + //} // Plazma - Remove persist 'isClientSide' flag - EnderDragonPhaseManager.LOGGER.debug("Dragon is now in phase {} on the {}", type, this.dragon.level().isClientSide ? "client" : "server"); + EnderDragonPhaseManager.LOGGER.debug("Dragon is now in phase {} on the {}", type, /*this.dragon.level().isClientSide ? "client" :*/ "server"); // Plazma - Remove persist 'isClientSide' flag this.currentPhase.begin(); } } diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java index 5e134b3cf939fe396c060797883613812ad73c31..05fb8b26369f7703c6a97f1764a71bd4c3fe1058 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java @@ -321,7 +321,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { public void aiStep() { Vec3 vec3d = this.getDeltaMovement().multiply(1.0D, 0.6D, 1.0D); - if (!this.level().isClientSide && this.getAlternativeTarget(0) > 0) { + if (/*!this.level().isClientSide &&*/ this.getAlternativeTarget(0) > 0) { // Plazma - Remove persist 'isClientSide' flag Entity entity = this.level().getEntity(this.getAlternativeTarget(0)); if (entity != null) { diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java index 037586c0fdb42a02660aba89dd741a647c67e52b..6230b5acc495b998e508a937d1e4c3889a3746c2 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -161,10 +161,12 @@ public class ArmorStand extends LivingEntity { return !this.isMarker() && !this.isNoGravity(); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isEffectiveAi() { return super.isEffectiveAi() && this.hasPhysics(); } + */ // Plazma - Remove persist 'isClientSide' flag @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { @@ -387,8 +389,10 @@ public class ArmorStand extends LivingEntity { if (!this.isMarker() && !itemstack.is(Items.NAME_TAG)) { if (player.isSpectator()) { return InteractionResult.SUCCESS; + /* // Plazma - Remove persist 'isClientSide' flag } else if (player.level().isClientSide) { return InteractionResult.SUCCESS_SERVER; + */ // Plazma - Remove persist 'isClientSide' flag } else { net.minecraft.world.entity.EquipmentSlot enumitemslot = this.getEquipmentSlotForItem(itemstack); @@ -571,15 +575,8 @@ public class ArmorStand extends LivingEntity { @Override public void handleEntityEvent(byte status) { - if (status == 32) { - if (this.level().isClientSide) { - this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ARMOR_STAND_HIT, this.getSoundSource(), 0.3F, 1.0F, false); - this.lastHit = this.level().getGameTime(); - } - } else { - super.handleEntityEvent(status); - } - + if (status == 32) return; // Plazma - Remove persist 'isClientSide' flag + super.handleEntityEvent(status); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java index bd5e034ce58ebe53d2121209d76ae60134ce72fe..27f7a0abf77e94f15ff5f42e54e979377c94e63c 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java @@ -419,7 +419,7 @@ public class ItemFrame extends HangingEntity { if (this.fixed) { return InteractionResult.PASS; - } else if (!player.level().isClientSide) { + } else /*if (!player.level().isClientSide)*/ { // Plazma - Remove persist 'isClientSide' flag if (!flag) { if (flag1 && !this.isRemoved()) { MapItemSavedData worldmap = MapItem.getSavedData(itemstack, this.level()); @@ -454,9 +454,9 @@ public class ItemFrame extends HangingEntity { this.gameEvent(GameEvent.BLOCK_CHANGE, player); return InteractionResult.SUCCESS; } - } else { + } /*else { // Plazma - Remove persist 'isClientSide' flag return (InteractionResult) (!flag && !flag1 ? InteractionResult.PASS : InteractionResult.SUCCESS); - } + }*/ // Plazma - Remove persist 'isClientSide' flag } public SoundEvent getRotateItemSound() { diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java index d3a7953a3f42a0020342845e9107c6991637b050..650af7be38e9ba8e81ac991689ffa0a444e7f94b 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java @@ -75,80 +75,72 @@ public class LeashFenceKnotEntity extends BlockAttachedEntity { @Override public InteractionResult interact(Player player, InteractionHand hand) { - if (this.level().isClientSide) { - return InteractionResult.SUCCESS; - } else { - boolean flag = false; - List list = LeadItem.leashableInArea(this.level(), this.getPos(), (leashable) -> { - Entity entity = leashable.getLeashHolder(); - - return entity == player || entity == this; - }); - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { - Leashable leashable = (Leashable) iterator.next(); - - if (leashable.getLeashHolder() == player) { - // CraftBukkit start - if (leashable instanceof Entity leashed) { - if (CraftEventFactory.callPlayerLeashEntityEvent(leashed, this, player, hand).isCancelled()) { - ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(leashed, leashable.getLeashHolder())); - flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities - continue; - } - } - // CraftBukkit end - leashable.setLeashedTo(this, true); - flag = true; - } + // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations + boolean flag = false; + List list = LeadItem.leashableInArea(this.level(), this.getPos(), (leashable) -> { + Entity entity = leashable.getLeashHolder(); + + return entity == player || entity == this; + }); + + Iterator iterator = list.iterator(); + while (iterator.hasNext()) { + Leashable leashable = (Leashable) iterator.next(); + + if (leashable.getLeashHolder() != player) continue; + + // CraftBukkit start + if (leashable instanceof Entity entity && CraftEventFactory.callPlayerLeashEntityEvent(entity, this, player, hand).isCancelled()) { + ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(leashed, leashable.getLeashHolder())); + flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities + continue; } + // CraftBukkit end - boolean flag1 = false; + leashable.setLeashedTo(this, true); + flag = true; + } - if (!flag) { - // CraftBukkit start - Move below - // this.discard(); - boolean die = true; - // CraftBukkit end - if (true || player.getAbilities().instabuild) { // CraftBukkit - Process for non-creative as well - Iterator iterator1 = list.iterator(); - - while (iterator1.hasNext()) { - Leashable leashable1 = (Leashable) iterator1.next(); - - if (leashable1.isLeashed() && leashable1.getLeashHolder() == this) { - // CraftBukkit start - boolean dropLeash = !player.hasInfiniteMaterials(); - if (leashable1 instanceof Entity leashed) { - // Paper start - Expand EntityUnleashEvent - org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(leashed, player, hand, dropLeash); - dropLeash = event.isDropLeash(); - if (event.isCancelled()) { - // Paper end - Expand EntityUnleashEvent - die = false; - continue; - } - } - leashable1.dropLeash(true, dropLeash); // false -> survival mode boolean // Paper - Expand EntityUnleashEvent - // CraftBukkit end - flag1 = true; - } - } - // CraftBukkit start - if (die) { - this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause + boolean flag1 = false; + if (!flag) { + // CraftBukkit start - Move below + // this.discard(); + boolean die = true; + // CraftBukkit end + + Iterator iterator1 = list.iterator(); + while (iterator1.hasNext()) { + Leashable leashable = (Leashable) iterator1.next(); + + if (!leashable.isLeashed() || leashable.getLeashHolder() != this) continue; + + // CraftBukkit start + boolean dropLeash = !player.hasInfiniteMaterials(); + if (leashable instanceof Entity entity) { + // Paper start - Expand EntityUnleashEvent + org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entity, player, hand, dropLeash); + if (event.isCancelled()) { + die = false; + continue; } - // CraftBukkit end + + dropLeash = event.isDropLeash(); + // Paper end - Expand EntityUnleashEvent } - } - if (flag || flag1) { - this.gameEvent(GameEvent.BLOCK_ATTACH, player); + leashable.dropLeash(true, dropLeash); // false -> survival mode boolean // Paper - Expand EntityUnleashEvent + // CraftBukkit end + + flag1 = true; } - return InteractionResult.SUCCESS; + if (die) this.discard(EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause } + + if (flag || flag1) this.gameEvent(GameEvent.BLOCK_ATTACH, player); + + return InteractionResult.SUCCESS; + // Plazma end - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java index c63cf322e0d00b5ec9929db8c22d4a392049160f..8c5dff4e24c1366d583ba9c7c2c15ea166a24933 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -178,14 +178,16 @@ public class ItemEntity extends Entity implements TraceableEntity { this.applyGravity(); } + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.noPhysics = false; } else { + */ // Plazma - Remove persist 'isClientSide' flag this.noPhysics = !this.level().noCollision(this, this.getBoundingBox().deflate(1.0E-7D)); if (this.noPhysics) { this.moveTowardsClosestSpace(this.getX(), (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0D, this.getZ()); } - } + //} // Plazma - Remove persist 'isClientSide' flag if (!this.onGround() || this.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D || (this.tickCount + this.getId()) % 4 == 0) { // Paper - Diff on change; ActivationRange immunity this.move(MoverType.SELF, this.getDeltaMovement()); @@ -213,7 +215,7 @@ public class ItemEntity extends Entity implements TraceableEntity { boolean flag = Mth.floor(this.xo) != Mth.floor(this.getX()) || Mth.floor(this.yo) != Mth.floor(this.getY()) || Mth.floor(this.zo) != Mth.floor(this.getZ()); int i = flag ? 2 : 40; - if (this.tickCount % i == 0 && !this.level().isClientSide && this.isMergable()) { + if (this.tickCount % i == 0 && /*!this.level().isClientSide &&*/ this.isMergable()) { // Plazma - Remove persist 'isClientSide' flag this.mergeWithNeighbours(); } @@ -224,15 +226,15 @@ public class ItemEntity extends Entity implements TraceableEntity { // CraftBukkit end */ this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double d0 = this.getDeltaMovement().subtract(vec3d).lengthSqr(); if (d0 > 0.01D) { this.hasImpulse = true; } - } + //} // Plazma - Remove persist 'isClientSide' flag - if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate + if (/*!this.level().isClientSide &&*/ this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - fire ItemDespawnEvent if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; @@ -257,7 +259,7 @@ public class ItemEntity extends Entity implements TraceableEntity { } // Paper end - remove anti tick skipping measures / wall time - copied from above - if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate + if (/*!this.level().isClientSide &&*/ this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; @@ -496,87 +498,78 @@ public class ItemEntity extends Entity implements TraceableEntity { @Override public void playerTouch(net.minecraft.world.entity.player.Player player) { - if (!this.level().isClientSide) { - ItemStack itemstack = this.getItem(); - Item item = itemstack.getItem(); - int i = itemstack.getCount(); - - // CraftBukkit start - fire PlayerPickupItemEvent - int canHold = player.getInventory().canHold(itemstack); - int remaining = i - canHold; - boolean flyAtPlayer = false; // Paper - - // Paper start - PlayerAttemptPickupItemEvent - if (this.pickupDelay <= 0) { - PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); - this.level().getCraftServer().getPluginManager().callEvent(attemptEvent); - - flyAtPlayer = attemptEvent.getFlyAtPlayer(); - if (attemptEvent.isCancelled()) { - if (flyAtPlayer) { - player.take(this, i); - } + // Plazma start - Remove persist 'isClientSide' flag & Apply some optimizations + ItemStack itemstack = this.getItem(); + Item item = itemstack.getItem(); + int i = itemstack.getCount(); - return; - } - } - // Paper end - PlayerAttemptPickupItemEvent - - if (this.pickupDelay <= 0 && canHold > 0) { - itemstack.setCount(canHold); - // Call legacy event - PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); - playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); - this.level().getCraftServer().getPluginManager().callEvent(playerEvent); - flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper - if (playerEvent.isCancelled()) { - itemstack.setCount(i); // SPIGOT-5294 - restore count - // Paper start - if (flyAtPlayer) { - player.take(this, i); - } - // Paper end - return; - } + // CraftBukkit start - fire PlayerPickupItemEvent + int canHold = player.getInventory().canHold(itemstack); + int remaining = i - canHold; + boolean flyAtPlayer = false; // Paper - // Call newer event afterwards - EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); - entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems()); - this.level().getCraftServer().getPluginManager().callEvent(entityEvent); - if (entityEvent.isCancelled()) { - itemstack.setCount(i); // SPIGOT-5294 - restore count - return; - } + // Paper start - PlayerAttemptPickupItemEvent + if (this.pickupDelay <= 0) { + PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + this.level().getCraftServer().getPluginManager().callEvent(attemptEvent); - // Update the ItemStack if it was changed in the event - ItemStack current = this.getItem(); - if (!itemstack.equals(current)) { - itemstack = current; - } else { - itemstack.setCount(canHold + remaining); // = i - } + flyAtPlayer = attemptEvent.getFlyAtPlayer(); + if (attemptEvent.isCancelled()) { + if (flyAtPlayer) player.take(this, i); - // Possibly < 0; fix here so we do not have to modify code below - this.pickupDelay = 0; - } else if (this.pickupDelay == 0) { - // ensure that the code below isn't triggered if canHold says we can't pick the items up - this.pickupDelay = -1; + return; } - // CraftBukkit end + } + // Paper end - PlayerAttemptPickupItemEvent + + if (this.pickupDelay <= 0 && canHold > 0) { + itemstack.setCount(canHold); + // Call legacy event + PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); + this.level().getCraftServer().getPluginManager().callEvent(playerEvent); + flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper + if (playerEvent.isCancelled()) { + itemstack.setCount(i); // SPIGOT-5294 - restore count + if (flyAtPlayer) player.take(this, i); // Paper - if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { - if (flyAtPlayer) // Paper - PlayerPickupItemEvent - player.take(this, i); - if (itemstack.isEmpty()) { - this.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause - itemstack.setCount(i); - } + return; + } + + // Call newer event afterwards + EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems()); + this.level().getCraftServer().getPluginManager().callEvent(entityEvent); + if (entityEvent.isCancelled()) { + itemstack.setCount(i); // SPIGOT-5294 - restore count + return; + } + + // Update the ItemStack if it was changed in the event + ItemStack current = this.getItem(); + if (!itemstack.equals(current)) itemstack = current; + else itemstack.setCount(canHold + remaining); // = i + + // Possibly < 0; fix here so we do not have to modify code below + this.pickupDelay = 0; + } else if (this.pickupDelay == 0) { + // ensure that the code below isn't triggered if canHold says we can't pick the items up + this.pickupDelay = -1; + } + // CraftBukkit end + + if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { + if (flyAtPlayer) player.take(this, i); // Paper - PlayerPickupItemEvent - player.awardStat(Stats.ITEM_PICKED_UP.get(item), i); - player.onItemPickup(this); + if (itemstack.isEmpty()) { + this.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause + itemstack.setCount(i); } + player.awardStat(Stats.ITEM_PICKED_UP.get(item), i); + player.onItemPickup(this); } + // Plazma end - Remove persist 'isClientSide' flag & Apply some optimizations } @Override @@ -596,7 +589,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public Entity teleport(TeleportTransition teleportTarget) { Entity entity = super.teleport(teleportTarget); - if (!this.level().isClientSide && entity instanceof ItemEntity entityitem) { + if (/*!this.level().isClientSide &&*/ entity instanceof ItemEntity entityitem) { // Plazma - Remove persist 'isClientSide' flag entityitem.mergeWithNeighbours(); } diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java index 287ba483614e79e78022e703ef891f59f41ac455..1273d5027d806f655e7c5e2d65b7a8e0182de185 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java @@ -123,16 +123,18 @@ public class PrimedTnt extends Entity implements TraceableEntity { if (i <= 0) { // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event // this.discard(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.explode(); - } + //} // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause // CraftBukkit end } else { this.updateInWaterStateAndDoFluidPushing(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5D, this.getZ(), 0.0D, 0.0D, 0.0D); } + */ // Plazma - Remove persist 'isClientSide' flag } // Paper start - Option to prevent TNT from moving in water diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java index 39d02cf0e31832e30c4f034b0b5385e3e0057e60..41c6b60a9d0210b7f2c660cc03999be9c9bc344e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -148,7 +148,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo } public void reassessWeaponGoal() { - if (this.level() != null && !this.level().isClientSide) { + if (this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.goalSelector.removeGoal(this.meleeGoal); this.goalSelector.removeGoal(this.bowGoal); ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); @@ -236,9 +236,9 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack, boolean silent) { // Paper - Fix silent equipment change super.setItemSlot(slot, stack, silent); // Paper - Fix silent equipment change - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.reassessWeaponGoal(); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/Blaze.java b/src/main/java/net/minecraft/world/entity/monster/Blaze.java index 07db4557ab0d7a4a0f5432257bd18195d2de7255..b6278a2914a96ef4db03d3f6d0620d376268af82 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Blaze.java +++ b/src/main/java/net/minecraft/world/entity/monster/Blaze.java @@ -135,6 +135,7 @@ public class Blaze extends Monster { this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, 0.6, 1.0)); } + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.random.nextInt(24) == 0 && !this.isSilent()) { this.level() @@ -154,6 +155,7 @@ public class Blaze extends Monster { this.level().addParticle(ParticleTypes.LARGE_SMOKE, this.getRandomX(0.5), this.getRandomY(), this.getRandomZ(0.5), 0.0, 0.0, 0.0); } } + */ // Plazma - Remove persist 'isClientSide' flag super.aiStep(); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java index 38cbe2fce9c36195aa9bea2af26d14364b216825..3b2560ee1bb8c415eada619fc057d35ccb0e2ab0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java @@ -356,7 +356,7 @@ public class Creeper extends Monster { SoundEvent soundeffect = itemstack.is(Items.FIRE_CHARGE) ? SoundEvents.FIRECHARGE_USE : SoundEvents.FLINTANDSTEEL_USE; this.level().playSound(player, this.getX(), this.getY(), this.getZ(), soundeffect, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.entityIgniter = player; // CraftBukkit this.ignite(); if (itemstack.getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper @@ -364,7 +364,7 @@ public class Creeper extends Monster { } else { itemstack.hurtAndBreak(1, player, getSlotForHand(hand)); } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java index 949207eda199c874f2f14074b5a4fff5462b86b9..19bc362ff8e28cd0e26ba357dda425bac24c5a56 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java @@ -279,7 +279,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance() && this.isUnderWater() && this.wantsToSwim()) { + if (/*this.isControlledByLocalInstance() &&*/ this.isUnderWater() && this.wantsToSwim()) { // Plazma - Remove persist 'isClientSide' flag this.moveRelative(0.01F, movementInput); this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9)); @@ -290,15 +290,15 @@ public class Drowned extends Zombie implements RangedAttackMob { @Override public void updateSwimming() { - if (!this.level().isClientSide) { - if (this.isEffectiveAi() && this.isUnderWater() && this.wantsToSwim()) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag + if (/*this.isEffectiveAi() &&*/ this.isUnderWater() && this.wantsToSwim()) { // Plazma - Remove persist 'isClientSide' flag this.navigation = this.waterNavigation; this.setSwimming(true); } else { this.navigation = this.groundNavigation; this.setSwimming(false); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java index 476aaa0d9899eb56ea29b1fcf15565b58f78479d..d57f6b312341f6d83788bbb294cc65ee47361373 100644 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -228,9 +228,11 @@ public class EnderMan extends Monster implements NeutralMob { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { + /* // Plazma - Remove persist 'isClientSide' flag if (EnderMan.DATA_CREEPY.equals(data) && this.hasBeenStaredAt() && this.level().isClientSide) { this.playStareSound(); } + */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } @@ -277,16 +279,18 @@ public class EnderMan extends Monster implements NeutralMob { @Override public void aiStep() { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { for (int i = 0; i < 2; ++i) { this.level().addParticle(ParticleTypes.PORTAL, this.getRandomX(0.5D), this.getRandomY() - 0.25D, this.getRandomZ(0.5D), (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } } + */ // Plazma - Remove persist 'isClientSide' flag this.jumping = false; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.updatePersistentAnger((ServerLevel) this.level(), true); - } + //} // Plazma - Remove persist 'isClientSide' flag super.aiStep(); } @@ -311,7 +315,7 @@ public class EnderMan extends Monster implements NeutralMob { } public boolean teleport() { - if (!this.level().isClientSide() && this.isAlive()) { + if (/*!this.level().isClientSide() &&*/ this.isAlive()) { // Plazma - Remove persist 'isClientSide' flag double d0 = this.getX() + (this.random.nextDouble() - 0.5D) * 64.0D; double d1 = this.getY() + (double) (this.random.nextInt(64) - 32); double d2 = this.getZ() + (this.random.nextDouble() - 0.5D) * 64.0D; diff --git a/src/main/java/net/minecraft/world/entity/monster/Endermite.java b/src/main/java/net/minecraft/world/entity/monster/Endermite.java index f8373fc9839fccb31e3dd090de70e2cd7c9e6cfc..063954513b5c69047298a98224d7e099e18588bf 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Endermite.java +++ b/src/main/java/net/minecraft/world/entity/monster/Endermite.java @@ -152,11 +152,13 @@ public class Endermite extends Monster { @Override public void aiStep() { super.aiStep(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { for (int i = 0; i < 2; ++i) { this.level().addParticle(ParticleTypes.PORTAL, this.getRandomX(0.5D), this.getRandomY(), this.getRandomZ(0.5D), (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } } else { + */ // Plazma - Remove persist 'isClientSide' flag if (!this.isPersistenceRequired()) { ++this.life; } @@ -164,7 +166,7 @@ public class Endermite extends Monster { if (this.life >= 2400) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java index da833bf35342f771ecccd5dcac4fe87f72d047b0..dee45687c0630cdd98e3083eeff9670a364aa50b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java +++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java @@ -165,6 +165,7 @@ public class Guardian extends Monster { public LivingEntity getActiveAttackTarget() { if (!this.hasActiveAttackTarget()) { return null; + /* // Plazma - Remove persist 'isClientSide' flag } else if (this.level().isClientSide) { if (this.clientSideCachedAttackTarget != null) { return this.clientSideCachedAttackTarget; @@ -178,6 +179,7 @@ public class Guardian extends Monster { return null; } } + */ // Plazma - Remove persist 'isClientSide' flag } else { return this.getTarget(); } @@ -226,6 +228,7 @@ public class Guardian extends Monster { @Override public void aiStep() { if (this.isAlive()) { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.clientSideTailAnimationO = this.clientSideTailAnimation; Vec3 vec3d; @@ -294,6 +297,7 @@ public class Guardian extends Monster { } } } + */ // Plazma - Remove persist 'isClientSide' flag if (this.isInWaterOrBubble()) { this.setAirSupply(300); @@ -367,7 +371,7 @@ public class Guardian extends Monster { @Override public void travel(Vec3 movementInput) { - if (this.isControlledByLocalInstance() && this.isInWater()) { + if (/*this.isControlledByLocalInstance() &&*/ this.isInWater()) { // Plazma - Remove persist 'isClientSide' flag this.moveRelative(getRider() != null && this.isControllable() ? getSpeed() : 0.1F, movementInput); // Purpur this.move(MoverType.SELF, this.getDeltaMovement()); this.setDeltaMovement(this.getDeltaMovement().scale(0.9D)); diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java index 2ca241344efc6320d2018bdc772f74470080eeed..0397a6e7d5031aba20dd2e243f8f143078c68fed 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java +++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java @@ -124,6 +124,7 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void aiStep() { super.aiStep(); @@ -163,6 +164,7 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { } } + */ // Plazma - Remove persist 'isClientSide' flag @Override public SoundEvent getCelebrateSound() { diff --git a/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java b/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java index 63caf20256a3deae98b9cd9f54650def172f0e57..ccb32a521160ffaf45b947422819629da7f82ddb 100644 --- a/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java +++ b/src/main/java/net/minecraft/world/entity/monster/MagmaCube.java @@ -139,7 +139,7 @@ public class MagmaCube extends Slime { @Override protected boolean isDealsDamage() { - return this.isEffectiveAi(); + return true; //this.isEffectiveAi(); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java index cda6cb5b10b895bab48d2212f259ba4ca40e1ed6..80647c433bd94450db2b6d48d6d5b952a8dd9a6c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java @@ -232,6 +232,7 @@ public class Phantom extends FlyingMob implements Enemy { @Override public void tick() { super.tick(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { float f = Mth.cos((float) (this.getUniqueFlapTickOffset() + this.tickCount) * 7.448451F * 0.017453292F + 3.1415927F); float f1 = Mth.cos((float) (this.getUniqueFlapTickOffset() + this.tickCount + 1) * 7.448451F * 0.017453292F + 3.1415927F); @@ -248,6 +249,7 @@ public class Phantom extends FlyingMob implements Enemy { this.level().addParticle(ParticleTypes.MYCELIUM, this.getX() + (double) f3, this.getY() + (double) f5, this.getZ() + (double) f4, 0.0D, 0.0D, 0.0D); this.level().addParticle(ParticleTypes.MYCELIUM, this.getX() - (double) f3, this.getY() + (double) f5, this.getZ() - (double) f4, 0.0D, 0.0D, 0.0D); } + */ // Plazma - Remove persist 'isClientSide' flag if (level().purpurConfig.phantomFlamesOnSwoop && attackPhase == AttackPhase.SWOOP) shoot(); // Purpur } diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java index 98c1934b4895a86cd8748edf906aaa721a87a123..991d3eb79770c5809e92768bc8e51d42aab69e2e 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Ravager.java +++ b/src/main/java/net/minecraft/world/entity/monster/Ravager.java @@ -57,7 +57,7 @@ public class Ravager extends Raider { return Ravager.ROAR_TARGET_WITH_GRIEFING.test(entity) && !entity.getType().equals(EntityType.ARMOR_STAND); }; private static final Predicate ROAR_TARGET_ON_CLIENT = (entityliving) -> { - return !(entityliving instanceof Ravager) && entityliving.isAlive() && entityliving.isControlledByLocalInstance(); + return !(entityliving instanceof Ravager) && entityliving.isAlive(); //&& entityliving.isControlledByLocalInstance(); // Plazma - Remove persist 'isClientSide' flag }; private static final double BASE_MOVEMENT_SPEED = 0.3D; private static final double ATTACK_MOVEMENT_SPEED = 0.35D; diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java index e3fefd52c83079fe3eab1a96dd81a183f718192b..2282b7d57a14c16f65afae7d084f0d42a6078165 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java +++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java @@ -229,7 +229,7 @@ public class Shulker extends AbstractGolem implements VariantHolder 0) { --this.clientSideTeleportInterpolation; @@ -244,6 +245,7 @@ public class Shulker extends AbstractGolem implements VariantHolder 1 && this.isDeadOrDying()) { + if (/*!this.level().isClientSide &&*/ i > 1 && this.isDeadOrDying()) { // Plazma - Remove persist 'isClientSide' flag float f = this.getDimensions(this.getPose()).width(); float f1 = f / 2.0F; int j = i / 2; @@ -391,7 +391,7 @@ public class Slime extends Mob implements Enemy { } protected boolean isDealsDamage() { - return !this.isTiny() && this.isEffectiveAi(); + return !this.isTiny(); //&& this.isEffectiveAi(); // Plazma - Remove persist 'isClientSide' flag } protected float getAttackDamage() { diff --git a/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java b/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java index 4b6b842d411e433237b376df378da96afe7e484c..985a770042c7b790413ee2e7b49c9888b9f78863 100644 --- a/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java +++ b/src/main/java/net/minecraft/world/entity/monster/SpellcasterIllager.java @@ -56,7 +56,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { } public boolean isCastingSpell() { - return this.level().isClientSide ? (Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID) > 0 : this.spellCastingTickCount > 0; + return /*this.level().isClientSide ? (Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID) > 0 :*/ this.spellCastingTickCount > 0; // Plazma - Remove persist 'isClientSide' flag } public void setIsCastingSpell(SpellcasterIllager.IllagerSpell spell) { @@ -65,7 +65,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { } public SpellcasterIllager.IllagerSpell getCurrentSpell() { - return !this.level().isClientSide ? this.currentSpell : SpellcasterIllager.IllagerSpell.byId((Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID)); + return /*!this.level().isClientSide ?*/ this.currentSpell /*: SpellcasterIllager.IllagerSpell.byId((Byte) this.entityData.get(SpellcasterIllager.DATA_SPELL_CASTING_ID))*/; // Plazma - Remove persist 'isClientSide' flag } @Override @@ -77,6 +77,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { super.tick(); @@ -96,6 +97,7 @@ public abstract class SpellcasterIllager extends AbstractIllager { } } + */ // Plazma - Remove persist 'isClientSide' flag protected int getSpellCastingTime() { return this.spellCastingTickCount; diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java index 1669acbcf97bee0fa6b0ee91cf53217c53cf55d8..74f8903541d5288f2a50769ffc5ef88e0c9aad1b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Spider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java @@ -116,9 +116,9 @@ public class Spider extends Monster { @Override public void tick() { super.tick(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setClimbing(this.horizontalCollision && (this.level().paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isCollidingWithBorder(this.level().getWorldBorder(), this.getBoundingBox().inflate(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_EPSILON)) && this.level().getWorldBorder().isInsideCloseToBorder(this, this.getBoundingBox())))); // Paper - Add config option for spider worldborder climbing (Inflate by +EPSILON as collision will just barely place us outside border) - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java index c3b5b34a54de945071692293645b8a8865aed961..c09e49f928e32a3dc6c557f01d92c455d9bfc8c6 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Strider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java @@ -142,9 +142,11 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { + /* // Plazma - Remove persist 'isClientSide' flag if (Strider.DATA_BOOST_TIME.equals(data) && this.level().isClientSide) { this.steering.onSynced(); } + */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } @@ -502,9 +504,9 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { // Purpur end if (!flag && this.isSaddled() && !this.isVehicle() && !player.isSecondaryUseActive()) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.startRiding(this); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java index 313228811d1eff478887511f99b49706efc49774..0ca6762a36ed6e8a6f494ec0e9239c79ffe088b8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Witch.java +++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java @@ -144,7 +144,7 @@ public class Witch extends Raider implements RangedAttackMob { @Override public void aiStep() { - if (!this.level().isClientSide && this.isAlive()) { + if (/*!this.level().isClientSide &&*/ this.isAlive()) { // Plazma - Remove persist 'isClientSide' flag this.healRaidersGoal.decrementCooldown(); if (this.healRaidersGoal.getCooldown() <= 0) { this.attackPlayersGoal.setCanAttack(true); diff --git a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java index cb20c018c11a0e707c2083cf964bd5303d216edd..3eb20ffc4a0446b2d0580de40b42eca53b53ec03 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zoglin.java @@ -292,7 +292,7 @@ public class Zoglin extends Monster implements HoglinBase { @Override public void setBaby(boolean baby) { this.getEntityData().set(DATA_BABY_ID, baby); - if (!this.level().isClientSide && baby) { + if (/*!this.level().isClientSide &&*/ baby) { // Plazma - Remove persist 'isClientSide' flag this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(0.5); } } @@ -328,11 +328,13 @@ public class Zoglin extends Monster implements HoglinBase { @Override protected SoundEvent getAmbientSound() { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return null; } else { + */ // Plazma - Remove persist 'isClientSide' flag return this.brain.hasMemoryValue(MemoryModuleType.ATTACK_TARGET) ? SoundEvents.ZOGLIN_ANGRY : SoundEvents.ZOGLIN_AMBIENT; - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java index 85b03e0bf7436cb846df13c575ad78ac6a17a151..6628efb0ec59e68810152a64309bc5f610181392 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -249,7 +249,7 @@ public class Zombie extends Monster { @Override public void setBaby(boolean baby) { this.getEntityData().set(Zombie.DATA_BABY_ID, baby); - if (this.level() != null && !this.level().isClientSide) { + if (this.level() != null /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); attributemodifiable.removeModifier(this.babyModifier.id()); // Paper - Make baby speed configurable @@ -275,7 +275,7 @@ public class Zombie extends Monster { @Override public void tick() { - if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) { + if (/*!this.level().isClientSide &&*/ this.isAlive() && !this.isNoAi()) { // Plazma - Remove persist 'isClientSide' flag if (this.isUnderWaterConverting()) { --this.conversionTime; // Paper - remove anti tick skipping measures / wall time if (this.conversionTime < 0) { diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java index 6f6b32bf7f68d05e4173c31f2e631a409b858a05..27f1eaa5e7d11a6aae3f2af07942dbcee60d5216 100644 --- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java @@ -207,7 +207,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { @Override public void tick() { - if (!this.level().isClientSide && this.isAlive() && this.isConverting()) { + if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isConverting()) { // Plazma - Remove persist 'isClientSide' flag int i = this.getConversionProgress(); // CraftBukkit start - Use wall time instead of ticks for villager conversion int elapsedTicks = MinecraftServer.currentTick - this.lastTick; @@ -231,9 +231,9 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { if (itemstack.is(Items.GOLDEN_APPLE)) { if (this.hasEffect(MobEffects.WEAKNESS) && level().purpurConfig.zombieVillagerCureEnabled) { // Purpur itemstack.consume(1, player); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.startConverting(player.getUUID(), this.random.nextInt(level().purpurConfig.zombieVillagerCuringTimeMax - level().purpurConfig.zombieVillagerCuringTimeMin + 1) + level().purpurConfig.zombieVillagerCuringTimeMin); // Purpur - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS_SERVER; } else { diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java index 489644b66266257828fd216e4298bd6d33f7777b..2e39c65304fff182ee63e18f16b677b490af2837 100644 --- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java @@ -87,6 +87,7 @@ public class Breeze extends Monster { @Override public void onSyncedDataUpdated(EntityDataAccessor data) { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide() && Breeze.DATA_POSE.equals(data)) { this.resetAnimations(); Pose entitypose = this.getPose(); @@ -102,6 +103,7 @@ public class Breeze extends Monster { this.slide.startIfStopped(this.tickCount); } } + */ // Plazma - Remove persist 'isClientSide' flag super.onSyncedDataUpdated(data); } diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java index ea1655d2cbc631d80dd66f7e3e24998530df66a2..833667dfaff7f8de638238981adbf0b4a839ea04 100644 --- a/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/src/main/java/net/minecraft/world/entity/monster/creaking/Creaking.java @@ -157,7 +157,7 @@ public class Creaking extends Monster { this.attackAnimationRemainingTicks--; } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean bl = this.entityData.get(CAN_MOVE); boolean bl2 = this.checkCanMove(); if (bl2 != bl) { @@ -171,11 +171,12 @@ public class Creaking extends Monster { } this.entityData.set(CAN_MOVE, bl2); - } + //} // Plazma - Remove persist 'isClientSide' flag super.aiStep(); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { super.tick(); @@ -183,6 +184,7 @@ public class Creaking extends Monster { this.setupAnimationStates(); } } + */ // Plazma - Remove persist 'isClientSide' flag private void setupAnimationStates() { this.attackAnimationState.animateWhen(this.attackAnimationRemainingTicks > 0, this.tickCount); diff --git a/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java b/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java index b57818cbe9ac6a2095da8a2ee6ccbd4c1804a502..c7e217a5ec2cb6d261ae9804ae125961f344a418 100644 --- a/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java +++ b/src/main/java/net/minecraft/world/entity/monster/creaking/CreakingTransient.java @@ -44,9 +44,10 @@ public class CreakingTransient extends Creaking { @Override public boolean hurtServer(ServerLevel world, DamageSource source, float amount) { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { return super.hurtServer(world, source, amount); - } else if (source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { + } else*/ if (source.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) { // Plazma - Remove persist 'isClientSide' flag return super.hurtServer(world, source, amount); } else if (!this.isInvulnerableTo(world, source) && this.invulnerabilityAnimationRemainingTicks <= 0) { this.invulnerabilityAnimationRemainingTicks = 8; @@ -82,7 +83,7 @@ public class CreakingTransient extends Creaking { @Override public void tick() { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag label18: { if (this.homePos != null) { @@ -100,12 +101,14 @@ public class CreakingTransient extends Creaking { this.setRemoved(Entity.RemovalReason.DISCARDED, null); // CraftBukkit - add Bukkit remove cause return; } - } + //} // Plazma - Remove persist 'isClientSide' flag super.tick(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.setupAnimationStates(); } + */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java index 6144613e834236ec0ebb12872ef9e47255b76b5b..28ca4b511ea37f6fd0eefc7a8d449c85075b855d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java @@ -373,7 +373,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected SoundEvent getAmbientSound() { - return this.level().isClientSide ? null : (SoundEvent) HoglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - decompile error + return /*this.level().isClientSide ? null :*/ (SoundEvent) HoglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - decompile error // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java index 20608fb46a0af85739e3c0caa843c1a9d45c9659..938b4025122f6d27382086445bc8f231f325b864 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -312,14 +312,14 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override public void setBaby(boolean baby) { this.getEntityData().set(Piglin.DATA_BABY_ID, baby); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); attributemodifiable.removeModifier(Piglin.SPEED_MODIFIER_BABY.id()); if (baby) { attributemodifiable.addTransientModifier(Piglin.SPEED_MODIFIER_BABY); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -485,7 +485,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected SoundEvent getAmbientSound() { - return this.level().isClientSide ? null : (SoundEvent) PiglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - Decompile error + return /*this.level().isClientSide ? null :*/ (SoundEvent) PiglinAi.getSoundForCurrentActivity(this).orElse(null); // CraftBukkit - Decompile error // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java index 79b090030b716029cc4cfc8bf9d81af0b2202313..6cce132f43ce7aad6f5ee2b351855c9b57b8f0c1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java @@ -287,6 +287,7 @@ public class Warden extends Monster implements VibrationSystem { } super.tick(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide()) { if (this.tickCount % this.getHeartBeatDelay() == 0) { this.heartAnimation = 10; @@ -313,6 +314,7 @@ public class Warden extends Monster implements VibrationSystem { this.clientDiggingParticles(this.diggingAnimationState); } } + */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java index 6c74cf1dea99b3b967b8c3d76f405f823c881fb9..e57f95fb70c7482587acc134982caa22f7c67071 100644 --- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java +++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java @@ -124,16 +124,18 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa @Override public MerchantOffers getOffers() { + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { throw new IllegalStateException("Cannot load Villager offers on the client"); } else { + */ // Plazma - Remove persist 'isClientSide' flag if (this.offers == null) { this.offers = new MerchantOffers(); this.updateTrades(); } return this.offers; - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -175,7 +177,7 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa @Override public void notifyTradeUpdated(ItemStack stack) { - if (!this.level().isClientSide && this.ambientSoundTime > -this.getAmbientSoundInterval() + 20) { + if (/*!this.level().isClientSide &&*/ this.ambientSoundTime > -this.getAmbientSoundInterval() + 20) { // Plazma - Remove persist 'isClientSide' flag this.ambientSoundTime = -this.getAmbientSoundInterval(); this.makeSound(this.getTradeUpdatedSound(!stack.isEmpty())); } @@ -198,13 +200,13 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag MerchantOffers merchantrecipelist = this.getOffers(); if (!merchantrecipelist.isEmpty()) { nbt.put("Offers", (Tag) MerchantOffers.CODEC.encodeStart(this.registryAccess().createSerializationContext(NbtOps.INSTANCE), merchantrecipelist).getOrThrow()); } - } + //} // Plazma - Remove persist 'isClientSide' flag this.writeInventoryToTag(nbt, this.registryAccess()); } @@ -308,8 +310,10 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa return this.getPosition(delta).add(vec3d.yRot(-f1)); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return this.level().isClientSide; } + */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java index 0ee456972923e90905732ffc5d77bb027cf6c0fc..68353a8b2a01fbf873c3751f3887dc0ec35c8327 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -323,13 +323,13 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (this.getUnhappyCounter() > 0) { this.setUnhappyCounter(this.getUnhappyCounter() - 1); } - if (this.isEffectiveAi()) { + //if (this.isEffectiveAi()) { // Plazma - Remove persist 'isClientSide' flag if (this.level().spigotConfig.tickInactiveVillagers) { this.customServerAiStep(this.level().getMinecraftWorld()); } else { this.customServerAiStep(this.level().getMinecraftWorld(), true); } - } + //} // Plazma - Remove persist 'isClientSide' flag maybeDecayGossip(); // Paper end super.inactiveTick(); @@ -418,7 +418,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.setUnhappy(); return tryRide(player, hand, InteractionResult.SUCCESS); // Purpur } else { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag = this.getOffers().isEmpty(); if (hand == InteractionHand.MAIN_HAND) { @@ -436,7 +436,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler if (level().purpurConfig.villagerRidable && itemstack.isEmpty()) return tryRide(player, hand); // Purpur if (this.level().purpurConfig.villagerAllowTrading) // Purpur this.startTrading(player); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -447,9 +447,9 @@ public class Villager extends AbstractVillager implements ReputationEventHandler public void setUnhappy() { this.setUnhappyCounter(40); - if (!this.level().isClientSide()) { + //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag this.makeSound(SoundEvents.VILLAGER_NO); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -477,7 +477,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } private void resetSpecialPrices() { - if (!this.level().isClientSide()) { + //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag Iterator iterator = this.getOffers().iterator(); while (iterator.hasNext()) { @@ -486,7 +486,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler merchantrecipe.resetSpecialPriceDiff(); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java index 42c91e52060fad4a7a598f9e9ef88fd0e0ff8475..c348f049c0d51fc98d3b2dfbdde679fb94037a2e 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java @@ -163,7 +163,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill player.awardStat(Stats.TALKED_TO_VILLAGER); } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.getOffers().isEmpty()) { return tryRide(player, hand, InteractionResult.CONSUME); // Purpur } @@ -172,7 +172,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill this.setTradingPlayer(player); this.openTradingScreen(player, this.getDisplayName(), 1); } // Purpur - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -305,9 +305,9 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill @Override public void aiStep() { super.aiStep(); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.maybeDespawn(); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java index c1d068fa99ec0fd5685bbb627a775e4d1587feab..f92b72ee0172cd878baef69b9710dbaf7e5c4495 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -238,7 +238,7 @@ public abstract class Player extends LivingEntity { this.lastDeathLocation = Optional.empty(); this.setUUID(gameProfile.getId()); this.gameProfile = gameProfile; - this.inventoryMenu = new InventoryMenu(this.inventory, !world.isClientSide, this); + this.inventoryMenu = new InventoryMenu(this.inventory, this); // Plazma - Remove persist 'isClientSide' flag this.containerMenu = this.inventoryMenu; this.moveTo((double) pos.getX() + 0.5D, (double) (pos.getY() + 1), (double) pos.getZ() + 0.5D, yaw, 0.0F); this.rotOffs = 180.0F; @@ -303,7 +303,7 @@ public abstract class Player extends LivingEntity { this.sleepCounter = 100; } - if (!this.level().isClientSide && this.level().isDay()) { + if (/*!this.level().isClientSide &&*/ this.level().isDay()) { // Plazma - Remove persist 'isClientSide' flag this.stopSleepInBed(false, true); } } else if (this.sleepCounter > 0) { @@ -315,7 +315,7 @@ public abstract class Player extends LivingEntity { this.updateIsUnderwater(); super.tick(); - if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) { + if (/*!this.level().isClientSide &&*/ this.containerMenu != null && !this.containerMenu.stillValid(this)) { // Plazma - Remove persist 'isClientSide' flag this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - Inventory close reason this.containerMenu = this.inventoryMenu; } @@ -599,7 +599,7 @@ public abstract class Player extends LivingEntity { @Override public void rideTick() { - if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) { + if (/*!this.level().isClientSide &&*/ this.wantsToStopRiding() && this.isPassenger()) { // Plazma - Remove persist 'isClientSide' flag this.stopRiding(); // CraftBukkit start - SPIGOT-7316: no longer passenger, dismount and return if (!this.isPassenger()) { @@ -676,7 +676,7 @@ public abstract class Player extends LivingEntity { this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft()); this.playShoulderEntityAmbientSound(this.getShoulderEntityRight()); - if (!this.level().isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { + if (/*!this.level().isClientSide &&*/ (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { // Plazma - Remove persist 'isClientSide' flag if (!this.level().paperConfig().entities.behavior.parrotsAreUnaffectedByPlayerMovement) // Paper - Add option to make parrots stay this.removeEntitiesOnShoulder(); } @@ -723,10 +723,10 @@ public abstract class Player extends LivingEntity { this.autoSpinAttackTicks = riptideTicks; this.autoSpinAttackDmg = riptideAttackDamage; this.autoSpinAttackItemStack = stack; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.removeEntitiesOnShoulder(); this.setLivingEntityFlag(4, true); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -811,9 +811,11 @@ public abstract class Player extends LivingEntity { @Nullable public ItemEntity drop(ItemStack itemstack, boolean flag, boolean flag1, boolean callEvent) { // CraftBukkit end + /* // Plazma - Remove persist 'isClientSide' flag if (!itemstack.isEmpty() && this.level().isClientSide) { this.swing(InteractionHand.MAIN_HAND); } + */ // Plazma - Remove persist 'isClientSide' flag return null; } @@ -1059,9 +1061,9 @@ public abstract class Player extends LivingEntity { @Override protected void hurtCurrentlyUsedShield(float amount) { if (this.useItem.is(Items.SHIELD)) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.awardStat(Stats.ITEM_USED.get(this.useItem.getItem())); - } + //} // Plazma - Remove persist 'isClientSide' flag if (amount >= 3.0F) { int i = 1 + Mth.floor(amount); @@ -1454,7 +1456,7 @@ public abstract class Player extends LivingEntity { EnchantmentHelper.doPostAttackEffects(worldserver1, target, damagesource); } - if (!this.level().isClientSide && !itemstack.isEmpty() && object instanceof LivingEntity) { + if (/*!this.level().isClientSide &&*/ !itemstack.isEmpty() && object instanceof LivingEntity) { // Plazma - Remove persist 'isClientSide' flag if (flag5) { itemstack.postHurtEnemy((LivingEntity) object, this); } @@ -1555,9 +1557,11 @@ public abstract class Player extends LivingEntity { } + /* // Plazma - Remove persist 'isClientSide' flag public boolean isLocalPlayer() { return false; } + */ // Plazma - Remove persist 'isClientSide' flag public GameProfile getGameProfile() { return this.gameProfile; @@ -1895,14 +1899,14 @@ public abstract class Player extends LivingEntity { public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) { // CraftBukkit end if (!this.abilities.invulnerable) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start EntityExhaustionEvent event = CraftEventFactory.callPlayerExhaustionEvent(this, reason, f); if (!event.isCancelled()) { this.foodData.addExhaustion(event.getExhaustion()); } // CraftBukkit end - } + //} // Plazma - Remove persist 'isClientSide' flag } } @@ -2098,7 +2102,7 @@ public abstract class Player extends LivingEntity { private Entity respawnEntityOnShoulder0(CompoundTag nbttagcompound) { // CraftBukkit void->boolean // Paper end - release entity api - return entity - overload - if (!this.level().isClientSide && !nbttagcompound.isEmpty()) { + if (/*!this.level().isClientSide &&*/ !nbttagcompound.isEmpty()) { // Plazma - Remove persist 'isClientSide' flag return EntityType.create(nbttagcompound, this.level(), EntitySpawnReason.LOAD).map((entity) -> { // CraftBukkit if (entity instanceof TamableAnimal) { ((TamableAnimal) entity).setOwnerUUID(this.uuid); diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java index 5006a59734c5fc7525fba86f7d74e74f8f1b54b0..3d4d1a247e14f97ddeab3c532341d0e8e89dc2e3 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -229,13 +229,13 @@ public abstract class AbstractArrow extends Projectile { } if (this.isInGround() && flag) { - if (!this.level().isClientSide()) { + //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag if (this.lastState != iblockdata && this.shouldFall()) { this.startFalling(); } else { this.tickDespawn(); } - } + //} // Plazma - Remove persist 'isClientSide' flag ++this.inGroundTime; if (this.isAlive()) { @@ -486,7 +486,7 @@ public abstract class AbstractArrow extends Projectile { if (entity instanceof LivingEntity) { LivingEntity entityliving1 = (LivingEntity) entity; - if (!this.level().isClientSide && this.getPierceLevel() <= 0) { + if (/*!this.level().isClientSide &&*/ this.getPierceLevel() <= 0) { // Plazma - Remove persist 'isClientSide' flag entityliving1.setArrowCount(entityliving1.getArrowCount() + 1); } @@ -508,7 +508,7 @@ public abstract class AbstractArrow extends Projectile { this.piercedAndKilledEntities.add(entityliving1); } - if (!this.level().isClientSide && entity1 instanceof ServerPlayer) { + if (/*!this.level().isClientSide &&*/ entity1 instanceof ServerPlayer) { // Plazma - Remove persist 'isClientSide' flag ServerPlayer entityplayer = (ServerPlayer) entity1; if (this.piercedAndKilledEntities != null) { @@ -764,7 +764,7 @@ public abstract class AbstractArrow extends Projectile { @Override public void playerTouch(Player player) { - if (!this.level().isClientSide && (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) { + if (/*!this.level().isClientSide &&*/ (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start ItemStack itemstack = this.getPickupItem(); if (this.pickup == Pickup.ALLOWED && !itemstack.isEmpty() && player.getInventory().canHold(itemstack) > 0) { @@ -888,7 +888,7 @@ public abstract class AbstractArrow extends Projectile { } public boolean isNoPhysics() { - return !this.level().isClientSide ? this.noPhysics : ((Byte) this.entityData.get(AbstractArrow.ID_FLAGS) & 2) != 0; + return /*!this.level().isClientSide ?*/ this.noPhysics /*: ((Byte) this.entityData.get(AbstractArrow.ID_FLAGS) & 2) != 0*/; // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java index a84dccc59f9dc5298b18f263dc779c30c9b7ddab..c496d825b42bb88e96e7e6aecbe2b3f2461e4238 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java @@ -77,7 +77,7 @@ public abstract class AbstractHurtingProjectile extends Projectile { Entity entity = this.getOwner(); this.applyInertia(); - if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) { + if (/*!this.level().isClientSide &&*/ (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else { HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); diff --git a/src/main/java/net/minecraft/world/entity/projectile/Arrow.java b/src/main/java/net/minecraft/world/entity/projectile/Arrow.java index 50ebe1bfad07f75a12431438cbdc5b909502b201..1efc431401de9678b5a949462cc4617974aba3d9 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Arrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Arrow.java @@ -74,6 +74,7 @@ public class Arrow extends AbstractArrow { @Override public void tick() { super.tick(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.isInGround()) { if (this.inGroundTime % 5 == 0) { @@ -82,7 +83,7 @@ public class Arrow extends AbstractArrow { } else { this.makeParticle(2); } - } else if (this.isInGround() && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) { + } else*/ if (this.isInGround() && this.inGroundTime != 0 && !this.getPotionContents().equals(PotionContents.EMPTY) && this.inGroundTime >= 600) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 0); this.setPickupItemStack(new ItemStack(Items.ARROW)); } diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java index c68ddccd5fbe27f6a62cedbdc2337f1b6e4d3273..2f08a7ee8ddfbe4eb70b163e57918c6edc91ff02 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java @@ -34,7 +34,7 @@ public class DragonFireball extends AbstractHurtingProjectile { protected void onHit(HitResult hitResult) { super.onHit(hitResult); if (hitResult.getType() != HitResult.Type.ENTITY || !this.ownedBy(((EntityHitResult) hitResult).getEntity())) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag List list = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D)); AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); Entity entity = this.getOwner(); @@ -67,7 +67,7 @@ public class DragonFireball extends AbstractHurtingProjectile { this.level().addFreshEntity(entityareaeffectcloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // Paper - use correct spawn reason } else entityareaeffectcloud.discard(null); // Paper - EnderDragon Events this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java index ccc72a2cf02a633655b95f961be310879d8f904f..d56fbb70b9060ce8e012d4aa18db382d755bf59f 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java +++ b/src/main/java/net/minecraft/world/entity/projectile/EvokerFangs.java @@ -90,6 +90,7 @@ public class EvokerFangs extends Entity implements TraceableEntity { @Override public void tick() { super.tick(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { if (this.clientSideAttackStarted) { --this.lifeTicks; @@ -106,7 +107,7 @@ public class EvokerFangs extends Entity implements TraceableEntity { } } } - } else if (--this.warmupDelayTicks < 0) { + } else*/ if (--this.warmupDelayTicks < 0) { // Plazma - Remove persist 'isClientSide' flag if (this.warmupDelayTicks == -8) { List list = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(0.2D, 0.0D, 0.2D)); Iterator iterator = list.iterator(); diff --git a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java index fd1f5de7dc151dfd187d23e022b2c5435ed8accc..bb4d1b5d76769dfcbdfc49b49ca9d0973a720cc4 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java +++ b/src/main/java/net/minecraft/world/entity/projectile/EyeOfEnder.java @@ -129,7 +129,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier { this.setXRot(Projectile.lerpRotation(this.xRotO, (float) (Mth.atan2(vec3d.y, d3) * 57.2957763671875D))); this.setYRot(Projectile.lerpRotation(this.yRotO, (float) (Mth.atan2(vec3d.x, vec3d.z) * 57.2957763671875D))); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag double d4 = this.tx - d0; double d5 = this.tz - d2; float f = (float) Math.sqrt(d4 * d4 + d5 * d5); @@ -146,7 +146,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier { vec3d = new Vec3(Math.cos((double) f1) * d6, d7 + ((double) i - d7) * 0.014999999664723873D, Math.sin((double) f1) * d6); this.setDeltaMovement(vec3d); - } + //} // Plazma - Remove persist 'isClientSide' flag float f2 = 0.25F; @@ -158,10 +158,10 @@ public class EyeOfEnder extends Entity implements ItemSupplier { this.level().addParticle(ParticleTypes.PORTAL, d0 - vec3d.x * 0.25D + this.random.nextDouble() * 0.6D - 0.3D, d1 - vec3d.y * 0.25D - 0.5D, d2 - vec3d.z * 0.25D + this.random.nextDouble() * 0.6D - 0.3D, vec3d.x, vec3d.y, vec3d.z); } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { this.setPos(d0, d1, d2); ++this.life; - if (this.life > 80 && !this.level().isClientSide) { + if (this.life > 80 /*&& !this.level().isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F); this.discard(this.surviveAfterDeath ? EntityRemoveEvent.Cause.DROP : EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause if (this.surviveAfterDeath) { @@ -170,9 +170,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier { this.level().levelEvent(2003, this.blockPosition(), 0); } } + /* // Plazma - Remove persist 'isClientSide' flag } else { this.setPosRaw(d0, d1, d2); } + */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java index 8a4e7e1c0c4919d2ee34121c14f9665b9ad95273..f07ad352ea991752625a5c6bdf6ae9cccaa83ddf 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -188,9 +188,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { } ++this.life; + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide && this.life % 2 < 2) { this.level().addParticle(ParticleTypes.FIREWORK, this.getX(), this.getY(), this.getZ(), this.random.nextGaussian() * 0.05D, -this.getDeltaMovement().y * 0.5D, this.random.nextGaussian() * 0.05D); } + */ // Plazma - Remove persist 'isClientSide' flag if (this.life > this.lifetime) { Level world = this.level(); @@ -309,11 +311,13 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @Override public void handleEntityEvent(byte status) { + /* // Plazma - Remove persist 'isClientSide' flag if (status == 17 && this.level().isClientSide) { Vec3 vec3d = this.getDeltaMovement(); this.level().createFireworks(this.getX(), this.getY(), this.getZ(), vec3d.x, vec3d.y, vec3d.z, this.getExplosions()); } + */ // Plazma - Remove persist 'isClientSide' flag super.handleEntityEvent(status); } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..eb96b2fc32056275d3b9fe8e33162744a7b1870b 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java @@ -175,7 +175,7 @@ public class FishingHook extends Projectile { if (entityhuman == null) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause - } else if (this.level().isClientSide || !this.shouldStopFishing(entityhuman)) { + } else if (/*this.level().isClientSide ||*/ !this.shouldStopFishing(entityhuman)) { // Plazma - Remove persist 'isClientSide' flag if (this.onGround()) { ++this.life; if (this.life >= 1200) { @@ -245,9 +245,9 @@ public class FishingHook extends Projectile { this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.1D * (double) this.syncronizedRandom.nextFloat() * (double) this.syncronizedRandom.nextFloat(), 0.0D)); } - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.catchingFish(blockposition); - } + //} // Plazma - Remove persist 'isClientSide' flag } else { this.outOfWaterTime = Math.min(10, this.outOfWaterTime + 1); } @@ -300,9 +300,9 @@ public class FishingHook extends Projectile { @Override protected void onHitEntity(EntityHitResult entityHitResult) { super.onHitEntity(entityHitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.setHookedEntity(entityHitResult.getEntity()); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -507,7 +507,7 @@ public class FishingHook extends Projectile { // Paper end - Add hand parameter to PlayerFishEvent net.minecraft.world.entity.player.Player entityhuman = this.getPlayerOwner(); - if (!this.level().isClientSide && entityhuman != null && !this.shouldStopFishing(entityhuman)) { + if (/*!this.level().isClientSide &&*/ entityhuman != null && !this.shouldStopFishing(entityhuman)) { // Plazma - Remove persist 'isClientSide' flag int i = 0; if (this.hookedIn != null) { @@ -605,9 +605,11 @@ public class FishingHook extends Projectile { @Override public void handleEntityEvent(byte status) { + /* // Plazma - Remove persist 'isClientSide' flag if (status == 31 && this.level().isClientSide && this.hookedIn instanceof net.minecraft.world.entity.player.Player && ((net.minecraft.world.entity.player.Player) this.hookedIn).isLocalPlayer()) { this.pullEntity(this.hookedIn); } + */ // Plazma - Remove persist 'isClientSide' flag super.handleEntityEvent(status); } diff --git a/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java b/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java index 0b7f27a6cc6be58fa5b60002059c9fbb3b1b7b67..8b8977d9aadd929e2b1b4d8a1b76aa4f0b30352b 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java +++ b/src/main/java/net/minecraft/world/entity/projectile/LlamaSpit.java @@ -91,9 +91,9 @@ public class LlamaSpit extends Projectile { @Override protected void onHitBlock(BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java index a7df9c2a3f210bc944cf76cdcc8d2a9484704bd1..4c65d1b1b1330b286dd32eb81bdf889c39a35166 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -383,7 +383,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { public boolean deflect(ProjectileDeflection deflection, @Nullable Entity deflector, @Nullable Entity owner, boolean fromAttack) { deflection.deflect(this, deflector, this.random); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - Fix PickupStatus getting reset if (this instanceof AbstractArrow arrow) { arrow.setOwner(owner, false); @@ -392,7 +392,7 @@ public abstract class Projectile extends Entity implements TraceableEntity { } // Paper end - Fix PickupStatus getting reset this.onDeflection(deflector, fromAttack); - } + //} // Plazma - Remove persist 'isClientSide' flag return true; } diff --git a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java index 347b1cab11529cb5399e607626c84bc985d5c513..f65bd1693d3395357da07bceaf1e2480ad3db9f8 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ShulkerBullet.java @@ -226,7 +226,7 @@ public class ShulkerBullet extends Projectile { HitResult movingobjectposition = null; Vec3 vec3d; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (this.finalTarget == null && this.targetId != null) { this.finalTarget = ((ServerLevel) this.level()).getEntity(this.targetId); if (this.finalTarget == null) { @@ -245,7 +245,7 @@ public class ShulkerBullet extends Projectile { } movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); - } + //} // Plazma - Remove persist 'isClientSide' flag vec3d = this.getDeltaMovement(); this.setPos(this.position().add(vec3d)); @@ -259,9 +259,10 @@ public class ShulkerBullet extends Projectile { } ProjectileUtil.rotateTowardsMovement(this, 0.5F); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.level().addParticle(ParticleTypes.END_ROD, this.getX() - vec3d.x, this.getY() - vec3d.y + 0.15D, this.getZ() - vec3d.z, 0.0D, 0.0D, 0.0D); - } else if (this.finalTarget != null && !this.finalTarget.isRemoved()) { + } else*/ if (this.finalTarget != null && !this.finalTarget.isRemoved()) { // Plazma - Remove persist 'isClientSide' flag if (this.flightSteps > 0) { --this.flightSteps; if (this.flightSteps == 0) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java index 588b07ec4501924a49264183b414a7fd64bb6550..5bdd243b96042e301eed0d232b569b2a94e394e3 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/SmallFireball.java @@ -90,9 +90,9 @@ public class SmallFireball extends Fireball { @Override protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java index 0db58e7d63a5c1b43a2224c247979f23a1d3f899..43e3bd03eb8378a80d1cd9a7804ac013c4333ea2 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java @@ -68,7 +68,7 @@ public class Snowball extends ThrowableItemProjectile { protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag net.minecraft.core.BlockPos blockposition = blockHitResult.getBlockPos(); net.minecraft.core.BlockPos blockposition1 = blockposition.relative(blockHitResult.getDirection()); @@ -89,17 +89,17 @@ public class Snowball extends ThrowableItemProjectile { this.level().setBlockAndUpdate(blockposition, iblockdata.setValue(net.minecraft.world.level.block.CampfireBlock.LIT, false)); } } - } + //} // Plazma - Remove persist 'isClientSide' flag } // Purpur end @Override protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 3); this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java b/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java index 85b3cdaaa1a90ad4e712955d3c8bfe3f7758b6a9..969667fb486befd1dedac9b89db95a854fee85ac 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/SpectralArrow.java @@ -27,6 +27,7 @@ public class SpectralArrow extends AbstractArrow { super(EntityType.SPECTRAL_ARROW, x, y, z, world, stack, shotFrom); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public void tick() { super.tick(); @@ -35,6 +36,7 @@ public class SpectralArrow extends AbstractArrow { } } + */ // Plazma - Remove persist 'isClientSide' flag @Override protected void doPostHurtEffects(LivingEntity target) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java index 155c2bbd35adacb7c3668fbe81a7c454e5102c8b..ad30bae96d147e0d2aa4f3ae5469fbf74e3010af 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java @@ -57,7 +57,7 @@ public class ThrownEgg extends ThrowableItemProjectile { @Override protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start boolean hatching = this.random.nextInt(8) == 0; if (true) { @@ -117,7 +117,7 @@ public class ThrownEgg extends ThrowableItemProjectile { this.level().broadcastEntityEvent(this, (byte) 3); this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java index 9d79b193fe2a737a20d1709548b2cd6c454ff27b..15662c7161e8fe9b4a4a88d75c15908140014a33 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -78,7 +78,7 @@ public class ThrownPotion extends ThrowableItemProjectile { @Override protected void onHitBlock(BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack = this.getItem(); Direction enumdirection = blockHitResult.getDirection(); BlockPos blockposition = blockHitResult.getBlockPos(); @@ -97,7 +97,7 @@ public class ThrownPotion extends ThrowableItemProjectile { } } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java index e63b408594b5d2673148e39c1deafc8510537bee..7365dcde9d134bceeaed0b0fc16ea34c163966f1 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java +++ b/src/main/java/net/minecraft/world/entity/projectile/WitherSkull.java @@ -100,7 +100,7 @@ public class WitherSkull extends AbstractHurtingProjectile { @Override protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start // this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB); ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.level().purpurConfig.witherExplosionRadius, false); // Purpur @@ -111,7 +111,7 @@ public class WitherSkull extends AbstractHurtingProjectile { } // CraftBukkit end this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java b/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java index a325a223d06e155c01f664562db0edd0b180e356..7fed147928ae3710808101ef3f9408af470452da 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java +++ b/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java @@ -108,23 +108,23 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple @Override protected void onHitBlock(BlockHitResult blockHitResult) { super.onHitBlock(blockHitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag Vec3i baseblockposition = blockHitResult.getDirection().getUnitVec3i(); Vec3 vec3d = Vec3.atLowerCornerOf(baseblockposition).multiply(0.25D, 0.25D, 0.25D); Vec3 vec3d1 = blockHitResult.getLocation().add(vec3d); this.explode(vec3d1); this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override protected void onHit(HitResult hitResult) { super.onHit(hitResult); - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -156,7 +156,7 @@ public abstract class AbstractWindCharge extends AbstractHurtingProjectile imple @Override public void tick() { - if (!this.level().isClientSide && this.getBlockY() > this.level().getMaxY() + 30) { + if (/*!this.level().isClientSide &&*/ this.getBlockY() > this.level().getMaxY() + 30) { // Plazma - Remove persist 'isClientSide' flag this.explode(this.position()); this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD); // CraftBukkit - add Bukkit remove cause } else { diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java index 56c265940208bc94f531a5af94f564b59f35ebf3..fd8658223cf52bbedfe37585383686c6a5219a7d 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java @@ -178,13 +178,13 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @Override public void onAboveBubbleCol(boolean drag) { - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.isAboveBubbleColumn = true; this.bubbleColumnDirectionIsDown = drag; if (this.getBubbleTime() == 0) { this.setBubbleTime(60); } - } + //} // Plazma - Remove persist 'isClientSide' flag this.level().addParticle(ParticleTypes.SPLASH, this.getX() + (double) this.random.nextFloat(), this.getY() + 0.7D, this.getZ() + (double) this.random.nextFloat(), 0.0D, 0.0D, 0.0D); if (this.random.nextInt(20) == 0) { @@ -295,7 +295,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { ++this.outOfControlTicks; } - if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) { + if (/*!this.level().isClientSide &&*/ this.outOfControlTicks >= 60.0F) { // Plazma - Remove persist 'isClientSide' flag this.ejectPassengers(); } @@ -309,21 +309,25 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { super.tick(); this.tickLerp(); - if (this.isControlledByLocalInstance()) { + //if (this.isControlledByLocalInstance()) { // Plazma - Remove persist 'isClientSide' flag if (!(this.getFirstPassenger() instanceof Player)) { this.setPaddleState(false, false); } this.floatBoat(); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { this.controlBoat(); this.level().sendPacketToServer(new ServerboundPaddleBoatPacket(this.getPaddleState(0), this.getPaddleState(1))); } + */ // Plazma - Remove persist 'isClientSide' flag this.move(MoverType.SELF, this.getDeltaMovement()); + /* // Plazma - Remove persist 'isClientSide' flag } else { this.setDeltaMovement(Vec3.ZERO); } + */ // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start org.bukkit.Server server = this.level().getCraftServer(); @@ -367,7 +371,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { List list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this)); if (!list.isEmpty()) { - boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player); + boolean flag = /*!this.level().isClientSide &&*/ !(this.getControllingPassenger() instanceof Player); // Plazma - Remove persist 'isClientSide' flag Iterator iterator = list.iterator(); while (iterator.hasNext()) { @@ -388,6 +392,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { private void tickBubbleColumn() { int i; + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide) { i = this.getBubbleTime(); if (i > 0) { @@ -400,6 +405,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { this.bubbleAngleO = this.bubbleAngle; this.bubbleAngle = 10.0F * (float) Math.sin((double) (0.5F * (float) this.level().getGameTime())) * this.bubbleMultiplier; } else { + */ // Plazma - Remove persist 'isClientSide' flag if (!this.isAboveBubbleColumn) { this.setBubbleTime(0); } @@ -426,7 +432,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { this.isAboveBubbleColumn = false; } - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -839,7 +845,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { public InteractionResult interact(Player player, InteractionHand hand) { InteractionResult enuminteractionresult = super.interact(player, hand); - return (InteractionResult) (enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (!player.isSecondaryUseActive() && this.outOfControlTicks < 60.0F && (this.level().isClientSide || player.startRiding(this)) ? InteractionResult.SUCCESS : InteractionResult.PASS)); + return (InteractionResult) (enuminteractionresult != InteractionResult.PASS ? enuminteractionresult : (!player.isSecondaryUseActive() && this.outOfControlTicks < 60.0F && (/*this.level().isClientSide ||*/ player.startRiding(this)) ? InteractionResult.SUCCESS : InteractionResult.PASS)); // Plazma - Remove persist 'isClientSide' flag } @Override @@ -851,7 +857,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { @Override public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { // CraftBukkit end - if (!this.level().isClientSide && entity_removalreason.shouldDestroy() && this.isLeashed()) { + if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy() && this.isLeashed()) { // Plazma - Remove persist 'isClientSide' flag this.dropLeash(true, true); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java index f888f1dd2e3c228b0a370fe920b63d547bbba571..6ab21ca26499e7d98da87f7dfefd385239caf996 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java @@ -86,7 +86,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto @Override public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { // CraftBukkit end - if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) { + if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy()) { // Plazma - Remove persist 'isClientSide' flag Containers.dropContents(this.level(), (Entity) this, (Container) this); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java index b31940441596079aae1cd2a38b9d22be18358448..4c16ccf8dc8b6558d113bb40241506c1565141f4 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java @@ -648,51 +648,44 @@ public abstract class AbstractMinecart extends VehicleEntity { @Override public void push(Entity entity) { - if (!this.level().isClientSide) { - if (!entity.noPhysics && !this.noPhysics) { - if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant - if (!this.hasPassenger(entity)) { - // CraftBukkit start - VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); - this.level().getCraftServer().getPluginManager().callEvent(collisionEvent); - - if (collisionEvent.isCancelled()) { - return; - } - // CraftBukkit end - double d0 = entity.getX() - this.getX(); - double d1 = entity.getZ() - this.getZ(); - double d2 = d0 * d0 + d1 * d1; - - if (d2 >= 9.999999747378752E-5D) { - d2 = Math.sqrt(d2); - d0 /= d2; - d1 /= d2; - double d3 = 1.0D / d2; - - if (d3 > 1.0D) { - d3 = 1.0D; - } + // Plazma start - Remove persist 'isClientSide' flag + if (entity.noPhysics || this.noPhysics) return; + if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant + if (!this.hasPassenger(entity)) return; - d0 *= d3; - d1 *= d3; - d0 *= 0.10000000149011612D; - d1 *= 0.10000000149011612D; - d0 *= 0.5D; - d1 *= 0.5D; - if (entity instanceof AbstractMinecart) { - AbstractMinecart entityminecartabstract = (AbstractMinecart) entity; - - this.pushOtherMinecart(entityminecartabstract, d0, d1); - } else { - this.push(-d0, 0.0D, -d1); - entity.push(d0 / 4.0D, 0.0D, d1 / 4.0D); - } - } + // CraftBukkit start + VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); + this.level().getCraftServer().getPluginManager().callEvent(collisionEvent); + if (collisionEvent.isCancelled()) return; + // CraftBukkit end - } - } + double dX = entity.getX() - this.getX(); + double dZ = entity.getZ() - this.getZ(); + double dL = dX * dX + dZ * dZ; // deltaLength + if (dL < 9.999999747378752E-5D) return; + + dL = Math.sqrt(dL); + dX /= dL; + dZ /= dL; + + double dLp = 1.0D / dL; // deltaLength%p + if (dLp > 1.0D) dLp = 1.0D; + + dX *= dLp; + dZ *= dLp; + dX *= 0.10000000149011612D; + dZ *= 0.10000000149011612D; + dX *= 0.5D; + dZ *= 0.5D; + + if (entity instanceof AbstractMinecart entityminecartabstract) { + this.pushOtherMinecart(entityminecartabstract, dX, dZ); + return; } + + this.push(-dX, 0.0D, -dZ); + entity.push(dX / 4.0D, 0.0D, dZ / 4.0D); + // Plazma end - Remove persist 'isClientSide' flag } private void pushOtherMinecart(AbstractMinecart entity, double xDiff, double zDiff) { diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java index d528e8e4aea266c495377365f01e314001eb1970..fb1c8f1133809ce3f25b50da889f3539ebc0bdaa 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java @@ -138,7 +138,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @Override public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { // CraftBukkit end - if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) { + if (/*!this.level().isClientSide &&*/ entity_removalreason.shouldDestroy()) { // Plazma - Remove persist 'isClientSide' flag Containers.dropContents(this.level(), (Entity) this, (Container) this); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Minecart.java b/src/main/java/net/minecraft/world/entity/vehicle/Minecart.java index f7b7b63d7a61503590191e4edae3926b591549be..a43f8386e9178c7deeb3c8c2b9f39ac6448f6c3a 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/Minecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Minecart.java @@ -22,13 +22,15 @@ public class Minecart extends AbstractMinecart { @Override public InteractionResult interact(Player player, InteractionHand hand) { - if (!player.isSecondaryUseActive() && !this.isVehicle() && (this.level().isClientSide || player.startRiding(this))) { + if (!player.isSecondaryUseActive() && !this.isVehicle() && (/*this.level().isClientSide ||*/ player.startRiding(this))) { // Plazma - Remove persist 'isClientSide' flag this.playerRotationOffset = this.rotationOffset; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag return (InteractionResult)(player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS); + /* // Plazma - Remove persist 'isClientSide' flag } else { return InteractionResult.SUCCESS; } + */ // Plazma - Remove persist 'isClientSide' flag } else { return InteractionResult.PASS; } @@ -71,19 +73,23 @@ public class Minecart extends AbstractMinecart { Vec3 vec3 = this.position(); super.tick(); double e = ((double)this.getYRot() - d) % 360.0; + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide && vec3.distanceTo(this.position()) > 0.01) { this.rotationOffset += (float)e; this.rotationOffset %= 360.0F; } + */ // Plazma - Remove persist 'isClientSide' flag } @Override protected void positionRider(Entity passenger, Entity.MoveFunction positionUpdater) { super.positionRider(passenger, positionUpdater); + /* // Plazma - Remove persist 'isClientSide' flag if (this.level().isClientSide && passenger instanceof Player player && player.shouldRotateWithMinecart() && useExperimentalMovement(this.level())) { float f = (float)Mth.rotLerp(0.5, (double)this.playerRotationOffset, (double)this.rotationOffset); player.setYRot(player.getYRot() - (f - this.playerRotationOffset)); this.playerRotationOffset = f; } + */ // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartFurnace.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartFurnace.java index 38c7cb9a4112b7bb98942aa05533f54b3a0827c4..0ef2244e291ee2683c0ae76ad5622c8a699cd714 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartFurnace.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartFurnace.java @@ -46,7 +46,7 @@ public class MinecartFurnace extends AbstractMinecart { @Override public void tick() { super.tick(); - if (!this.level().isClientSide()) { + //if (!this.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag if (this.fuel > 0) { this.fuel--; } @@ -56,7 +56,7 @@ public class MinecartFurnace extends AbstractMinecart { } this.setHasFuel(this.fuel > 0); - } + //} // Plazma - Remove persist 'isClientSide' flag if (this.hasFuel() && this.random.nextInt(4) == 0) { this.level().addParticle(ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.8, this.getZ(), 0.0, 0.0, 0.0); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java index d81a6874e8b25f098df619f84c359e146c7f64de..10bf3173b970f02029e680955b622104c1ae1c0f 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java @@ -93,7 +93,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper } private void tryConsumeItems() { - if (!this.level().isClientSide && this.isAlive() && this.isEnabled() && !this.consumedItemThisFrame && this.suckInItems()) { + if (/*!this.level().isClientSide &&*/ this.isAlive() && this.isEnabled() && !this.consumedItemThisFrame && this.suckInItems()) { // Plazma - Remove persist 'isClientSide' flag this.consumedItemThisFrame = true; this.setChanged(); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java index 0652494dc5f3d999116d4380032dea0e7402caec..63d208dbdde9cda9b0ad284f187c0cc542f88d82 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java @@ -169,12 +169,12 @@ public class MinecartTNT extends AbstractMinecart { public void primeFuse() { this.fuse = 80; - if (!this.level().isClientSide) { + //if (!this.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.level().broadcastEntityEvent(this, (byte) 10); if (!this.isSilent()) { this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); } - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java index e0ee1c10960d24d2369d16f22431a8e02a5570aa..139f066a1b3644dac927ac0a74632e92153bdd2d 100644 --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java @@ -71,14 +71,14 @@ public class BeaconMenu extends AbstractContainerMenu { @Override public void removed(Player player) { super.removed(player); - if (!player.level().isClientSide) { + //if (!player.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack = this.paymentSlot.remove(this.paymentSlot.getMaxStackSize()); if (!itemstack.isEmpty()) { player.drop(itemstack, false); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java index 5685a3aeef1f7c5a1edebce0eae5cfb0ed179df6..9fcbfa64aef0d11998f8c85fa79a7a48a5413568 100644 --- a/src/main/java/net/minecraft/world/inventory/InventoryMenu.java +++ b/src/main/java/net/minecraft/world/inventory/InventoryMenu.java @@ -42,18 +42,16 @@ public class InventoryMenu extends AbstractCraftingMenu { public static final ResourceLocation EMPTY_ARMOR_SLOT_SHIELD = ResourceLocation.withDefaultNamespace("item/empty_armor_slot_shield"); private static final Map TEXTURE_EMPTY_SLOTS = Map.of(EquipmentSlot.FEET, InventoryMenu.EMPTY_ARMOR_SLOT_BOOTS, EquipmentSlot.LEGS, InventoryMenu.EMPTY_ARMOR_SLOT_LEGGINGS, EquipmentSlot.CHEST, InventoryMenu.EMPTY_ARMOR_SLOT_CHESTPLATE, EquipmentSlot.HEAD, InventoryMenu.EMPTY_ARMOR_SLOT_HELMET); private static final EquipmentSlot[] SLOT_IDS = new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}; - public final boolean active; private final Player owner; // CraftBukkit start private CraftInventoryView bukkitEntity = null; // CraftBukkit end - public InventoryMenu(Inventory inventory, boolean onServer, final Player owner) { + public InventoryMenu(Inventory inventory, final Player owner) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start super((MenuType) null, 0, 2, 2, inventory); // CraftBukkit - save player this.setTitle(Component.translatable("container.crafting")); // SPIGOT-4722: Allocate title for player inventory // CraftBukkit end - this.active = onServer; this.owner = owner; this.addResultSlot(owner, 154, 28); this.addCraftingGridSlots(98, 18); @@ -98,9 +96,9 @@ public class InventoryMenu extends AbstractCraftingMenu { public void removed(Player player) { super.removed(player); this.resultSlots.clearContent(); - if (!player.level().isClientSide) { + //if (!player.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.clearContainer(player, this.craftSlots); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java index 6a529b5e289c416c0ebdc0260086ec039777aa40..22cbe82a4afab9efd2776600e0e67ac65396c73a 100644 --- a/src/main/java/net/minecraft/world/inventory/MerchantMenu.java +++ b/src/main/java/net/minecraft/world/inventory/MerchantMenu.java @@ -174,7 +174,7 @@ public class MerchantMenu extends AbstractContainerMenu { } private void playTradeSound() { - if (!this.trader.isClientSide() && this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035 + if (/*!this.trader.isClientSide() &&*/ this.trader instanceof Entity) { // CraftBukkit - SPIGOT-5035 // Plazma - Remove persist 'isClientSide' flag Entity entity = (Entity) this.trader; entity.level().playLocalSound(entity.getX(), entity.getY(), entity.getZ(), this.trader.getNotifyTradeSound(), SoundSource.NEUTRAL, 1.0F, 1.0F, false); @@ -186,7 +186,7 @@ public class MerchantMenu extends AbstractContainerMenu { public void removed(Player player) { super.removed(player); this.trader.setTradingPlayer((Player) null); - if (!this.trader.isClientSide()) { + //if (!this.trader.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag if (player.isAlive() && (!(player instanceof ServerPlayer) || !((ServerPlayer) player).hasDisconnected())) { if (player instanceof ServerPlayer) { player.getInventory().placeItemBackInInventory(this.tradeContainer.removeItemNoUpdate(0)); @@ -205,7 +205,7 @@ public class MerchantMenu extends AbstractContainerMenu { } } - } + //} // Plazma - Remove persist 'isClientSide' flag } public void tryMoveItems(int recipeIndex) { diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java index d58619d1d63a03598b8740dd789d4b6f2c93f8d0..1a989b55cc7f411b7d3270e537bf711396be0864 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java @@ -221,8 +221,8 @@ public class BlockItem extends Item { BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity != null) { - if (!world.isClientSide && tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission - if (!(!world.isClientSide && world.purpurConfig.silkTouchEnabled && tileentity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity && player.getBukkitEntity().hasPermission("purpur.drop.spawners"))) + if (/*!world.isClientSide &&*/ tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission // Plazma - Remove persist 'isClientSide' flag + if (!(/*!world.isClientSide &&*/ world.purpurConfig.silkTouchEnabled && tileentity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity && player.getBukkitEntity().hasPermission("purpur.drop.spawners"))) // Plazma - Remove persist 'isClientSide' flag return false; } diff --git a/src/main/java/net/minecraft/world/item/BoatItem.java b/src/main/java/net/minecraft/world/item/BoatItem.java index 78d41d57df9cb61b295f1f54db1e1d62c13db701..86f2a6eac07f8886ee1674fb984c0b986dcad060 100644 --- a/src/main/java/net/minecraft/world/item/BoatItem.java +++ b/src/main/java/net/minecraft/world/item/BoatItem.java @@ -79,7 +79,7 @@ public class BoatItem extends Item { if (!world.noCollision(abstractboat, abstractboat.getBoundingBox())) { return InteractionResult.FAIL; } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(world, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), user, abstractboat, hand).isCancelled()) { return InteractionResult.FAIL; @@ -91,7 +91,7 @@ public class BoatItem extends Item { // CraftBukkit end world.gameEvent((Entity) user, (Holder) GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation()); itemstack.consume(1, user); - } + //} // Plazma - Remove persist 'isClientSide' flag user.awardStat(Stats.ITEM_USED.get(this)); return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/item/BoneMealItem.java b/src/main/java/net/minecraft/world/item/BoneMealItem.java index c7d4a09c11f933494ab047921660451c6c1c7280..69125b16efeee7554ca48fd28b97aca5a98d62fe 100644 --- a/src/main/java/net/minecraft/world/item/BoneMealItem.java +++ b/src/main/java/net/minecraft/world/item/BoneMealItem.java @@ -46,10 +46,10 @@ public class BoneMealItem extends Item { BlockPos blockposition1 = blockposition.relative(itemactioncontext.getClickedFace()); if (BoneMealItem.growCrop(itemactioncontext.getItemInHand(), world, blockposition)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518 world.levelEvent(1505, blockposition, 15); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { @@ -57,10 +57,10 @@ public class BoneMealItem extends Item { boolean flag = iblockdata.isFaceSturdy(world, blockposition, itemactioncontext.getClickedFace()); if (flag && BoneMealItem.growWaterPlant(itemactioncontext.getItemInHand(), world, blockposition1, itemactioncontext.getClickedFace())) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518 world.levelEvent(1505, blockposition1, 15); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java index 6aa8ee091d3a7d2826d08ab9a03f970ef71a81ea..a7694884434e702f1ac43c3c8426b47d6663c286 100644 --- a/src/main/java/net/minecraft/world/item/BucketItem.java +++ b/src/main/java/net/minecraft/world/item/BucketItem.java @@ -94,9 +94,9 @@ public class BucketItem extends Item implements DispensibleContainerItem { world.gameEvent((Entity) user, (Holder) GameEvent.FLUID_PICKUP, blockposition); ItemStack itemstack2 = ItemUtils.createFilledResult(itemstack, user, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag CriteriaTriggers.FILLED_BUCKET.trigger((ServerPlayer) user, itemstack1); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS.heldItemTransformedTo(itemstack2); } @@ -218,7 +218,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { } } - if (!world.isClientSide && flag && !iblockdata.liquid()) { + if (/*!world.isClientSide &&*/ flag && !iblockdata.liquid()) { // Plazma - Remove persist 'isClientSide' flag world.destroyBlock(blockposition, true); } diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java index f1999d904ac66f5349346ad8157f5401fb395e11..23f6fa49af0c124b75188d4a69af30fde888d87d 100644 --- a/src/main/java/net/minecraft/world/item/BundleItem.java +++ b/src/main/java/net/minecraft/world/item/BundleItem.java @@ -141,12 +141,14 @@ public class BundleItem extends Item { @Override public InteractionResult use(Level world, Player user, InteractionHand hand) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.CONSUME; } else { + */ // Plazma - Remove persist 'isClientSide' flag user.startUsingItem(hand); return InteractionResult.SUCCESS_SERVER; - } + //} // Plazma - Remove persist 'isClientSide' flag } private void dropContent(Level world, Player player, ItemStack stack) { @@ -232,7 +234,7 @@ public class BundleItem extends Item { @Override public void onUseTick(Level world, LivingEntity user, ItemStack stack, int remainingUseTicks) { - if (!world.isClientSide && user instanceof Player player) { + if (/*!world.isClientSide &&*/ user instanceof Player player) { // Plazma - Remove persist 'isClientSide' flag int i = this.getUseDuration(stack, user); boolean bl = remainingUseTicks == i; if (bl || remainingUseTicks < i - 10 && remainingUseTicks % 2 == 0) { diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java index 86204c2ab5bbd5d45ddb1d626f844d91ccae6b4f..6ffbe9d3be2ef3cb9c8f08db0373379856cc748b 100644 --- a/src/main/java/net/minecraft/world/item/CrossbowItem.java +++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java @@ -222,7 +222,7 @@ public class CrossbowItem extends ProjectileWeaponItem { @Override public void onUseTick(Level world, LivingEntity user, ItemStack stack, int remainingUseTicks) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag CrossbowItem.ChargingSounds chargingSounds = this.getChargingSounds(stack); float f = (float)(stack.getUseDuration(user) - remainingUseTicks) / (float)getChargeDuration(stack, user); if (f < 0.2F) { @@ -241,7 +241,7 @@ public class CrossbowItem extends ProjectileWeaponItem { chargingSounds.mid() .ifPresent(sound -> world.playSound(null, user.getX(), user.getY(), user.getZ(), sound.value(), SoundSource.PLAYERS, 0.5F, 1.0F)); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/item/DebugStickItem.java b/src/main/java/net/minecraft/world/item/DebugStickItem.java index 97fc76c9b93e61445fe73390d088a6e512b2cb47..d4245a0103fcb89895c9e355e34ea966f0221df9 100644 --- a/src/main/java/net/minecraft/world/item/DebugStickItem.java +++ b/src/main/java/net/minecraft/world/item/DebugStickItem.java @@ -29,9 +29,9 @@ public class DebugStickItem extends Item { @Override public boolean canAttackBlock(BlockState state, Level world, BlockPos pos, Player miner) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.handleInteraction(miner, state, world, pos, false, miner.getItemInHand(InteractionHand.MAIN_HAND)); - } + //} // Plazma - Remove persist 'isClientSide' flag return false; } @@ -41,7 +41,7 @@ public class DebugStickItem extends Item { Player entityhuman = context.getPlayer(); Level world = context.getLevel(); - if (!world.isClientSide && entityhuman != null) { + if (/*!world.isClientSide &&*/ entityhuman != null) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = context.getClickedPos(); if (!this.handleInteraction(entityhuman, world.getBlockState(blockposition), world, blockposition, true, context.getItemInHand())) { diff --git a/src/main/java/net/minecraft/world/item/DyeItem.java b/src/main/java/net/minecraft/world/item/DyeItem.java index a3e82a50b0cfd02d2b8e27074e1f97557bb1c9bb..6fb374632d9b90df013fe07fafcc79c96e29adda 100644 --- a/src/main/java/net/minecraft/world/item/DyeItem.java +++ b/src/main/java/net/minecraft/world/item/DyeItem.java @@ -30,7 +30,7 @@ public class DyeItem extends Item implements SignApplicator { if (entity instanceof Sheep entitysheep) { if (entitysheep.isAlive() && !entitysheep.isSheared() && entitysheep.getColor() != this.dyeColor) { entitysheep.level().playSound(user, (Entity) entitysheep, SoundEvents.DYE_USE, SoundSource.PLAYERS, 1.0F, 1.0F); - if (!user.level().isClientSide) { + //if (!user.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start byte bColor = (byte) this.dyeColor.getId(); SheepDyeWoolEvent event = new SheepDyeWoolEvent((org.bukkit.entity.Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByWoolData(bColor), (org.bukkit.entity.Player) user.getBukkitEntity()); @@ -43,7 +43,7 @@ public class DyeItem extends Item implements SignApplicator { entitysheep.setColor(DyeColor.byId((byte) event.getColor().getWoolData())); // CraftBukkit end stack.shrink(1); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/item/EmptyMapItem.java b/src/main/java/net/minecraft/world/item/EmptyMapItem.java index 588b6c94bb9a3372e1e5e32e177379dcc7709a84..ad95332084072c1c932ad1dd077346d9c4830d7b 100644 --- a/src/main/java/net/minecraft/world/item/EmptyMapItem.java +++ b/src/main/java/net/minecraft/world/item/EmptyMapItem.java @@ -15,9 +15,11 @@ public class EmptyMapItem extends Item { @Override public InteractionResult use(Level world, Player user, InteractionHand hand) { ItemStack itemStack = user.getItemInHand(hand); + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS; } else { + */ // Plazma - Remove persist 'isClientSide' flag itemStack.consume(1, user); user.awardStat(Stats.ITEM_USED.get(this)); user.level().playSound(null, user, SoundEvents.UI_CARTOGRAPHY_TABLE_TAKE_RESULT, user.getSoundSource(), 1.0F, 1.0F); @@ -31,6 +33,6 @@ public class EmptyMapItem extends Item { return InteractionResult.SUCCESS; } - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java index c71a426c47e0ebc57ecb8c9c1d171737a084ccab..05264c4f0d2f13758d5726ab8b145d20fed4187c 100644 --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java @@ -41,9 +41,11 @@ public class EnderEyeItem extends Item { BlockState iblockdata = world.getBlockState(blockposition); if (iblockdata.is(Blocks.END_PORTAL_FRAME) && !(Boolean) iblockdata.getValue(EndPortalFrameBlock.HAS_EYE)) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS; } else { + */ // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = (BlockState) iblockdata.setValue(EndPortalFrameBlock.HAS_EYE, true); // Paper start if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockposition, iblockdata1)) { @@ -91,7 +93,7 @@ public class EnderEyeItem extends Item { } return InteractionResult.SUCCESS; - } + //} // Plazma - Remove persist 'isClientSide' flag } else { return InteractionResult.PASS; } diff --git a/src/main/java/net/minecraft/world/item/FishingRodItem.java b/src/main/java/net/minecraft/world/item/FishingRodItem.java index 801a513d67637136a15307a98fc6bbec9d202b00..e079c3392997ac8a2d7d915cadd8ece189eb5054 100644 --- a/src/main/java/net/minecraft/world/item/FishingRodItem.java +++ b/src/main/java/net/minecraft/world/item/FishingRodItem.java @@ -30,11 +30,11 @@ public class FishingRodItem extends Item { ItemStack itemstack = user.getItemInHand(hand); if (user.fishing != null) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag int i = user.fishing.retrieve(hand, itemstack); // Paper - Add hand parameter to PlayerFishEvent itemstack.hurtAndBreak(i, user, LivingEntity.getSlotForHand(hand)); - } + //} // Plazma - Remove persist 'isClientSide' flag world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.FISHING_BOBBER_RETRIEVE, SoundSource.NEUTRAL, 1.0F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); user.gameEvent(GameEvent.ITEM_INTERACT_FINISH); diff --git a/src/main/java/net/minecraft/world/item/FoodOnAStickItem.java b/src/main/java/net/minecraft/world/item/FoodOnAStickItem.java index a8188a10d3569c9aef16d64f6e56db367769af61..9e42239f6dc236c304e7cd61c1aa8f98ed4b455c 100644 --- a/src/main/java/net/minecraft/world/item/FoodOnAStickItem.java +++ b/src/main/java/net/minecraft/world/item/FoodOnAStickItem.java @@ -24,9 +24,11 @@ public class FoodOnAStickItem extends Item { @Override public InteractionResult use(Level world, Player user, InteractionHand hand) { ItemStack itemStack = user.getItemInHand(hand); + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.PASS; } else { + */ // Plazma - Remove persist 'isClientSide' flag Entity entity = user.getControlledVehicle(); if (user.isPassenger() && entity instanceof ItemSteerable itemSteerable && entity.getType() == this.canInteractWith && itemSteerable.boost()) { EquipmentSlot equipmentSlot = LivingEntity.getSlotForHand(hand); @@ -36,6 +38,6 @@ public class FoodOnAStickItem extends Item { user.awardStat(Stats.ITEM_USED.get(this)); return InteractionResult.PASS; - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/item/HangingEntityItem.java b/src/main/java/net/minecraft/world/item/HangingEntityItem.java index 44a7cee7df2927a923455e8cedaab59307b42506..267c30b20e1dba9f7c13bf770f4e8d3c28c6808e 100644 --- a/src/main/java/net/minecraft/world/item/HangingEntityItem.java +++ b/src/main/java/net/minecraft/world/item/HangingEntityItem.java @@ -83,7 +83,7 @@ public class HangingEntityItem extends Item { } if (((HangingEntity) object).survives()) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - fire HangingPlaceEvent Player who = (context.getPlayer() == null) ? null : (Player) context.getPlayer().getBukkitEntity(); org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -100,7 +100,7 @@ public class HangingEntityItem extends Item { ((HangingEntity) object).playPlacementSound(); world.gameEvent((Entity) entityhuman, (Holder) GameEvent.ENTITY_PLACE, ((HangingEntity) object).position()); world.addFreshEntity((Entity) object); - } + //} // Plazma - Remove persist 'isClientSide' flag itemstack.shrink(1); return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/item/HoeItem.java b/src/main/java/net/minecraft/world/item/HoeItem.java index 0936bdc945f73c7750c20a34276aead2921eeb61..0b530ae9aa19a2f6917fc8a25a64a6287eebf554 100644 --- a/src/main/java/net/minecraft/world/item/HoeItem.java +++ b/src/main/java/net/minecraft/world/item/HoeItem.java @@ -63,12 +63,12 @@ public class HoeItem extends DiggerItem { if (predicate.test(context)) { Player player = context.getPlayer(); if (!TILLABLES.containsKey(clickedBlock)) level.playSound(null, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound - if (!level.isClientSide) { + //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag consumer.accept(context); if (player != null) { context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java index 3d948c8d325bcef7f4cfc0045f9991acb3aa2f7c..7fc8fcab93be9076391a2981d028831cbd02a3d2 100644 --- a/src/main/java/net/minecraft/world/item/Item.java +++ b/src/main/java/net/minecraft/world/item/Item.java @@ -217,7 +217,7 @@ public class Item implements FeatureElement, ItemLike { if (tool == null) { return false; } else { - if (!world.isClientSide && state.getDestroySpeed(world, pos) != 0.0F && tool.damagePerBlock() > 0) { + if (/*!world.isClientSide &&*/ state.getDestroySpeed(world, pos) != 0.0F && tool.damagePerBlock() > 0) { // Plazma - Remove persist 'isClientSide' flag stack.hurtAndBreak(tool.damagePerBlock(), miner, EquipmentSlot.MAINHAND); } diff --git a/src/main/java/net/minecraft/world/item/ItemUtils.java b/src/main/java/net/minecraft/world/item/ItemUtils.java index 0c4074ed8b4fd9d6fcb838e8843d66f6f286ed5d..c2c075c9372d34ba94af8367709af0993d359309 100644 --- a/src/main/java/net/minecraft/world/item/ItemUtils.java +++ b/src/main/java/net/minecraft/world/item/ItemUtils.java @@ -40,7 +40,7 @@ public class ItemUtils { public static void onContainerDestroyed(ItemEntity itemEntity, Iterable contents) { Level level = itemEntity.level(); - if (!level.isClientSide) { + //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - call EntityDropItemEvent contents.forEach(stack -> { ItemEntity droppedItem = new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), stack); @@ -50,6 +50,6 @@ public class ItemUtils { } }); // Paper end - call EntityDropItemEvent - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/item/JukeboxPlayable.java b/src/main/java/net/minecraft/world/item/JukeboxPlayable.java index 295db20dcb4d637a834530687577a844d62a6fc9..f4a18d82e169ccdf33f00d4dc92db24f097dbf19 100644 --- a/src/main/java/net/minecraft/world/item/JukeboxPlayable.java +++ b/src/main/java/net/minecraft/world/item/JukeboxPlayable.java @@ -65,7 +65,7 @@ public record JukeboxPlayable(EitherHolder song, boolean showInTool } else { BlockState blockState = world.getBlockState(pos); if (blockState.is(Blocks.JUKEBOX) && !blockState.getValue(JukeboxBlock.HAS_RECORD)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag ItemStack itemStack = stack.consumeAndReturn(1, player); if (world.getBlockEntity(pos) instanceof JukeboxBlockEntity jukeboxBlockEntity) { jukeboxBlockEntity.setTheItem(itemStack); @@ -73,7 +73,7 @@ public record JukeboxPlayable(EitherHolder song, boolean showInTool } player.awardStat(Stats.PLAY_RECORD); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java index f378bbd2fec6b74020417728c45d48d13c9d1a98..48eab51b8e050daa21f4834d946fccc5a9d5fb7b 100644 --- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java +++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java @@ -31,7 +31,7 @@ public class KnowledgeBookItem extends Item { if (list.isEmpty()) { return InteractionResult.FAIL; } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag RecipeManager recipeManager = world.getServer().getRecipeManager(); List> list2 = new ArrayList<>(list.size()); @@ -47,7 +47,7 @@ public class KnowledgeBookItem extends Item { user.awardRecipes(list2); user.awardStat(Stats.ITEM_USED.get(this)); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/item/LeadItem.java b/src/main/java/net/minecraft/world/item/LeadItem.java index 7c910d96edac066d4634bc6f6049a72238884ae9..6d12dce8e50ce73602341fd7d78e314146151501 100644 --- a/src/main/java/net/minecraft/world/item/LeadItem.java +++ b/src/main/java/net/minecraft/world/item/LeadItem.java @@ -39,7 +39,7 @@ public class LeadItem extends Item { if (iblockdata.is(BlockTags.FENCES)) { Player entityhuman = context.getPlayer(); - if (!world.isClientSide && entityhuman != null) { + if (/*!world.isClientSide &&*/ entityhuman != null) { // Plazma - Remove persist 'isClientSide' flag return LeadItem.bindPlayerMobs(entityhuman, world, blockposition, context.getHand()); // CraftBukkit - Pass hand } } diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java index c2f3c8b3d8eeb609b6d6067c4fb404aefbf94ec5..8c455ac7dcb126e2b2932eba980454513947fac2 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java @@ -269,7 +269,7 @@ public class MapItem extends Item { @Override public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag MapItemSavedData mapItemSavedData = getSavedData(stack, world); if (mapItemSavedData != null) { if (entity instanceof Player player) { @@ -280,7 +280,7 @@ public class MapItem extends Item { this.update(world, entity, mapItemSavedData); } } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -349,12 +349,12 @@ public class MapItem extends Item { public InteractionResult useOn(UseOnContext context) { BlockState blockState = context.getLevel().getBlockState(context.getClickedPos()); if (blockState.is(BlockTags.BANNERS)) { - if (!context.getLevel().isClientSide) { + //if (!context.getLevel().isClientSide) { // Plazma - Remove persist 'isClientSide' flag MapItemSavedData mapItemSavedData = getSavedData(context.getItemInHand(), context.getLevel()); if (mapItemSavedData != null && !mapItemSavedData.toggleBanner(context.getLevel(), context.getClickedPos())) { return InteractionResult.FAIL; } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java index 20fece9908382f40b4082f7b1fb7d41914ae31be..4df7168ccb37ebde8e9d39145379298b986621c8 100644 --- a/src/main/java/net/minecraft/world/item/NameTagItem.java +++ b/src/main/java/net/minecraft/world/item/NameTagItem.java @@ -17,7 +17,7 @@ public class NameTagItem extends Item { public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { Component component = stack.get(DataComponents.CUSTOM_NAME); if (component != null && entity.getType().canSerialize()) { - if (!user.level().isClientSide && entity.isAlive()) { + if (/*!user.level().isClientSide &&*/ entity.isAlive()) { // Plazma - Remove persist 'isClientSide' flag // Paper start - Add PlayerNameEntityEvent io.papermc.paper.event.player.PlayerNameEntityEvent event = new io.papermc.paper.event.player.PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(stack.getHoverName()), true); if (!event.callEvent()) return InteractionResult.PASS; diff --git a/src/main/java/net/minecraft/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java index f19bd2c25d3c84d9f16cad38ac5c32736f0f3a8d..a4d6781bb0e3173f30601bd6f1cef6d9a0cf2934 100644 --- a/src/main/java/net/minecraft/world/item/PotionItem.java +++ b/src/main/java/net/minecraft/world/item/PotionItem.java @@ -51,7 +51,7 @@ public class PotionItem extends Item { level.playSound(null, blockPos, SoundEvents.GENERIC_SPLASH, SoundSource.BLOCKS, 1.0F, 1.0F); player.setItemInHand(context.getHand(), ItemUtils.createFilledResult(itemStack, player, new ItemStack(Items.GLASS_BOTTLE))); player.awardStat(Stats.ITEM_USED.get(itemStack.getItem())); - if (!level.isClientSide) { + //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag ServerLevel serverLevel = (ServerLevel)level; for (int i = 0; i < 5; i++) { @@ -67,7 +67,7 @@ public class PotionItem extends Item { 1.0 ); } - } + //} // Plazma - Remove persist 'isClientSide' flag level.playSound(null, blockPos, SoundEvents.BOTTLE_EMPTY, SoundSource.BLOCKS, 1.0F, 1.0F); level.gameEvent(null, GameEvent.FLUID_PLACE, blockPos); diff --git a/src/main/java/net/minecraft/world/item/SaddleItem.java b/src/main/java/net/minecraft/world/item/SaddleItem.java index 5616d137fc67c1c5527e3cc7c10fea36a556d21a..78cc14c737aaa8b74279253ab3c4d537a549dda7 100644 --- a/src/main/java/net/minecraft/world/item/SaddleItem.java +++ b/src/main/java/net/minecraft/world/item/SaddleItem.java @@ -16,10 +16,10 @@ public class SaddleItem extends Item { @Override public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { if (entity instanceof Saddleable saddleable && entity.isAlive() && !saddleable.isSaddled() && saddleable.isSaddleable()) { - if (!user.level().isClientSide) { + //if (!user.level().isClientSide) { // Plazma - Remove persist 'isClientSide' flag saddleable.equipSaddle(stack.split(1), SoundSource.NEUTRAL); entity.level().gameEvent(entity, GameEvent.EQUIP, entity.position()); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/item/ScaffoldingBlockItem.java b/src/main/java/net/minecraft/world/item/ScaffoldingBlockItem.java index b16e47bd57dea6815ed1ebbd2aa432e97a497d52..dbdccf42c586a94812d708027b7d67b78dd4fcff 100644 --- a/src/main/java/net/minecraft/world/item/ScaffoldingBlockItem.java +++ b/src/main/java/net/minecraft/world/item/ScaffoldingBlockItem.java @@ -39,7 +39,7 @@ public class ScaffoldingBlockItem extends BlockItem { BlockPos.MutableBlockPos mutableBlockPos = blockPos.mutable().move(direction); while (i < 7) { - if (!level.isClientSide && !level.isInWorldBounds(mutableBlockPos)) { + if (/*!level.isClientSide &&*/ !level.isInWorldBounds(mutableBlockPos)) { // Plazma - Remove persist 'isClientSide' flag Player player = context.getPlayer(); int j = level.getMaxY(); if (player instanceof ServerPlayer && mutableBlockPos.getY() > j) { diff --git a/src/main/java/net/minecraft/world/item/ShearsItem.java b/src/main/java/net/minecraft/world/item/ShearsItem.java index 374d51da03ce47ff744b64b8cfe98ad6d72ebdb4..90259b0156f32a6c2693ba750d055df1bfdc480c 100644 --- a/src/main/java/net/minecraft/world/item/ShearsItem.java +++ b/src/main/java/net/minecraft/world/item/ShearsItem.java @@ -44,7 +44,7 @@ public class ShearsItem extends Item { @Override public boolean mineBlock(ItemStack stack, Level world, BlockState state, BlockPos pos, LivingEntity miner) { - if (!world.isClientSide && !state.is(BlockTags.FIRE)) { + if (/*!world.isClientSide &&*/ !state.is(BlockTags.FIRE)) { // Plazma - Remove persist 'isClientSide' flag stack.hurtAndBreak(1, miner, EquipmentSlot.MAINHAND); } diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java index d10c4705cc9e7faabd4a5619e1da107231bdb37e..43e0a8c66e0b56094c4846c36932a9ed76d139b0 100644 --- a/src/main/java/net/minecraft/world/item/ShovelItem.java +++ b/src/main/java/net/minecraft/world/item/ShovelItem.java @@ -55,9 +55,9 @@ public class ShovelItem extends DiggerItem { // Purpur end } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { afterAction = () -> { // Paper - if (!level.isClientSide()) { + //if (!level.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag level.levelEvent(null, 1009, blockPos, 0); - } + //} // Plazma - Remove persist 'isClientSide' flag CampfireBlock.dowse(context.getPlayer(), level, blockPos, blockState); }; // Paper @@ -65,7 +65,7 @@ public class ShovelItem extends DiggerItem { } if (blockState3 != null) { - if (!level.isClientSide) { + //if (!level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(context.getPlayer(), blockPos, blockState3)) { return InteractionResult.PASS; @@ -77,7 +77,7 @@ public class ShovelItem extends DiggerItem { if (player != null) { context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand())); } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/item/SignItem.java b/src/main/java/net/minecraft/world/item/SignItem.java index fcc78491cef1cf1535888c4ed43c3b71fb597848..2b160d620624187d1d96068b8095844f623505bb 100644 --- a/src/main/java/net/minecraft/world/item/SignItem.java +++ b/src/main/java/net/minecraft/world/item/SignItem.java @@ -27,7 +27,7 @@ public class SignItem extends StandingAndWallBlockItem { protected boolean updateCustomBlockEntityTag(BlockPos pos, Level world, @Nullable Player player, ItemStack stack, BlockState state) { boolean flag = super.updateCustomBlockEntityTag(pos, world, player, stack, state); - if (!world.isClientSide && !flag && player != null) { + if (/*!world.isClientSide &&*/ !flag && player != null) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof SignBlockEntity) { diff --git a/src/main/java/net/minecraft/world/item/SolidBucketItem.java b/src/main/java/net/minecraft/world/item/SolidBucketItem.java index 867b1326eaaa4a0ff7c5773e0098ebf68a55c519..d856dfd4a59de600291f2cdc139ce553b2d5cee0 100644 --- a/src/main/java/net/minecraft/world/item/SolidBucketItem.java +++ b/src/main/java/net/minecraft/world/item/SolidBucketItem.java @@ -40,9 +40,9 @@ public class SolidBucketItem extends BlockItem implements DispensibleContainerIt @Override public boolean emptyContents(@Nullable Player player, Level world, BlockPos pos, @Nullable BlockHitResult hitResult) { if (world.isInWorldBounds(pos) && world.isEmptyBlock(pos)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag world.setBlock(pos, this.getBlock().defaultBlockState(), 3); - } + //} // Plazma - Remove persist 'isClientSide' flag world.gameEvent(player, GameEvent.FLUID_PLACE, pos); world.playSound(player, pos, this.placeSound, SoundSource.BLOCKS, 1.0F, 1.0F); diff --git a/src/main/java/net/minecraft/world/item/SpawnEggItem.java b/src/main/java/net/minecraft/world/item/SpawnEggItem.java index e0e746d6c78421b40777125ba49f0a04809f5415..5d89be2a176bd48c9c0e287f118976f2d65b2261 100644 --- a/src/main/java/net/minecraft/world/item/SpawnEggItem.java +++ b/src/main/java/net/minecraft/world/item/SpawnEggItem.java @@ -57,9 +57,11 @@ public class SpawnEggItem extends Item { public InteractionResult useOn(UseOnContext context) { Level world = context.getLevel(); + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS; } else { + */ // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack = context.getItemInHand(); BlockPos blockposition = context.getClickedPos(); Direction enumdirection = context.getClickedFace(); @@ -113,7 +115,7 @@ public class SpawnEggItem extends Item { return InteractionResult.SUCCESS; } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override @@ -123,9 +125,10 @@ public class SpawnEggItem extends Item { if (movingobjectpositionblock.getType() != HitResult.Type.BLOCK) { return InteractionResult.PASS; - } else if (world.isClientSide) { + } /*else if (world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { + */ // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = movingobjectpositionblock.getBlockPos(); if (!(world.getBlockState(blockposition).getBlock() instanceof LiquidBlock)) { @@ -145,7 +148,7 @@ public class SpawnEggItem extends Item { } else { return InteractionResult.FAIL; } - } + //} // Plazma - Remove persist 'isClientSide' flag } public boolean spawnsEntity(ItemStack stack, EntityType type) { diff --git a/src/main/java/net/minecraft/world/item/component/Consumable.java b/src/main/java/net/minecraft/world/item/component/Consumable.java index 6be5e7b0ce975702ae7c337a06faa59ff3414d64..a992094d5b40c3b56b14182cfcb9884ee52604cc 100644 --- a/src/main/java/net/minecraft/world/item/component/Consumable.java +++ b/src/main/java/net/minecraft/world/item/component/Consumable.java @@ -73,7 +73,7 @@ public record Consumable(float consumeSeconds, ItemUseAnimation animation, Holde stack.getAllOfType(ConsumableListener.class).forEach((consumablelistener) -> { consumablelistener.onConsume(world, user, stack, this); }); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start EntityPotionEffectEvent.Cause cause; if (stack.is(Items.MILK_BUCKET)) { @@ -88,7 +88,7 @@ public record Consumable(float consumeSeconds, ItemUseAnimation animation, Holde consumeeffect.apply(world, stack, user, cause); // CraftBukkit end }); - } + //} // Plazma - Remove persist 'isClientSide' flag user.gameEvent(this.animation == ItemUseAnimation.DRINK ? GameEvent.DRINK : GameEvent.EAT); stack.consume(1, user); diff --git a/src/main/java/net/minecraft/world/item/equipment/Equippable.java b/src/main/java/net/minecraft/world/item/equipment/Equippable.java index 1263f84cfe3b9f6ff7b33f04528a3f01ded8b670..9ff0b7fd831ae7a318f1106303e27d0f1de12feb 100644 --- a/src/main/java/net/minecraft/world/item/equipment/Equippable.java +++ b/src/main/java/net/minecraft/world/item/equipment/Equippable.java @@ -85,9 +85,9 @@ public record Equippable( ItemStack itemStack = player.getItemBySlot(this.slot); if ((!EnchantmentHelper.has(itemStack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE) || player.isCreative()) && !ItemStack.isSameItemSameComponents(stack, itemStack)) { - if (!player.level().isClientSide()) { + //if (!player.level().isClientSide()) { // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.ITEM_USED.get(stack.getItem())); - } + //} // Plazma - Remove persist 'isClientSide' flag if (stack.getCount() <= 1) { ItemStack itemStack2 = itemStack.isEmpty() ? stack : itemStack.copyAndClear(); diff --git a/src/main/java/net/minecraft/world/item/trading/Merchant.java b/src/main/java/net/minecraft/world/item/trading/Merchant.java index 716b30dcd7e63c66736c448dd136c9f74dc7fe43..bebad1479b39e08e636b10a6e3c5f0d36d8c7756 100644 --- a/src/main/java/net/minecraft/world/item/trading/Merchant.java +++ b/src/main/java/net/minecraft/world/item/trading/Merchant.java @@ -52,7 +52,7 @@ public interface Merchant { } - boolean isClientSide(); + //boolean isClientSide(); // Plazma - Remove persist 'isClientSide' flag org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant(); // CraftBukkit } diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java index 5cb39f95bd2d45b6c18554605f01d2ebf6473428..d581534e7b1a5ab95a76f7394bf82f2f066c863b 100644 --- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java +++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java @@ -117,7 +117,7 @@ public abstract class BaseCommandBlock implements CommandSource { } public boolean performCommand(Level world) { - if (!world.isClientSide && world.getGameTime() != this.lastExecution) { + if (/*!world.isClientSide &&*/ world.getGameTime() != this.lastExecution) { // Plazma - Remove persist 'isClientSide' flag if ("Searge".equalsIgnoreCase(this.command)) { this.lastOutput = Component.literal("#itzlipofutzli"); this.successCount = 1; @@ -208,9 +208,11 @@ public abstract class BaseCommandBlock implements CommandSource { if (!player.canUseGameMasterBlocks() && (!player.isCreative() || !player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission return InteractionResult.PASS; } else { + /* // Plazma - Remove persist 'isClientSide' flag if (player.getCommandSenderWorld().isClientSide) { player.openMinecartCommandBlock(this); } + */ // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java index 357d484029fe338bea4f5770d13ccfc0dce4432e..5865b715c1f91ad16a7c0d5918bc8e43579b7790 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -364,9 +364,11 @@ public abstract class BaseSpawner { public boolean onEventTriggered(Level world, int status) { if (status == 1) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { this.spawnDelay = this.minSpawnDelay; } + */ // Plazma - Remove persist 'isClientSide' flag return true; } else { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index 0da2014933fe441c4d3dc27c5fe10afa92ca1ec7..a44cb5609b3d467ba24d4814ff2d1840f49d37ed 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -137,7 +137,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl private final RandomSource threadSafeRandom = RandomSource.createThreadSafe(); private final Holder dimensionTypeRegistration; public final WritableLevelData levelData; - public final boolean isClientSide; + //public final boolean isClientSide; // Plazma - Remove persist 'isClientSide' flag private final WorldBorder worldBorder; private final BiomeManager biomeManager; private final ResourceKey dimension; @@ -927,7 +927,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl final DimensionType dimensionmanager = (DimensionType) holder.value(); this.dimension = resourcekey; - this.isClientSide = flag; + //this.isClientSide = flag; // Plazma - Remove persist 'isClientSide' flag if (dimensionmanager.coordinateScale() != 1.0D) { this.worldBorder = new WorldBorder() { // CraftBukkit - decompile error @Override @@ -1031,10 +1031,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl return true; } // Paper end - Cancel hit for vanished players + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return this.isClientSide; } + */ // Plazma - Remove persist 'isClientSide' flag @Nullable @Override @@ -1173,7 +1175,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl // CraftBukkit end if (this.isOutsideBuildHeight(pos)) { return false; - } else if (!this.isClientSide && this.isDebug()) { + } else if (/*!this.isClientSide &&*/ this.isDebug()) { // Plazma - Remove persist 'isClientSide' flag return false; } else { LevelChunk chunk = this.getChunkAt(pos); @@ -1259,13 +1261,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl this.setBlocksDirty(blockposition, iblockdata1, iblockdata2); } - if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.FULL)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement // Paper - rewrite chunk system - change from ticking to full + if ((i & 2) != 0 && (/*!this.isClientSide ||*/ (i & 4) == 0) && (/*this.isClientSide ||*/ chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.FULL)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement // Paper - rewrite chunk system - change from ticking to full // Plazma - Remove persist 'isClientSide' flag this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i); } if ((i & 1) != 0) { this.blockUpdated(blockposition, iblockdata1.getBlock()); - if (!this.isClientSide && iblockdata.hasAnalogOutputSignal()) { + if (/*!this.isClientSide &&*/ iblockdata.hasAnalogOutputSignal()) { // Plazma - Remove persist 'isClientSide' flag this.updateNeighbourForOutputSignal(blockposition, newBlock.getBlock()); } } @@ -1630,7 +1632,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } // Paper end - Perf: Optimize capturedTileEntities lookup // CraftBukkit end - return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && !ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system + return this.isOutsideBuildHeight(blockposition) ? null : (/*!this.isClientSide &&*/ !ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, LevelChunk.EntityCreationType.IMMEDIATE)); // Paper - rewrite chunk system // Plazma - Remove persist 'isClientSide' flag } public void setBlockEntity(BlockEntity blockEntity) { diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java index ade435de0af4ee3566fa4a490df53cddd2f6531c..98e4c19e448d2afd6bc76b454fe46bf99455c766 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -76,7 +76,7 @@ public interface LevelReader extends ca.spottedleaf.moonrise.patches.chunk_syste Holder getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ); - boolean isClientSide(); + //boolean isClientSide(); // Plazma - Remove persist 'isClientSide' flag int getSeaLevel(); diff --git a/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java b/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java index 53e85641cbbc49ad7e588741acc4227828c8dca1..3f0e466578188bf5dbdeb905908fea4f663292a2 100644 --- a/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AbstractCandleBlock.java @@ -46,7 +46,7 @@ public abstract class AbstractCandleBlock extends Block { @Override protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { - if (!world.isClientSide && projectile.isOnFire() && this.canBeLit(state)) { + if (/*!world.isClientSide &&*/ projectile.isOnFire() && this.canBeLit(state)) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, hit.getBlockPos(), projectile).isCancelled()) { return; diff --git a/src/main/java/net/minecraft/world/level/block/AbstractFurnaceBlock.java b/src/main/java/net/minecraft/world/level/block/AbstractFurnaceBlock.java index af71305c908ad4401bcddb120f50d76a34cd1131..ecdd56596d97a097db8511307122ae4274287456 100644 --- a/src/main/java/net/minecraft/world/level/block/AbstractFurnaceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AbstractFurnaceBlock.java @@ -38,9 +38,9 @@ public abstract class AbstractFurnaceBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.openContainer(world, pos, player); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/AbstractSkullBlock.java b/src/main/java/net/minecraft/world/level/block/AbstractSkullBlock.java index bd7a54744de84c2da642d63778e71f590f4c6ca9..39a22ef4025ea5ddc74b2872206cf420a7d31ab2 100644 --- a/src/main/java/net/minecraft/world/level/block/AbstractSkullBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AbstractSkullBlock.java @@ -38,12 +38,14 @@ public abstract class AbstractSkullBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { boolean bl = state.is(Blocks.DRAGON_HEAD) || state.is(Blocks.DRAGON_WALL_HEAD) || state.is(Blocks.PIGLIN_HEAD) || state.is(Blocks.PIGLIN_WALL_HEAD); if (bl) { return createTickerHelper(type, BlockEntityType.SKULL, SkullBlockEntity::animation); } } + */ // Plazma - Remove persist 'isClientSide' flag return null; } @@ -69,11 +71,11 @@ public abstract class AbstractSkullBlock extends BaseEntityBlock { @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean bl = world.hasNeighborSignal(pos); if (bl != state.getValue(POWERED)) { world.setBlock(pos, state.setValue(POWERED, Boolean.valueOf(bl)), 2); } - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/level/block/AmethystBlock.java b/src/main/java/net/minecraft/world/level/block/AmethystBlock.java index 8a900fd00b97a6c068ef76ec1d17abffaaef15b6..61f50cfe860b59570b0a2ae5c2789edc3b88038b 100644 --- a/src/main/java/net/minecraft/world/level/block/AmethystBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AmethystBlock.java @@ -24,9 +24,9 @@ public class AmethystBlock extends Block { @Override protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockPos = hit.getBlockPos(); world.playSound(null, blockPos, SoundEvents.AMETHYST_BLOCK_CHIME, SoundSource.BLOCKS, 1.0F, 0.5F + world.random.nextFloat() * 1.2F); - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java index f9a2d2d4f798efa0d691996ec5ff7fe00260b36c..dd64b024d30df7685f5819843f2279cd7329bd52 100644 --- a/src/main/java/net/minecraft/world/level/block/AnvilBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AnvilBlock.java @@ -108,11 +108,11 @@ public class AnvilBlock extends FallingBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_ANVIL); } // Paper - Fix InventoryOpenEvent cancellation - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java index 0cf4133849ed8ff6d4038cc41ede9d3645b31da1..af52ca942bbdd588017759017ff466216e0f3d18 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java @@ -186,9 +186,9 @@ public abstract class BaseFireBlock extends Block { @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide()) { + //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.levelEvent((Player) null, 1009, pos, 0); - } + //} // Plazma - Remove persist 'isClientSide' flag return super.playerWillDestroy(world, pos, state, player); } diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java index 9afa811579ac2e556b5c5c23b3b49587439dfadc..98912bd1d29e7946430de6577efe28b56bef6cde 100644 --- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java @@ -78,14 +78,14 @@ public abstract class BasePressurePlateBlock extends Block { @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag int i = this.getSignalForState(state); if (i == 0) { this.checkPressed(entity, world, pos, state, i); } - } + //} // Plazma - Remove persist 'isClientSide' flag } private void checkPressed(@Nullable Entity entity, Level world, BlockPos pos, BlockState state, int output) { diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java index f9a55f76fed8609bca167b2ea37464e8079de0c0..dbba3e6d9d1d631b8bc5c15e6032685be2aad28f 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java @@ -79,7 +79,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide && world.getBlockState(pos).is(this)) { + if (/*!world.isClientSide &&*/ world.getBlockState(pos).is(this)) { // Plazma - Remove persist 'isClientSide' flag RailShape railShape = state.getValue(this.getShapeProperty()); if (shouldBeRemoved(pos, world, railShape)) { dropResources(state, world, pos); @@ -113,12 +113,14 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl } protected BlockState updateDir(Level world, BlockPos pos, BlockState state, boolean forceUpdate) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return state; } else { + */ // Plazma - Remove persist 'isClientSide' flag RailShape railShape = state.getValue(this.getShapeProperty()); return new RailState(world, pos, state).place(world.hasNeighborSignal(pos), forceUpdate, railShape).getState(); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java index debe8dbf1d5f3e58774903c5fcdcea672274ea61..25473693bc8404b45912402bb1d47fb1e8e18109 100644 --- a/src/main/java/net/minecraft/world/level/block/BeaconBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeaconBlock.java @@ -46,7 +46,7 @@ public class BeaconBlock extends BaseEntityBlock implements BeaconBeamBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide && world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) instanceof BeaconBlockEntity beaconBlockEntity && player.openMenu(beaconBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.INTERACT_WITH_BEACON); } diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java index c130d316e87f1f896d33ab43831063a89e3bef2b..bd8784d80665ca8f45ca78c9c792e4e79fb78a55 100644 --- a/src/main/java/net/minecraft/world/level/block/BedBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java @@ -84,9 +84,11 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS_SERVER; } else { + */ // Plazma - Remove persist 'isClientSide' flag if (state.getValue(BedBlock.PART) != BedPart.HEAD) { pos = pos.relative((Direction) state.getValue(BedBlock.FACING)); state = world.getBlockState(pos); @@ -142,7 +144,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock }); return InteractionResult.SUCCESS_SERVER; } - } + //} // Plazma - Remove persist 'isClientSide' flag } // CraftBukkit start @@ -218,7 +220,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide && player.isCreative()) { + if (/*!world.isClientSide &&*/ player.isCreative()) { // Plazma - Remove persist 'isClientSide' flag BedPart blockpropertybedpart = (BedPart) state.getValue(BedBlock.PART); if (blockpropertybedpart == BedPart.FOOT) { @@ -362,7 +364,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { super.setPlacedBy(world, pos, state, placer, itemStack); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition1 = pos.relative((Direction) state.getValue(BedBlock.FACING)); world.setBlock(blockposition1, (BlockState) state.setValue(BedBlock.PART, BedPart.HEAD), 3); @@ -373,7 +375,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock // CraftBukkit end world.blockUpdated(pos, Blocks.AIR); state.updateNeighbourShapes(world, pos, 3); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java index 6c0ea0bde1c36edda92807e317ed37f8b1bdac6a..8840bea07f0b43b8919604a0492ee7669aa00442 100644 --- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java @@ -96,7 +96,7 @@ public class BeehiveBlock extends BaseEntityBlock { @Override public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool, boolean includeDrops, boolean dropExp) { // Paper - fix drops not preventing stats/food exhaustion super.playerDestroy(world, player, pos, state, blockEntity, tool, includeDrops, dropExp); // Paper - fix drops not preventing stats/food exhaustion - if (!world.isClientSide && blockEntity instanceof BeehiveBlockEntity tileentitybeehive) { + if (/*!world.isClientSide &&*/ blockEntity instanceof BeehiveBlockEntity tileentitybeehive) { // Plazma - Remove persist 'isClientSide' flag if (!EnchantmentHelper.hasTag(tool, EnchantmentTags.PREVENTS_BEE_SPAWNS_WHEN_MINING)) { tileentitybeehive.emptyAllLivingFromHive(player, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); world.updateNeighbourForOutputSignal(pos, this); @@ -182,7 +182,7 @@ public class BeehiveBlock extends BaseEntityBlock { world.gameEvent((Entity) player, (Holder) GameEvent.FLUID_PICKUP, pos); } - if (!world.isClientSide() && flag) { + if (/*!world.isClientSide() &&*/ flag) { // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.ITEM_USED.get(item)); } } @@ -295,7 +295,7 @@ public class BeehiveBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.BEEHIVE, BeehiveBlockEntity::serverTick); + return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.BEEHIVE, BeehiveBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/BellBlock.java b/src/main/java/net/minecraft/world/level/block/BellBlock.java index 104d228633110746dde42b187ad23d1b2406b5ee..73615c055c5ed16dd025808560ee8d83ec85bb4b 100644 --- a/src/main/java/net/minecraft/world/level/block/BellBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BellBlock.java @@ -144,7 +144,7 @@ public class BellBlock extends BaseEntityBlock { public boolean attemptToRing(@Nullable Entity entity, Level world, BlockPos pos, @Nullable Direction direction) { BlockEntity tileentity = world.getBlockEntity(pos); - if (!world.isClientSide && tileentity instanceof BellBlockEntity) { + if (/*!world.isClientSide &&*/ tileentity instanceof BellBlockEntity) { // Plazma - Remove persist 'isClientSide' flag if (direction == null) { direction = (Direction) world.getBlockState(pos).getValue(BellBlock.FACING); } @@ -281,7 +281,7 @@ public class BellBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, BlockEntityType.BELL, world.isClientSide ? BellBlockEntity::clientTick : BellBlockEntity::serverTick); + return createTickerHelper(type, BlockEntityType.BELL, /*world.isClientSide ? BellBlockEntity::clientTick :*/ BellBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java index 2535e6d71b690f8dfde41a7d9cb76b6f010f5aa7..bf4c5d6f2b7c24a7f439f9026e4056663c7462d3 100644 --- a/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BigDripleafBlock.java @@ -181,7 +181,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) { // CraftBukkit start - tilt dripleaf org.bukkit.event.Cancellable cancellable; @@ -199,7 +199,7 @@ public class BigDripleafBlock extends HorizontalDirectionalBlock implements Bone // CraftBukkit end } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 1748aea6613e0c8081f70092c9431e7e04907383..872756eedbb1a594cd76b249ef0db05fbf1d46c8 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -191,9 +191,9 @@ public class Block extends BlockBehaviour implements ItemLike { public static void updateOrDestroy(BlockState state, BlockState newState, LevelAccessor world, BlockPos pos, int flags, int maxUpdateDepth) { if (newState != state) { if (newState.isAir()) { - if (!world.isClientSide()) { + //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.destroyBlock(pos, (flags & 32) == 0, (Entity) null, maxUpdateDepth); - } + //} // Plazma - Remove persist 'isClientSide' flag } else { world.setBlock(pos, newState, flags & -33, maxUpdateDepth); } diff --git a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java b/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java index cbaa6fc04eb8d765e0dd8238f2b82eed196d13c7..4f869ab05d3f31e1b8e4faf7ade79b4499934197 100644 --- a/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BrewingStandBlock.java @@ -63,7 +63,7 @@ public class BrewingStandBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.BREWING_STAND, BrewingStandBlockEntity::serverTick); + return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.BREWING_STAND, BrewingStandBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override @@ -73,7 +73,7 @@ public class BrewingStandBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide && world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) instanceof BrewingStandBlockEntity brewingStandBlockEntity && player.openMenu(brewingStandBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.INTERACT_WITH_BREWINGSTAND); } diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java index c65016cba376a41c267fb4b6499ec0a263851558..0e9e4a5a6666b6536411fbebc45c2a174c02d7c2 100644 --- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java @@ -52,7 +52,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup { BlockState blockState = world.getBlockState(pos.above()); if (blockState.isAir()) { entity.onAboveBubbleCol(state.getValue(DRAG_DOWN)); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag ServerLevel serverLevel = (ServerLevel)world; for (int i = 0; i < 2; i++) { @@ -79,7 +79,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup { 0.2 ); } - } + //} // Plazma - Remove persist 'isClientSide' flag } else { entity.onInsideBubbleColumn(state.getValue(DRAG_DOWN)); } diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java index 061a8f8b58d9fa7959333e2f59d3b7ee03cbf92d..bb2efe06e04d9628f4e1a159e668e48d4e44d704 100644 --- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java @@ -209,7 +209,7 @@ public class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock { @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide && this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) { + if (/*!world.isClientSide &&*/ this.type.canButtonBeActivatedByArrows() && !(Boolean) state.getValue(ButtonBlock.POWERED)) { // Plazma - Remove persist 'isClientSide' flag this.checkPressed(state, world, pos); } } diff --git a/src/main/java/net/minecraft/world/level/block/CakeBlock.java b/src/main/java/net/minecraft/world/level/block/CakeBlock.java index 3563a241c0b697dc0167cf7b1aa73fef7d1e7934..b25560f11a5004d122253c7c9b86e2a4967890c7 100644 --- a/src/main/java/net/minecraft/world/level/block/CakeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CakeBlock.java @@ -86,6 +86,7 @@ public class CakeBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { if (CakeBlock.eat(world, pos, state, player).consumesAction()) { return InteractionResult.SUCCESS; @@ -95,6 +96,7 @@ public class CakeBlock extends Block { return InteractionResult.CONSUME; } } + */ // Plazma - Remove persist 'isClientSide' flag return CakeBlock.eat(world, pos, state, player); } diff --git a/src/main/java/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java b/src/main/java/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java index ddd1504ed9516f8f247cd63c42d5d1db0c01ce67..38fee8cda4b95a5bb9dd02ca6eca776c53bda43c 100644 --- a/src/main/java/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java @@ -41,13 +41,13 @@ public class CalibratedSculkSensorBlock extends SculkSensorBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return !world.isClientSide - ? createTickerHelper( + return /*!world.isClientSide // Plazma - Remove persist 'isClientSide' flag + ?*/ createTickerHelper( // Plazma - Remove persist 'isClientSide' flag type, BlockEntityType.CALIBRATED_SCULK_SENSOR, (worldx, pos, statex, blockEntity) -> VibrationSystem.Ticker.tick(worldx, blockEntity.getVibrationData(), blockEntity.getVibrationUser()) - ) - : null; + ); // Plazma - Remove persist 'isClientSide' flag + //: null; // Plazma - Remove persist 'isClientSide' flag } @Nullable diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java index 2ee2b1485f848ac5270bc3f7e1e5b1bc3029b0bb..0e6dafeef9bc405aaa6150ffbf41a8f33b174777 100644 --- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java @@ -183,11 +183,13 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB } public static void dowse(@Nullable Entity entity, LevelAccessor world, BlockPos pos, BlockState state) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide()) { for (int i = 0; i < 20; ++i) { CampfireBlock.makeParticles((Level) world, pos, (Boolean) state.getValue(CampfireBlock.SIGNAL_FIRE), true); } } + */ // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); @@ -204,9 +206,9 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB boolean flag = (Boolean) state.getValue(CampfireBlock.LIT); if (flag) { - if (!world.isClientSide()) { + //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.playSound((Player) null, pos, SoundEvents.GENERIC_EXTINGUISH_FIRE, SoundSource.BLOCKS, 1.0F, 1.0F); - } + //} // Plazma - Remove persist 'isClientSide' flag CampfireBlock.dowse((Entity) null, world, pos, state); } diff --git a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java index 9e7066ec9fa5a0a852f6e38052887a47be98cb55..06006f5a55e0543d06a99cbeb1a6b6360f5c1dde 100644 --- a/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CartographyTableBlock.java @@ -31,11 +31,11 @@ public class CartographyTableBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_CARTOGRAPHY_TABLE); } // Paper - Fix InventoryOpenEvent cancellation - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java index 663eb96b8227f000448957b5d8ea13ca78cee329..7f79265f30cadca3a7ffc8d6793b7f3f37f4bb76 100644 --- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java @@ -333,7 +333,7 @@ public class ChestBlock extends AbstractChestBlock implements @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? createTickerHelper(type, this.blockEntityType(), ChestBlockEntity::lidAnimateTick) : null; + return /*world.isClientSide ? createTickerHelper(type, this.blockEntityType(), ChestBlockEntity::lidAnimateTick) :*/ null; // Plazma - Remove persist 'isClientSide' flag } public static boolean isChestBlockedAt(LevelAccessor world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java b/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java index 5a95ecd7e94652d2af3eb42ee9cf61913fb95a69..dd90935c1e6bc2904f84cfa0ef04829c417cb121 100644 --- a/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java @@ -145,16 +145,16 @@ public class ChiseledBookShelfBlock extends BaseEntityBlock { } private static void addBook(Level world, BlockPos pos, Player player, ChiseledBookShelfBlockEntity blockEntity, ItemStack stack, int slot) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.ITEM_USED.get(stack.getItem())); SoundEvent soundEvent = stack.is(Items.ENCHANTED_BOOK) ? SoundEvents.CHISELED_BOOKSHELF_INSERT_ENCHANTED : SoundEvents.CHISELED_BOOKSHELF_INSERT; blockEntity.setItem(slot, stack.consumeAndReturn(1, player)); world.playSound(null, pos, soundEvent, SoundSource.BLOCKS, 1.0F, 1.0F); - } + //} // Plazma - Remove persist 'isClientSide' flag } private static void removeBook(Level world, BlockPos pos, Player player, ChiseledBookShelfBlockEntity blockEntity, int slot) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag ItemStack itemStack = blockEntity.removeItem(slot, 1); SoundEvent soundEvent = itemStack.is(Items.ENCHANTED_BOOK) ? SoundEvents.CHISELED_BOOKSHELF_PICKUP_ENCHANTED @@ -165,7 +165,7 @@ public class ChiseledBookShelfBlock extends BaseEntityBlock { } world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Nullable @@ -230,12 +230,14 @@ public class ChiseledBookShelfBlock extends BaseEntityBlock { @Override protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide()) { return 0; } else { + */ // Plazma - Remove persist 'isClientSide' flag return world.getBlockEntity(pos) instanceof ChiseledBookShelfBlockEntity chiseledBookShelfBlockEntity ? chiseledBookShelfBlockEntity.getLastInteractedSlot() + 1 : 0; - } + //} // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java index fb5777b6a729a465c2482c5f89ced2bc79b425bc..1ebc28e28137431b11b6e7d9b305019a9d6a5f81 100644 --- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java @@ -66,7 +66,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof CommandBlockEntity) { @@ -75,7 +75,7 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { this.setPoweredAndUpdate(world, pos, tileentitycommand, world.hasNeighborSignal(pos)); } - } + //} // Plazma - Remove persist 'isClientSide' flag } private void setPoweredAndUpdate(Level world, BlockPos pos, CommandBlockEntity blockEntity, boolean powered) { diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java index ed3a310d56a0cca8c4c11c3768ac2056cd11edea..f5b498bf68d351e42f5db5ae28aab4923847e3a5 100644 --- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java @@ -271,7 +271,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { // Purpur start - sneak to bulk process composter private static @Nullable BlockState process(int level, Player player, BlockState state, Level world, BlockPos pos, ItemStack stack) { - if (level < 7 && !world.isClientSide) { + if (level < 7 /*&& !world.isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = ComposterBlock.addItem(player, state, world, pos, stack); // Paper start - handle cancelled events if (iblockdata1 == null) { @@ -334,13 +334,13 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { } } // CraftBukkit end - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag Vec3 vec3d = Vec3.atLowerCornerWithOffset(pos, 0.5D, 1.01D, 0.5D).offsetRandom(world.random, 0.7F); ItemEntity entityitem = new ItemEntity(world, vec3d.x(), vec3d.y(), vec3d.z(), new ItemStack(Items.BONE_MEAL)); entityitem.setDefaultPickUpDelay(); world.addFreshEntity(entityitem); - } + //} // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = ComposterBlock.empty(user, state, world, pos); diff --git a/src/main/java/net/minecraft/world/level/block/ConduitBlock.java b/src/main/java/net/minecraft/world/level/block/ConduitBlock.java index 71798bea02c49a0dc0a0b330370b956e8d3f4608..98b00c05c340e76580c0d42ed4146f94d4fda2cf 100644 --- a/src/main/java/net/minecraft/world/level/block/ConduitBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ConduitBlock.java @@ -55,7 +55,7 @@ public class ConduitBlock extends BaseEntityBlock implements SimpleWaterloggedBl @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, BlockEntityType.CONDUIT, world.isClientSide ? ConduitBlockEntity::clientTick : ConduitBlockEntity::serverTick); + return createTickerHelper(type, BlockEntityType.CONDUIT, /*world.isClientSide ? ConduitBlockEntity::clientTick :*/ ConduitBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java index 0e609b1e3abd50b415d8376dc550375a8a0251b6..4942f6e95e9c44cb441d68e819f7aca93908660a 100644 --- a/src/main/java/net/minecraft/world/level/block/CrafterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CrafterBlock.java @@ -109,7 +109,7 @@ public class CrafterBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.CRAFTER, CrafterBlockEntity::serverTick); + return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.CRAFTER, CrafterBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } private void setBlockEntityTriggered(@Nullable BlockEntity blockEntity, boolean triggered) { @@ -170,7 +170,7 @@ public class CrafterBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof CrafterBlockEntity) { @@ -178,7 +178,7 @@ public class CrafterBlock extends BaseEntityBlock { player.openMenu(crafterblockentity); } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java index 6a2123cd808fa79f3cdb1cb56632d29bfe99058d..55e4863038b958eda589d0c6e2ea1db0694377aa 100644 --- a/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CraftingTableBlock.java @@ -30,11 +30,11 @@ public class CraftingTableBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_CRAFTING_TABLE); } // Paper - Fix InventoryOpenEvent cancellation - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/CreakingHeartBlock.java b/src/main/java/net/minecraft/world/level/block/CreakingHeartBlock.java index b0bf44dcb81e6c63b9eac45ced9906bb231ea07b..4d03e6a8b4582b1fecc81e88ee11829bb4d46541 100644 --- a/src/main/java/net/minecraft/world/level/block/CreakingHeartBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CreakingHeartBlock.java @@ -48,13 +48,15 @@ public class CreakingHeartBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return null; } else { + */ // Plazma - Remove persist 'isClientSide' flag return state.getValue(CREAKING) != CreakingHeartBlock.CreakingHeartState.DISABLED ? createTickerHelper(type, BlockEntityType.CREAKING_HEART, CreakingHeartBlockEntity::serverTick) : null; - } + //} // Plazma - Remove persist 'isClientSide' flag } public static boolean canSummonCreaking(Level world) { diff --git a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java index 7fd7f20d524fa980ed8ff8e0ca8adb9af203ccda..8be7464b07d91cae1336f182bc18e33cb9301409 100644 --- a/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DaylightDetectorBlock.java @@ -85,13 +85,13 @@ public class DaylightDetectorBlock extends BaseEntityBlock { if (!player.mayBuild()) { return super.useWithoutItem(state, world, pos, player, hit); } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata1 = (BlockState) state.cycle(DaylightDetectorBlock.INVERTED); world.setBlock(pos, iblockdata1, 2); world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, iblockdata1)); DaylightDetectorBlock.updateSignalStrength(iblockdata1, world, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @@ -115,7 +115,7 @@ public class DaylightDetectorBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return !world.isClientSide && world.dimensionType().hasSkyLight() ? createTickerHelper(type, BlockEntityType.DAYLIGHT_DETECTOR, DaylightDetectorBlock::tickEntity) : null; + return /*!world.isClientSide &&*/ world.dimensionType().hasSkyLight() ? createTickerHelper(type, BlockEntityType.DAYLIGHT_DETECTOR, DaylightDetectorBlock::tickEntity) : null; // Plazma - Remove persist 'isClientSide' flag } private static void tickEntity(Level world, BlockPos pos, BlockState state, DaylightDetectorBlockEntity blockEntity) { diff --git a/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java b/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java index 3ec6ed1e9ba25165a7deb2f767b8d064d1f89d5f..bbc52c7187cf313a0152aa0359954f50d411b274 100644 --- a/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DecoratedPotBlock.java @@ -99,9 +99,11 @@ public class DecoratedPotBlock extends BaseEntityBlock implements SimpleWaterlog BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof DecoratedPotBlockEntity decoratedpotblockentity) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return InteractionResult.SUCCESS; } else { + */ // Plazma - Remove persist 'isClientSide' flag ItemStack itemstack1 = decoratedpotblockentity.getTheItem(); if (!stack.isEmpty() && (itemstack1.isEmpty() || ItemStack.isSameItemSameComponents(itemstack1, stack) && itemstack1.getCount() < itemstack1.getMaxStackSize())) { @@ -131,7 +133,7 @@ public class DecoratedPotBlock extends BaseEntityBlock implements SimpleWaterlog } else { return InteractionResult.TRY_WITH_EMPTY_HAND; } - } + //} // Plazma - Remove persist 'isClientSide' flag } else { return InteractionResult.PASS; } diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java index fa1c4defd0d4e4cd888eb26eed131539d0ed573f..cf8b8eaed8932d53ddafae24148d20013ebd784e 100644 --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java @@ -53,11 +53,11 @@ public class DetectorRailBlock extends BaseRailBlock { @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) { this.checkPressed(world, pos, state); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java index 5a6c153fa2873aecba0d0d02be2cc2a514f445e3..a6af04d32e69c4a7fcb4d12f98fb12abefa3b9b8 100644 --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -74,7 +74,7 @@ public class DispenserBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof DispenserBlockEntity) { @@ -84,7 +84,7 @@ public class DispenserBlock extends BaseEntityBlock { player.awardStat(tileentitydispenser instanceof DropperBlockEntity ? Stats.INSPECT_DROPPER : Stats.INSPECT_DISPENSER); } // Paper - Fix InventoryOpenEvent cancellation } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/DoorBlock.java b/src/main/java/net/minecraft/world/level/block/DoorBlock.java index daf865c20cc193a12db0d98e3c0472eefdf635c2..c5472944127e0179a647cac2f8748e917b545ead 100644 --- a/src/main/java/net/minecraft/world/level/block/DoorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DoorBlock.java @@ -114,7 +114,7 @@ public class DoorBlock extends Block { @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide && (player.isCreative() || !player.hasCorrectToolForDrops(state))) { + if (/*!world.isClientSide &&*/ (player.isCreative() || !player.hasCorrectToolForDrops(state))) { // Plazma - Remove persist 'isClientSide' flag DoublePlantBlock.preventDropFromBottomPart(world, pos, state, player); } diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java index 4fe83bd0f355549847b66afb7e61f6f2a6d97016..47b1f716e7a130402cb74229afa65893278c8a0c 100644 --- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java @@ -86,13 +86,13 @@ public class DoublePlantBlock extends BushBlock { @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.isCreative()) { DoublePlantBlock.preventDropFromBottomPart(world, pos, state, player); } else { dropResources(state, world, pos, (BlockEntity) null, player, player.getMainHandItem()); } - } + //} // Plazma - Remove persist 'isClientSide' flag return super.playerWillDestroy(world, pos, state, player); } diff --git a/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java b/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java index b6799db00e157892dd4339a01d2ca36092c8e491..74a42da0cf747670761d7f19484fa00471130866 100644 --- a/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DragonEggBlock.java @@ -66,6 +66,7 @@ public class DragonEggBlock extends FallingBlock { blockposition1 = new BlockPos(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ()); // CraftBukkit end + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { for (int j = 0; j < 128; ++j) { double d0 = world.random.nextDouble(); @@ -79,9 +80,10 @@ public class DragonEggBlock extends FallingBlock { world.addParticle(ParticleTypes.PORTAL, d1, d2, d3, (double) f, (double) f1, (double) f2); } } else { + */ // Plazma - Remove persist 'isClientSide' flag world.setBlock(blockposition1, state, 2); world.removeBlock(pos, false); - } + //} // Plazma - Remove persist 'isClientSide' flag return; } diff --git a/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java b/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java index ce6a9e15ae0114623e79b5d8c244c2c490a3f74e..0075b481aa17c1c5ee5b591fc0efe1745d815735 100644 --- a/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnchantingTableBlock.java @@ -93,14 +93,14 @@ public class EnchantingTableBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? createTickerHelper(type, BlockEntityType.ENCHANTING_TABLE, EnchantingTableBlockEntity::bookAnimationTick) : null; + return /*world.isClientSide ? createTickerHelper(type, BlockEntityType.ENCHANTING_TABLE, EnchantingTableBlockEntity::bookAnimationTick) :*/ null; // Plazma - Remove persist 'isClientSide' flag } @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag player.openMenu(state.getMenuProvider(world, pos)); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java index abb75f9389167a1f51a2c50831664d50181749de..fdebf1f4ae72001c24b20dd973ca7dd54e30df3d 100644 --- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java @@ -47,7 +47,7 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, BlockEntityType.END_GATEWAY, world.isClientSide ? TheEndGatewayBlockEntity::beamAnimationTick : TheEndGatewayBlockEntity::portalTick); + return createTickerHelper(type, BlockEntityType.END_GATEWAY, /*world.isClientSide ? TheEndGatewayBlockEntity::beamAnimationTick :*/ TheEndGatewayBlockEntity::portalTick); // Plazma - Remove persist 'isClientSide' flag } @Override @@ -100,8 +100,8 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { // Paper end - call EntityPortalEnterEvent BlockEntity tileentity = world.getBlockEntity(pos); - if (!world.isClientSide && tileentity instanceof TheEndGatewayBlockEntity) { - TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; + if (/*!world.isClientSide &&*/ tileentity instanceof TheEndGatewayBlockEntity tileentity) { // Plazma - Remove persist 'isClientSide' flag + minor improvement + //TheEndGatewayBlockEntity tileentityendgateway = (TheEndGatewayBlockEntity) tileentity; // Plazma - Remove persist 'isClientSide' flag + minor improvement if (!tileentityendgateway.isCoolingDown()) { // Purpur start diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java index 2dffc3990d9ae3d595d923239885e3a7d8ec04f3..487197df3a9d24f03a21f5fddd5f87d393646596 100644 --- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java @@ -82,7 +82,7 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal { world.getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) return; // Paper - make cancellable // CraftBukkit end - if (!world.isClientSide && world.dimension() == Level.END && entity instanceof ServerPlayer) { + if (/*!world.isClientSide &&*/ world.dimension() == Level.END && entity instanceof ServerPlayer) { // Plazma - Remove persist 'isClientSide' flag ServerPlayer entityplayer = (ServerPlayer) entity; if (world.paperConfig().misc.disableEndCredits) entityplayer.seenCredits = true; // Paper - Option to disable end credits diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java index 6ad4aa371607ab92616626285a7e71757c76a3db..4834e3e9990a9be1a9441191c42f238dd024dfdf 100644 --- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java @@ -141,7 +141,7 @@ public class EnderChestBlock extends AbstractChestBlock i @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? createTickerHelper(type, BlockEntityType.ENDER_CHEST, EnderChestBlockEntity::lidAnimateTick) : null; + return /*world.isClientSide ? createTickerHelper(type, BlockEntityType.ENDER_CHEST, EnderChestBlockEntity::lidAnimateTick) :*/ null; // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/FenceBlock.java b/src/main/java/net/minecraft/world/level/block/FenceBlock.java index 86e8153012673f2b8ec0306b5bd4bdc8e39cd226..c6f44247622bdc5633218629fa091dc59bb0cefe 100644 --- a/src/main/java/net/minecraft/world/level/block/FenceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FenceBlock.java @@ -74,7 +74,7 @@ public class FenceBlock extends CrossCollisionBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - return (InteractionResult)(!world.isClientSide() ? LeadItem.bindPlayerMobs(player, world, pos) : InteractionResult.PASS); + return (InteractionResult)(/*!world.isClientSide() ?*/ LeadItem.bindPlayerMobs(player, world, pos)); //: InteractionResult.PASS); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java index 5201a11503362c2d43a9eee028613137ac9ae451..f664f78058f6045db26baa96666aceae41764c5c 100644 --- a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java @@ -171,7 +171,7 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag1 = world.hasNeighborSignal(pos); // CraftBukkit start boolean oldPowered = state.getValue(FenceGateBlock.POWERED); @@ -193,7 +193,7 @@ public class FenceGateBlock extends HorizontalDirectionalBlock { } } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java b/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java index 59c000612bbf7beb7208af48001d3b1e5111ebd4..4256ad5b20b63b1792cde46c20e63451ec41faad 100644 --- a/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/GrindstoneBlock.java @@ -156,11 +156,11 @@ public class GrindstoneBlock extends FaceAttachedHorizontalDirectionalBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_GRINDSTONE); } // Paper - Fix InventoryOpenEvent cancellation - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java index 5c360c6768582c1a35431739613e9b406875cc21..3536d74b4d422e6548d73bcba6d943684c5462b5 100644 --- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java @@ -49,9 +49,9 @@ public class HoneyBlock extends HalfTransparentBlock { @Override public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { entity.playSound(SoundEvents.HONEY_BLOCK_SLIDE, 1.0F, 1.0F); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag world.broadcastEntityEvent(entity, (byte)54); - } + //} // Plazma - Remove persist 'isClientSide' flag if (entity.causeFallDamage(fallDistance, 0.2F, world.damageSources().fall())) { entity.playSound(this.soundType.getFallSound(), this.soundType.getVolume() * 0.5F, this.soundType.getPitch() * 0.75F); @@ -117,12 +117,13 @@ public class HoneyBlock extends HalfTransparentBlock { entity.playSound(SoundEvents.HONEY_BLOCK_SLIDE, 1.0F, 1.0F); } - if (!world.isClientSide && world.random.nextInt(5) == 0) { + if (/*!world.isClientSide &&*/ world.random.nextInt(5) == 0) { // Plazma - Remove persist 'isClientSide' flag world.broadcastEntityEvent(entity, (byte)53); } } } + /* // Plazma - Remove persist 'isClientSide' flag public static void showSlideParticles(Entity entity) { showParticles(entity, 5); } @@ -141,4 +142,5 @@ public class HoneyBlock extends HalfTransparentBlock { } } } + */ // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java index 005a2a66a6e8a492acfa7ba91117884cda08562d..39ac1d40b69ba3909cd9b26f62f3b4e872d3e612 100644 --- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java @@ -113,7 +113,7 @@ public class HopperBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.HOPPER, HopperBlockEntity::pushItemsTick); + return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.HOPPER, HopperBlockEntity::pushItemsTick); // Plazma - Remove persist 'isClientSide' flag } @Override @@ -125,7 +125,7 @@ public class HopperBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide && world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity && player.openMenu(hopperBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation + if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) instanceof HopperBlockEntity hopperBlockEntity && player.openMenu(hopperBlockEntity).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation // Plazma - Remove persist 'isClientSide' flag player.awardStat(Stats.INSPECT_HOPPER); } diff --git a/src/main/java/net/minecraft/world/level/block/LecternBlock.java b/src/main/java/net/minecraft/world/level/block/LecternBlock.java index 70f2e6278e2d970245ca5b46fbd9ffae4727b47b..d8eec65e1a40159621f7069f911aa17531271ddd 100644 --- a/src/main/java/net/minecraft/world/level/block/LecternBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LecternBlock.java @@ -90,7 +90,7 @@ public class LecternBlock extends BaseEntityBlock { Player entityhuman = ctx.getPlayer(); boolean flag = false; - if (!world.isClientSide && entityhuman != null && entityhuman.canUseGameMasterBlocks()) { + if (/*!world.isClientSide &&*/ entityhuman != null && entityhuman.canUseGameMasterBlocks()) { // Plazma - Remove persist 'isClientSide' flag CustomData customdata = (CustomData) itemstack.getOrDefault(DataComponents.BLOCK_ENTITY_DATA, CustomData.EMPTY); if (customdata.contains("Book")) { @@ -144,9 +144,9 @@ public class LecternBlock extends BaseEntityBlock { public static boolean tryPlaceBook(@Nullable LivingEntity user, Level world, BlockPos pos, BlockState state, ItemStack stack) { if (!(Boolean) state.getValue(LecternBlock.HAS_BOOK)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag LecternBlock.placeBook(user, world, pos, state, stack); - } + //} // Plazma - Remove persist 'isClientSide' flag return true; } else { @@ -296,9 +296,9 @@ public class LecternBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { if ((Boolean) state.getValue(LecternBlock.HAS_BOOK)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.openScreen(world, pos, player); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/net/minecraft/world/level/block/LeverBlock.java b/src/main/java/net/minecraft/world/level/block/LeverBlock.java index 1e7fec5c89c38943d13150a527b5acd239c21901..bd372e8af221783ffdbdbea4eb594c25674cc5db 100644 --- a/src/main/java/net/minecraft/world/level/block/LeverBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LeverBlock.java @@ -96,6 +96,7 @@ public class LeverBlock extends FaceAttachedHorizontalDirectionalBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { BlockState iblockdata1 = (BlockState) state.cycle(LeverBlock.POWERED); @@ -103,6 +104,7 @@ public class LeverBlock extends FaceAttachedHorizontalDirectionalBlock { LeverBlock.makeParticle(iblockdata1, world, pos, 1.0F); } } else { + */ // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start - Interact Lever boolean powered = state.getValue(LeverBlock.POWERED); // Old powered state org.bukkit.block.Block block = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); @@ -118,7 +120,7 @@ public class LeverBlock extends FaceAttachedHorizontalDirectionalBlock { // CraftBukkit end this.pull(state, world, pos, (Player) null); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java index fec6bf38f080039436ba80d5528857ba4787bf4e..a943ee28712a65183e2c6e9cc3debaa169e8ffdc 100644 --- a/src/main/java/net/minecraft/world/level/block/LightBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java @@ -60,7 +60,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide && player.canUseGameMasterBlocks()) { + if (/*!world.isClientSide &&*/ player.canUseGameMasterBlocks()) { // Plazma - Remove persist 'isClientSide' flag world.setBlock(pos, state.cycle(LEVEL), 2); return InteractionResult.SUCCESS_SERVER; } else { diff --git a/src/main/java/net/minecraft/world/level/block/LoomBlock.java b/src/main/java/net/minecraft/world/level/block/LoomBlock.java index 1b57f8cf3f4f27f6a76fec82a542ec1c582470c9..c315b61b2f077f62d70779465474d60b6af2ca89 100644 --- a/src/main/java/net/minecraft/world/level/block/LoomBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LoomBlock.java @@ -32,11 +32,11 @@ public class LoomBlock extends HorizontalDirectionalBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_LOOM); } // Paper - Fix InventoryOpenEvent cancellation - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/MossyCarpetBlock.java b/src/main/java/net/minecraft/world/level/block/MossyCarpetBlock.java index 4f432a153d2f3230970cc6df2bda7e633e81cd6d..30d4feda19ef301aebba25b860e338bcb219d6b9 100644 --- a/src/main/java/net/minecraft/world/level/block/MossyCarpetBlock.java +++ b/src/main/java/net/minecraft/world/level/block/MossyCarpetBlock.java @@ -213,13 +213,13 @@ public class MossyCarpetBlock extends Block implements BonemealableBlock { @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag RandomSource randomSource = world.getRandom(); BlockState blockState = createTopperWithSideChance(world, pos, randomSource::nextBoolean); if (!blockState.isAir()) { world.setBlock(pos.above(), blockState, 3); } - } + //} // Plazma - Remove persist 'isClientSide' flag } private static BlockState createTopperWithSideChance(BlockGetter world, BlockPos pos, BooleanSupplier booleanSupplier) { diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java index f9015d4e478efeec8a796b7a897638f76064db20..bbb9be690d1718022902aa214bdb666ca74b9e2b 100644 --- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java @@ -118,22 +118,22 @@ public class NoteBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) state = (BlockState) state.cycle(NoteBlock.NOTE); // Paper - prevent noteblock note from updating world.setBlock(pos, state, 3); this.playNote(player, state, world, pos); player.awardStat(Stats.TUNE_NOTEBLOCK); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } @Override protected void attack(BlockState state, Level world, BlockPos pos, Player player) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.playNote(player, state, world, pos); player.awardStat(Stats.PLAY_NOTEBLOCK); - } + //} // Plazma - Remove persist 'isClientSide' flag } public static float getPitchFromNote(int note) { diff --git a/src/main/java/net/minecraft/world/level/block/ObserverBlock.java b/src/main/java/net/minecraft/world/level/block/ObserverBlock.java index 26cb9990b91991e0a2eadc2dcbbf229e2e88fb2d..911bf8081841cc9fbd9289c0b7618594c9bc9db2 100644 --- a/src/main/java/net/minecraft/world/level/block/ObserverBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ObserverBlock.java @@ -83,7 +83,7 @@ public class ObserverBlock extends DirectionalBlock { } private void startSignal(LevelReader world, ScheduledTickAccess tickView, BlockPos pos) { - if (!world.isClientSide() && !tickView.getBlockTicks().hasScheduledTick(pos, this)) { + if (/*!world.isClientSide() &&*/ !tickView.getBlockTicks().hasScheduledTick(pos, this)) { // Plazma - Remove persist 'isClientSide' flag tickView.scheduleTick(pos, (Block) this, 2); } @@ -116,7 +116,7 @@ public class ObserverBlock extends DirectionalBlock { @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (!state.is(oldState.getBlock())) { - if (!world.isClientSide() && (Boolean) state.getValue(ObserverBlock.POWERED) && !world.getBlockTicks().hasScheduledTick(pos, this)) { + if (/*!world.isClientSide() &&*/ (Boolean) state.getValue(ObserverBlock.POWERED) && !world.getBlockTicks().hasScheduledTick(pos, this)) { // Plazma - Remove persist 'isClientSide' flag BlockState iblockdata2 = (BlockState) state.setValue(ObserverBlock.POWERED, false); world.setBlock(pos, iblockdata2, 18); @@ -129,7 +129,7 @@ public class ObserverBlock extends DirectionalBlock { @Override protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { if (!state.is(newState.getBlock())) { - if (!world.isClientSide && (Boolean) state.getValue(ObserverBlock.POWERED) && world.getBlockTicks().hasScheduledTick(pos, this)) { + if (/*!world.isClientSide &&*/ (Boolean) state.getValue(ObserverBlock.POWERED) && world.getBlockTicks().hasScheduledTick(pos, this)) { // Plazma - Remove persist 'isClientSide' flag this.updateNeighborsInFront(world, pos, (BlockState) state.setValue(ObserverBlock.POWERED, false)); } diff --git a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java index fd5489993dca0f940da69e9163f78e5c2e6ee063..cd049a28ff2d4f748b154feb99b64e45af25b406 100644 --- a/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PointedDripstoneBlock.java @@ -129,7 +129,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate @Override protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = hit.getBlockPos(); if (world instanceof ServerLevel) { @@ -145,7 +145,7 @@ public class PointedDripstoneBlock extends Block implements Fallable, SimpleWate } } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java index 3760c3c9ab45d7152661edd5a48893e1b583fb95..b946858d3ccc38972d86608e020302ac05b053a8 100644 --- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java @@ -62,6 +62,7 @@ public class PowderSnowBlock extends Block implements BucketPickup { if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent if (!(entity instanceof LivingEntity) || entity.getInBlockState().is((Block) this)) { entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D)); + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { RandomSource randomsource = world.getRandom(); boolean flag = entity.xOld != entity.getX() || entity.zOld != entity.getZ(); @@ -70,6 +71,7 @@ public class PowderSnowBlock extends Block implements BucketPickup { world.addParticle(ParticleTypes.SNOWFLAKE, entity.getX(), (double) (pos.getY() + 1), entity.getZ(), (double) (Mth.randomBetween(randomsource, -1.0F, 1.0F) * 0.083333336F), 0.05000000074505806D, (double) (Mth.randomBetween(randomsource, -1.0F, 1.0F) * 0.083333336F)); } } + */ // Plazma - Remove persist 'isClientSide' flag } entity.setIsInPowderSnow(true); @@ -131,9 +133,9 @@ public class PowderSnowBlock extends Block implements BucketPickup { @Override public ItemStack pickupBlock(@Nullable Player player, LevelAccessor world, BlockPos pos, BlockState state) { world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); - if (!world.isClientSide()) { + //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.levelEvent(2001, pos, Block.getId(state)); - } + //} // Plazma - Remove persist 'isClientSide' flag return new ItemStack(Items.POWDER_SNOW_BUCKET); } diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java index 2b43c77d5aa609d4716df827cefcf008dfd13a06..9f902c34e7a4d621cdb4af47f9a83bc217803bd1 100644 --- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java @@ -35,8 +35,8 @@ public class PumpkinBlock extends Block { protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (!stack.is(Items.SHEARS)) { return super.useItemOn(stack, state, world, pos, player, hand, hit); - } else if (world.isClientSide) { - return InteractionResult.SUCCESS; + //} else if (world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag + // return InteractionResult.SUCCESS; // Plazma - Remove persist 'isClientSide' flag } else { // Paper start - Add PlayerShearBlockEvent io.papermc.paper.event.block.PlayerShearBlockEvent event = new io.papermc.paper.event.block.PlayerShearBlockEvent((org.bukkit.entity.Player) player.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand), new java.util.ArrayList<>()); diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java index e9c7f5d2c7072568e0d451f43125816e27138872..2fc7bdc0362f2f5a21e3459375d8d06b3aeabcbb 100644 --- a/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java @@ -70,11 +70,13 @@ public class RedStoneOreBlock extends Block { @Override protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { RedStoneOreBlock.spawnParticles(world, pos); } else { + */ // Plazma - Remove persist 'isClientSide' flag RedStoneOreBlock.interact(state, world, pos, player); // CraftBukkit - add entityhuman - } + //} // Plazma - Remove persist 'isClientSide' flag return (InteractionResult) (stack.getItem() instanceof BlockItem && (new BlockPlaceContext(player, hand, stack, hit)).canPlace() ? InteractionResult.PASS : InteractionResult.SUCCESS); } diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java index 21f2c61023fadcce30452a02f067cd5d87e5d8dc..1250126ce9ba5d5aec30d855c7e11bf158d57c1c 100644 --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java @@ -371,7 +371,7 @@ public class RedStoneWireBlock extends Block { @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - if (!oldState.is(state.getBlock()) && !world.isClientSide) { + if (!oldState.is(state.getBlock()) /*&& !world.isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag // Paper start - optimize redstone - replace call to updatePowerStrength if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { world.getWireHandler().onWireAdded(pos, state); // Alternate Current @@ -392,7 +392,7 @@ public class RedStoneWireBlock extends Block { protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { if (!moved && !state.is(newState.getBlock())) { super.onRemove(state, world, pos, newState, moved); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag for (Direction direction : Direction.values()) { world.updateNeighborsAt(pos.relative(direction), this); } @@ -404,7 +404,7 @@ public class RedStoneWireBlock extends Block { this.updateSurroundingRedstone(world, pos, state, null, false); // Vanilla/Eigencraft } this.updateNeighborsOfNeighboringWires(world, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag } } @@ -425,7 +425,7 @@ public class RedStoneWireBlock extends Block { @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag // Paper start - optimize redstone (Alternate Current) // Alternate Current handles breaking of redstone wires in the WireHandler. if (world.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { @@ -440,7 +440,7 @@ public class RedStoneWireBlock extends Block { world.removeBlock(pos, false); } } - } + //} // Plazma - Remove persist 'isClientSide' flag } private static boolean useExperimentalEvaluator(Level world) { diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneLampBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneLampBlock.java index ebb2aca86930a907a43445cfbc878e3cafaf6632..40392a4c6e975fce9dbb71e28d16a865f711a26d 100644 --- a/src/main/java/net/minecraft/world/level/block/RedstoneLampBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedstoneLampBlock.java @@ -38,7 +38,7 @@ public class RedstoneLampBlock extends Block { @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag1 = (Boolean) state.getValue(RedstoneLampBlock.LIT); if (flag1 != world.hasNeighborSignal(pos)) { @@ -54,7 +54,7 @@ public class RedstoneLampBlock extends Block { } } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/RepeaterBlock.java b/src/main/java/net/minecraft/world/level/block/RepeaterBlock.java index 007906dddcf4ae92db28aa3e22a87264a91a9bcb..fea77c0b95703cc38b203cd8a11121ed09673db0 100644 --- a/src/main/java/net/minecraft/world/level/block/RepeaterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RepeaterBlock.java @@ -76,7 +76,7 @@ public class RepeaterBlock extends DiodeBlock { if (direction == Direction.DOWN && !this.canSurviveOn(world, neighborPos, neighborState)) { return Blocks.AIR.defaultBlockState(); } else { - return !world.isClientSide() && direction.getAxis() != state.getValue(FACING).getAxis() + return /*!world.isClientSide() &&*/ direction.getAxis() != state.getValue(FACING).getAxis() // Plazma - Remove persist 'isClientSide' flag ? state.setValue(LOCKED, Boolean.valueOf(this.isLocked(world, pos, state))) : super.updateShape(state, world, tickView, pos, direction, neighborPos, neighborState, random); } diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java index 2c5e394156dbf76107adb4913a094dfd4a598dd7..5f0037057f3ecf283d7acb662cf96f8212e5894a 100644 --- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java @@ -78,13 +78,13 @@ public class RespawnAnchorBlock extends Block { if ((Integer) state.getValue(RespawnAnchorBlock.CHARGE) == 0) { return InteractionResult.PASS; } else if (!RespawnAnchorBlock.canSetSpawn(world)) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.explode(state, world, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } else { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag ServerPlayer entityplayer = (ServerPlayer) player; if (entityplayer.getRespawnDimension() != world.dimension() || !pos.equals(entityplayer.getRespawnPosition())) { @@ -97,7 +97,7 @@ public class RespawnAnchorBlock extends Block { } // Paper end - Add PlayerSetSpawnEvent } - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.CONSUME; } diff --git a/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java b/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java index 2d3f425778302490dd3654d487cfa3cfed6fb9e8..0bc2a449f711f3c75858165af93588c56186a929 100644 --- a/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java @@ -79,9 +79,9 @@ public class ScaffoldingBlock extends Block implements SimpleWaterloggedBlock { @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag world.scheduleTick(pos, (Block) this, 1); - } + //} // Plazma - Remove persist 'isClientSide' flag } @@ -91,9 +91,9 @@ public class ScaffoldingBlock extends Block implements SimpleWaterloggedBlock { tickView.scheduleTick(pos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - if (!world.isClientSide()) { + //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag tickView.scheduleTick(pos, (Block) this, 1); - } + //} // Plazma - Remove persist 'isClientSide' flag return state; } diff --git a/src/main/java/net/minecraft/world/level/block/SculkCatalystBlock.java b/src/main/java/net/minecraft/world/level/block/SculkCatalystBlock.java index e0667753ce67d2bafebf4dbcc35337d4287d92f4..c94271279ac4ae40d7900abb8cf3897e55e89e55 100644 --- a/src/main/java/net/minecraft/world/level/block/SculkCatalystBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SculkCatalystBlock.java @@ -57,7 +57,7 @@ public class SculkCatalystBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return world.isClientSide ? null : createTickerHelper(type, BlockEntityType.SCULK_CATALYST, SculkCatalystBlockEntity::serverTick); + return /*world.isClientSide ? null :*/ createTickerHelper(type, BlockEntityType.SCULK_CATALYST, SculkCatalystBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java index 0ed449a188d98f87dbddd2d76009fed02a29ed25..b70fe3b96b0eac7733349f75c77b38438b7846a6 100644 --- a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java @@ -107,7 +107,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg @Override public void stepOn(Level world, BlockPos pos, BlockState state, Entity entity) { - if (!world.isClientSide() && SculkSensorBlock.canActivate(state) && entity.getType() != EntityType.WARDEN) { + if (/*!world.isClientSide() &&*/ SculkSensorBlock.canActivate(state) && entity.getType() != EntityType.WARDEN) { // Plazma - Remove persist 'isClientSide' flag // CraftBukkit start org.bukkit.event.Cancellable cancellable; if (entity instanceof Player) { @@ -140,7 +140,7 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - if (!world.isClientSide() && !state.is(oldState.getBlock())) { + if (/*!world.isClientSide() &&*/ !state.is(oldState.getBlock())) { // Plazma - Remove persist 'isClientSide' flag if ((Integer) state.getValue(SculkSensorBlock.POWER) > 0 && !world.getBlockTicks().hasScheduledTick(pos, this)) { world.setBlock(pos, (BlockState) state.setValue(SculkSensorBlock.POWER, 0), 18); } @@ -184,9 +184,9 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return !world.isClientSide ? createTickerHelper(type, BlockEntityType.SCULK_SENSOR, (world1, blockposition, iblockdata1, sculksensorblockentity) -> { + return /*!world.isClientSide ?*/ createTickerHelper(type, BlockEntityType.SCULK_SENSOR, (world1, blockposition, iblockdata1, sculksensorblockentity) -> { // Plazma - Remove persist 'isClientSide' flag VibrationSystem.Ticker.tick(world1, sculksensorblockentity.getVibrationData(), sculksensorblockentity.getVibrationUser()); - }) : null; + }); //: null; // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/SculkShriekerBlock.java b/src/main/java/net/minecraft/world/level/block/SculkShriekerBlock.java index e00fcea07e74de647c26ff9eb32bc682738c15b7..5b94f164b94c2434a946858c185f64ff9e26fa67 100644 --- a/src/main/java/net/minecraft/world/level/block/SculkShriekerBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SculkShriekerBlock.java @@ -162,8 +162,8 @@ public class SculkShriekerBlock extends BaseEntityBlock implements SimpleWaterlo @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return !world.isClientSide ? BaseEntityBlock.createTickerHelper(type, BlockEntityType.SCULK_SHRIEKER, (world1, blockposition, iblockdata1, sculkshriekerblockentity) -> { + return /*!world.isClientSide ?*/ BaseEntityBlock.createTickerHelper(type, BlockEntityType.SCULK_SHRIEKER, (world1, blockposition, iblockdata1, sculkshriekerblockentity) -> { // Plazma - Remove persist 'isClientSide' flag VibrationSystem.Ticker.tick(world1, sculkshriekerblockentity.getVibrationData(), sculkshriekerblockentity.getVibrationUser()); - }) : null; + }); //: null; // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java index 155c7240b1112729333e6968122568c707d8f66b..d2787c48f21442cf4d6937880157615ceda2d21e 100644 --- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java @@ -136,7 +136,7 @@ public class ShulkerBoxBlock extends BaseEntityBlock { public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof ShulkerBoxBlockEntity shulkerBoxBlockEntity) { - if (!world.isClientSide && player.isCreative() && !shulkerBoxBlockEntity.isEmpty()) { + if (/*!world.isClientSide &&*/ player.isCreative() && !shulkerBoxBlockEntity.isEmpty()) { // Plazma - Remove persist 'isClientSide' flag ItemStack itemStack = getColoredItemStack(this.getColor()); itemStack.applyComponents(blockEntity.collectComponents()); ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX() + 0.5, (double)pos.getY() + 0.5, (double)pos.getZ() + 0.5, itemStack); diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java index b212fe323f048dab40c0ccbb9327c9fc73b9e03a..308a9143a25828b749a545e22a2cb8a3c91eb7e2 100644 --- a/src/main/java/net/minecraft/world/level/block/SignBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java @@ -98,7 +98,7 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo SignApplicator signapplicator2 = signapplicator; boolean flag = signapplicator2 != null && player.mayBuild(); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (flag && !tileentitysign.isWaxed() && !this.otherPlayerIsEditingSign(player, tileentitysign)) { boolean flag1 = tileentitysign.isFacingFrontText(player); @@ -114,9 +114,11 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo } else { return InteractionResult.TRY_WITH_EMPTY_HAND; } + /* // Plazma - Remove persist 'isClientSide' flag } else { return !flag && !tileentitysign.isWaxed() ? InteractionResult.CONSUME : InteractionResult.SUCCESS; } + */ // Plazma - Remove persist 'isClientSide' flag } else { return InteractionResult.PASS; } @@ -127,9 +129,11 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo BlockEntity tileentity = world.getBlockEntity(pos); if (tileentity instanceof SignBlockEntity tileentitysign) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { Util.pauseInIde(new IllegalStateException("Expected to only call this on server")); } + */ // Plazma - Remove persist 'isClientSide' flag boolean flag = tileentitysign.isFacingFrontText(player); boolean flag1 = tileentitysign.executeClickCommandsIfPresent(player, world, pos, flag); diff --git a/src/main/java/net/minecraft/world/level/block/SimpleWaterloggedBlock.java b/src/main/java/net/minecraft/world/level/block/SimpleWaterloggedBlock.java index 581475cf6642447ed83dcc1bd9551995dbb10c55..0a5e2be4e249f92fd950b03c7de63ae1ecdc9220 100644 --- a/src/main/java/net/minecraft/world/level/block/SimpleWaterloggedBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SimpleWaterloggedBlock.java @@ -24,10 +24,10 @@ public interface SimpleWaterloggedBlock extends BucketPickup, LiquidBlockContain @Override default boolean placeLiquid(LevelAccessor world, BlockPos pos, BlockState state, FluidState fluidState) { if (!state.getValue(BlockStateProperties.WATERLOGGED) && fluidState.getType() == Fluids.WATER) { - if (!world.isClientSide()) { + //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag world.setBlock(pos, state.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(true)), 3); world.scheduleTick(pos, fluidState.getType(), fluidState.getType().getTickDelay(world)); - } + //} // Plazma - Remove persist 'isClientSide' flag return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/SmallDripleafBlock.java b/src/main/java/net/minecraft/world/level/block/SmallDripleafBlock.java index 62407b0f9fb11671b2d9c741d4ec17020528be2c..1e1cf238c9e91ae32f6fdda9756d6d34e538397d 100644 --- a/src/main/java/net/minecraft/world/level/block/SmallDripleafBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SmallDripleafBlock.java @@ -67,13 +67,13 @@ public class SmallDripleafBlock extends DoublePlantBlock implements Bonemealable @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - if (!world.isClientSide()) { + //if (!world.isClientSide()) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockPos = pos.above(); BlockState blockState = DoublePlantBlock.copyWaterloggedFrom( world, blockPos, this.defaultBlockState().setValue(HALF, DoubleBlockHalf.UPPER).setValue(FACING, state.getValue(FACING)) ); world.setBlock(blockPos, blockState, 3); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java b/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java index 43dc3d2c419a8b4a76de49a1e625076741a98c73..100a9cfb1548bc451ee16749f32747ab04244eca 100644 --- a/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SmithingTableBlock.java @@ -37,11 +37,11 @@ public class SmithingTableBlock extends CraftingTableBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_SMITHING_TABLE); } // Paper - Fix InventoryOpenEvent cancellation - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java index ec04fcc23c86d34a6dc1eaadda7f9d876f3d8ffe..ac52cdacf66dcf48213aaa327360c5a01886957b 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java @@ -101,7 +101,7 @@ public class SnifferEggBlock extends Block { @Override public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { boolean bl = hatchBoost(world, pos); - if (!world.isClientSide() && bl) { + if (/*!world.isClientSide() &&*/ bl) { // Plazma - Remove persist 'isClientSide' flag world.levelEvent(3009, pos, 0); } diff --git a/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java b/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java index 80ee7a6f010cc838625674007a3ea908f2f9dadd..2526e919fc60048502f0f57674faf8a34a1ef722 100644 --- a/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpawnerBlock.java @@ -39,7 +39,7 @@ public class SpawnerBlock extends BaseEntityBlock { @Nullable @Override public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { - return createTickerHelper(type, BlockEntityType.MOB_SPAWNER, world.isClientSide ? SpawnerBlockEntity::clientTick : SpawnerBlockEntity::serverTick); + return createTickerHelper(type, BlockEntityType.MOB_SPAWNER, /*world.isClientSide ? SpawnerBlockEntity::clientTick :*/ SpawnerBlockEntity::serverTick); // Plazma - Remove persist 'isClientSide' flag } // Purpur start diff --git a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java index 0bf6503819b02e5ba2c346d9d563a93f2946d89b..c9ecd5b5cdfd294dbe4e7c5fe81a67a194569748 100644 --- a/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java +++ b/src/main/java/net/minecraft/world/level/block/StonecutterBlock.java @@ -47,11 +47,11 @@ public class StonecutterBlock extends Block { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (player.openMenu(state.getMenuProvider(world, pos)).isPresent()) { // Paper - Fix InventoryOpenEvent cancellation player.awardStat(Stats.INTERACT_WITH_STONECUTTER); } // Paper - Fix InventoryOpenEvent cancellation - } + //} // Plazma - Remove persist 'isClientSide' flag return InteractionResult.SUCCESS; } diff --git a/src/main/java/net/minecraft/world/level/block/StructureBlock.java b/src/main/java/net/minecraft/world/level/block/StructureBlock.java index ec2ea748a164f47eb425efcd2ac0d43a23c2a9ca..ca4beb408306dc3bbc827361d024215830988d33 100644 --- a/src/main/java/net/minecraft/world/level/block/StructureBlock.java +++ b/src/main/java/net/minecraft/world/level/block/StructureBlock.java @@ -51,14 +51,14 @@ public class StructureBlock extends BaseEntityBlock implements GameMasterBlock { @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (placer != null) { BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof StructureBlockEntity) { ((StructureBlockEntity)blockEntity).createdBy(placer); } } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java index ee4eb863b6c02f2bcbb03ca413fc98811d409ac5..e4aff00085a8dca4d70015651eee89e182c770ac 100644 --- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java @@ -130,7 +130,7 @@ public class TargetBlock extends Block { @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - if (!world.isClientSide() && !state.is(oldState.getBlock())) { + if (/*!world.isClientSide() &&*/ !state.is(oldState.getBlock())) { // Plazma - Remove persist 'isClientSide' flag if (state.getValue(OUTPUT_POWER) > 0 && !world.getBlockTicks().hasScheduledTick(pos, this)) { world.setBlock(pos, state.setValue(OUTPUT_POWER, Integer.valueOf(0)), 18); } diff --git a/src/main/java/net/minecraft/world/level/block/TntBlock.java b/src/main/java/net/minecraft/world/level/block/TntBlock.java index 2cbe2053dd5d0bcdcd89de69762c77b400b8697a..b0ffae3d3c21c9c8118f9eafae30ed42a8a75033 100644 --- a/src/main/java/net/minecraft/world/level/block/TntBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TntBlock.java @@ -82,7 +82,7 @@ public class TntBlock extends Block { @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide() && !player.isCreative() && (Boolean) state.getValue(TntBlock.UNSTABLE) && CraftEventFactory.callTNTPrimeEvent(world, pos, PrimeCause.BLOCK_BREAK, player, null)) { // CraftBukkit - TNTPrimeEvent + if (/*!world.isClientSide() &&*/ !player.isCreative() && (Boolean) state.getValue(TntBlock.UNSTABLE) && CraftEventFactory.callTNTPrimeEvent(world, pos, PrimeCause.BLOCK_BREAK, player, null)) { // CraftBukkit - TNTPrimeEvent // Plazma - Remove persist 'isClientSide' flag TntBlock.explode(world, pos); } @@ -110,13 +110,13 @@ public class TntBlock extends Block { } private static void explode(Level world, BlockPos pos, @Nullable LivingEntity igniter) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag PrimedTnt entitytntprimed = new PrimedTnt(world, (double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D, igniter); world.addFreshEntity(entitytntprimed); world.playSound((Player) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); world.gameEvent((Entity) igniter, (Holder) GameEvent.PRIME_FUSE, pos); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java index 872e52e13293a99d45f93d90d8fa7f6aa99d1f3a..d3716e33a8be0d894972ef8ed1624bf311fccb4d 100644 --- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java @@ -140,7 +140,7 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag1 = world.hasNeighborSignal(pos); if (flag1 != (Boolean) state.getValue(TrapDoorBlock.POWERED)) { @@ -187,7 +187,7 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW } } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java index 74cce7874809dcbce2718ec3840bb6bb3127e871..b7e8431198be8ed5a7f221e43d5a92a081d09965 100644 --- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java @@ -100,7 +100,7 @@ public class TripWireBlock extends Block { @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return state; // Paper - prevent disarming tripwires - if (!world.isClientSide && !player.getMainHandItem().isEmpty() && player.getMainHandItem().is(Items.SHEARS)) { + if (/*!world.isClientSide &&*/ !player.getMainHandItem().isEmpty() && player.getMainHandItem().is(Items.SHEARS)) { // Plazma - Remove persist 'isClientSide' flag world.setBlock(pos, (BlockState) state.setValue(TripWireBlock.DISARMED, true), 4); world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos); } @@ -149,11 +149,11 @@ public class TripWireBlock extends Block { protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent tripwires from detecting collision if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag if (!(Boolean) state.getValue(TripWireBlock.POWERED)) { this.checkPressed(world, pos, List.of(entity)); } - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override diff --git a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java index f1dfb23160ff70e0da4dd2af2d83e879527c6651..63c60e461a3db8f8b6084e074c0b201adbdec051 100644 --- a/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TurtleEggBlock.java @@ -162,7 +162,7 @@ public class TurtleEggBlock extends Block { @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { - if (TurtleEggBlock.onSand(world, pos) && !world.isClientSide) { + if (TurtleEggBlock.onSand(world, pos) /*&& !world.isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag world.levelEvent(2012, pos, 15); } diff --git a/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java b/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java index 3a7126883f11ac5a647947eaf060df15536a6cb2..b26ee54d48908199e5fcd4bda415f29f3f42026c 100644 --- a/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WitherSkullBlock.java @@ -63,7 +63,7 @@ public class WitherSkullBlock extends SkullBlock { public static void checkSpawn(Level world, BlockPos pos, SkullBlockEntity blockEntity) { if (world.captureBlockStates) return; // CraftBukkit - if (!world.isClientSide) { + //if (!world.isClientSide) { BlockState iblockdata = blockEntity.getBlockState(); boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL); @@ -101,11 +101,11 @@ public class WitherSkullBlock extends SkullBlock { } } - } + //} // Plazma - Remove persist 'isClientSide' flag } public static boolean canSpawnMob(Level world, BlockPos pos, ItemStack stack) { - return stack.is(Items.WITHER_SKELETON_SKULL) && pos.getY() >= world.getMinY() + 2 && world.getDifficulty() != Difficulty.PEACEFUL && !world.isClientSide ? WitherSkullBlock.getOrCreateWitherBase().find(world, pos) != null : false; + return stack.is(Items.WITHER_SKELETON_SKULL) && pos.getY() >= world.getMinY() + 2 && world.getDifficulty() != Difficulty.PEACEFUL && /*!world.isClientSide ?*/ WitherSkullBlock.getOrCreateWitherBase().find(world, pos) != null; //: false; // Plazma - Remove persist 'isClientSide' flag } private static BlockPattern getOrCreateWitherFull() { diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java index 2d190b3a6378b8cbadfa65510df1ccfbd5882ef8..69ef5c805d802575a639027fd40064d92fcfe89d 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java @@ -154,7 +154,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name BeaconBlockEntity.this.levels = value; break; case 1: - if (!BeaconBlockEntity.this.level.isClientSide && !BeaconBlockEntity.this.beamSections.isEmpty()) { + if (/*!BeaconBlockEntity.this.level.isClientSide &&*/ !BeaconBlockEntity.this.beamSections.isEmpty()) { // Plazma - Remove persist 'isClientSide' flag BeaconBlockEntity.playSound(BeaconBlockEntity.this.level, BeaconBlockEntity.this.worldPosition, SoundEvents.BEACON_POWER_SELECT); } @@ -254,7 +254,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name boolean flag = i1 > 0; blockEntity.beamSections = blockEntity.checkingBeamSections; - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag1 = blockEntity.levels > 0; if (!flag && flag1) { @@ -269,7 +269,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name } else if (flag && !flag1) { BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_DEACTIVATE); } - } + //} // Plazma - Remove persist 'isClientSide' flag } } @@ -405,7 +405,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name } private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable Holder primaryEffect, @Nullable Holder secondaryEffect, @Nullable BeaconBlockEntity blockEntity) { // Paper end - Custom beacon ranges - if (!world.isClientSide && primaryEffect != null) { + if (/*!world.isClientSide &&*/ primaryEffect != null) { // Plazma - Remove persist 'isClientSide' flag double d0 = (double) (beaconLevel * 10 + 10); byte b0 = BeaconBlockEntity.getAmplification(beaconLevel, primaryEffect, secondaryEffect); diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java index 946c9dbfabf154db53d811906fd98d17992167d1..6a46eb93692028bd28ae1329de9c9b208878abb7 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java @@ -119,7 +119,7 @@ public class BellBlockEntity extends BlockEntity { this.nearbyEntities = this.level.getEntitiesOfClass(LivingEntity.class, axisalignedbb); } - if (!this.level.isClientSide) { + //if (!this.level.isClientSide) { // Plazma - Remove persist 'isClientSide' flag Iterator iterator = this.nearbyEntities.iterator(); while (iterator.hasNext()) { @@ -129,7 +129,7 @@ public class BellBlockEntity extends BlockEntity { entityliving.getBrain().setMemory(MemoryModuleType.HEARD_BELL_TIME, this.level.getGameTime()); // CraftBukkit - decompile error } } - } + //} // Plazma - Remove persist 'isClientSide' flag this.nearbyEntities.removeIf(e -> !e.isAlive()); // Paper - Fix bell block entity memory leak } diff --git a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java index 853263b4dd28a5b7620dde17c13412193036eda9..e84cf74aa58d1d7ed15b7fc5b6d1633ddce525ea 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java @@ -223,7 +223,7 @@ public class DecoratedPotBlockEntity extends BlockEntity implements Randomizable } public void wobble(DecoratedPotBlockEntity.WobbleStyle wobbleType) { - if (this.level != null && !this.level.isClientSide()) { + if (this.level != null /*&& !this.level.isClientSide()*/) { // Plazma - Remove persist 'isClientSide' flag this.level.blockEvent(this.getBlockPos(), this.getBlockState().getBlock(), 1, wobbleType.ordinal()); } } diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java index aeeb8af68ea43ae6c93952610918d77b1593ed54..82606b6a0aac46588322f036e824da621aa2e6c4 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -194,9 +194,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen // Paper end - Perf: Optimize Hoppers private static boolean tryMoveItems(Level world, BlockPos pos, BlockState state, HopperBlockEntity blockEntity, BooleanSupplier booleansupplier) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide) { return false; } else { + */ // Plazma - Remove persist 'isClientSide' flag if (!blockEntity.isOnCooldown() && (Boolean) state.getValue(HopperBlock.ENABLED)) { boolean flag = false; @@ -217,7 +219,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen } return false; - } + //} // Plazma - Remove persist 'isClientSide' flag } private boolean inventoryFull() { diff --git a/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java index c3bbe5e9e0cc37f3f22fc1d839fa2652966f1266..e32c4aadf1b36e27e8cb9dba039ea1c41f49ad55 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/JukeboxBlockEntity.java @@ -93,7 +93,7 @@ public class JukeboxBlockEntity extends BlockEntity implements ContainerSingleIt } public void popOutTheItem() { - if (this.level != null && !this.level.isClientSide) { + if (this.level != null /*&& !this.level.isClientSide*/) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockposition = this.getBlockPos(); ItemStack itemstack = this.getTheItem(); diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java index 0147a7be5fd147ffa9bd42a90e85a324bc317a81..49d4b147e41d8f436947ca4d5ac22ea7cbd854dc 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java @@ -151,9 +151,11 @@ public class StructureBlockEntity extends BlockEntity { if (!player.canUseGameMasterBlocks()) { return false; } else { + /* // Plazma - Remove persist 'isClientSide' flag if (player.getCommandSenderWorld().isClientSide) { player.openStructureBlock(this); } + */ // Plazma - Remove persist 'isClientSide' flag return true; } @@ -416,7 +418,7 @@ public class StructureBlockEntity extends BlockEntity { } public boolean isStructureLoadable() { - if (this.mode == StructureMode.LOAD && !this.level.isClientSide && this.structureName != null) { + if (this.mode == StructureMode.LOAD && /*!this.level.isClientSide &&*/ this.structureName != null) { // Plazma - Remove persist 'isClientSide' flag ServerLevel serverLevel = (ServerLevel)this.level; StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager(); diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java index 68fd5d3f6553af8af867e34946cb8b3f852da985..2f9597e6601d6e21187fdab5536a7c48617c4865 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java @@ -122,11 +122,11 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { } public static void triggerCooldown(Level world, BlockPos pos, BlockState state, TheEndGatewayBlockEntity blockEntity) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag blockEntity.teleportCooldown = 40; world.blockEvent(pos, state.getBlock(), 1, 0); setChanged(world, pos, state); - } + //} // Plazma - Remove persist 'isClientSide' flag } diff --git a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java index 4045ae665450f6e3f5630cb25cc53be850afd1a8..ddc6b6b26dec60cc6a4111cf00fa0284ee582ad5 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java @@ -134,7 +134,7 @@ public class VaultBlockEntity extends BlockEntity { @Nullable public VaultServerData getServerData() { - return this.level != null && !this.level.isClientSide ? this.serverData : null; + return this.level != null /*&& !this.level.isClientSide*/ ? this.serverData : null; // Plazma - Remove persist 'isClientSide' flag } public VaultSharedData getSharedData() { diff --git a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java index b696597540d998c52ec3207ffd8bf658fde59215..a030a22057d35ebb6d84cb43cff12a2f36487feb 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java @@ -85,7 +85,7 @@ public class MovingPistonBlock extends BaseEntityBlock { @Override protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { - if (!world.isClientSide && world.getBlockEntity(pos) == null) { + if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) == null) { // Plazma - Remove persist 'isClientSide' flag world.removeBlock(pos, false); return InteractionResult.CONSUME; } else { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java index 4b51472502d08ea357da437afeb4b581979e9cff..fb5e18b7be62ff07af65229b1a38b6d6e0c1d8c9 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java @@ -108,24 +108,24 @@ public class PistonBaseBlock extends DirectionalBlock { @Override public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.checkIfExtend(world, pos, state); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) { - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag this.checkIfExtend(world, pos, state); - } + //} // Plazma - Remove persist 'isClientSide' flag } @Override protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (!oldState.is(state.getBlock())) { - if (!world.isClientSide && world.getBlockEntity(pos) == null) { + if (/*!world.isClientSide &&*/ world.getBlockEntity(pos) == null) { // Plazma - Remove persist 'isClientSide' flag this.checkIfExtend(world, pos, state); } @@ -224,7 +224,7 @@ public class PistonBaseBlock extends DirectionalBlock { // Paper end - Protect Bedrock and End Portal/Frames from being destroyed BlockState iblockdata1 = (BlockState) state.setValue(PistonBaseBlock.EXTENDED, true); - if (!world.isClientSide) { + //if (!world.isClientSide) { // Plazma - Remove persist 'isClientSide' flag boolean flag = this.getNeighborSignal(world, pos, enumdirection); if (flag && (type == 1 || type == 2)) { @@ -235,7 +235,7 @@ public class PistonBaseBlock extends DirectionalBlock { if (!flag && type == 0) { return false; } - } + //} // Plazma - Remove persist 'isClientSide' flag if (type == 0) { if (!this.moveBlocks(world, pos, enumdirection, true)) { diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java index c5c297b1081c9ddbb3bd0a0947401041aa8fec7d..ca409b4e49d9b7842a0d35fef10f8f53feffcf1e 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java @@ -111,7 +111,7 @@ public class PistonHeadBlock extends DirectionalBlock { @Override public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - if (!world.isClientSide && player.getAbilities().instabuild) { + if (/*!world.isClientSide &&*/ player.getAbilities().instabuild) { // Plazma - Remove persist 'isClientSide' flag BlockPos blockPos = pos.relative(state.getValue(FACING).getOpposite()); if (this.isFittingBase(state, world.getBlockState(blockPos))) { world.destroyBlock(blockPos, false); diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java index e1c9a961064887070b29207efd7af47884f8dc29..6feb7f915dac585916ac02a7f4a83b4783543cc9 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java @@ -272,7 +272,7 @@ public class PistonMovingBlockEntity extends BlockEntity { } public void finalTick() { - if (this.level != null && (this.progressO < 1.0F || this.level.isClientSide)) { + if (this.level != null && (this.progressO < 1.0F /*|| this.level.isClientSide*/)) { // Plazma - Remove persist 'isClientSide' flag this.progress = 1.0F; this.progressO = this.progress; this.level.removeBlockEntity(this.worldPosition); @@ -302,9 +302,11 @@ public class PistonMovingBlockEntity extends BlockEntity { blockEntity.lastTicked = world.getGameTime(); blockEntity.progressO = blockEntity.progress; if (blockEntity.progressO >= 1.0F) { + /* // Plazma - Remove persist 'isClientSide' flag if (world.isClientSide && blockEntity.deathTicks < 5) { blockEntity.deathTicks++; } else { + */ // Plazma - Remove persist 'isClientSide' flag world.removeBlockEntity(pos); blockEntity.setRemoved(); if (world.getBlockState(pos).is(Blocks.MOVING_PISTON)) { @@ -323,7 +325,7 @@ public class PistonMovingBlockEntity extends BlockEntity { ); } } - } + //} // Plazma - Remove persist 'isClientSide' flag } else { float f = blockEntity.progress + 0.5F; moveCollidedEntities(world, pos, f, blockEntity); diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java index 5c4843f6cfd13790a44fc0f928f1fbcef8a648ce..3b3915c4f93f7e35392255c1352e236208a2b447 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -430,7 +430,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p boolean flag3 = iblockdata1.hasBlockEntity(); - if (!this.level.isClientSide && !this.level.isBlockPlaceCancelled) { // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent + if (/*!this.level.isClientSide &&*/ !this.level.isBlockPlaceCancelled) { // Paper - prevent calling cleanup logic when undoing a block place upon a cancelled BlockPlaceEvent // Plazma - Remove persist 'isClientSide' flag iblockdata1.onRemove(this.level, blockposition, iblockdata, flag); } else if (!iblockdata1.is(block) && flag3) { this.removeBlockEntity(blockposition); @@ -440,7 +440,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p return null; } else { // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled. - if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { + if (/*!this.level.isClientSide &&*/ doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Plazma - Remove persist 'isClientSide' flag iblockdata.onPlace(this.level, blockposition, iblockdata1, flag); } @@ -542,7 +542,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } private boolean isInLevel() { - return this.loaded || this.level.isClientSide(); + return this.loaded; //|| this.level.isClientSide(); // Plazma - Remove persist 'isClientSide' flag } boolean isTicking(BlockPos pos) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java index 54debe9da0a26aea02c964fdc7efb372e07974c0..2e630167b1d21bc67a88e725a5e451bcf34441fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -128,9 +128,11 @@ public class CraftMerchantCustom implements CraftMerchant { public void overrideOffers(MerchantOffers offers) { } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return false; } + */ // Plazma - Remove persist 'isClientSide' flag } } diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java index 37458e8fd5d57acbf90a6bea4e66797cb07f69fa..313e3202e5f1acbdf9aba0826139c3e94de9de0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java @@ -322,10 +322,12 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel { return this.handle.getUncachedNoiseBiome(biomeX, biomeY, biomeZ); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return this.handle.isClientSide(); } + */ // Plazma - Remove persist 'isClientSide' flag @Override public int getSeaLevel() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java index e8a73d34dbb372581b03018aade170a31c266099..6f540ae099e51e91e5cb86d7b938369f8292a47b 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -163,10 +163,12 @@ public class DummyGeneratorAccess implements WorldGenLevel { throw new UnsupportedOperationException("Not supported yet."); } + /* // Plazma - Remove persist 'isClientSide' flag @Override public boolean isClientSide() { return false; } + */ // Plazma - Remove persist 'isClientSide' flag @Override public int getSeaLevel() {