fix more compile errors

This commit is contained in:
Jake Potrebic 2023-06-08 12:00:58 -07:00
parent 5c83f1aca3
commit ebe89a7928
10 changed files with 30 additions and 17 deletions

View file

@ -26,13 +26,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ if (actualTargets.isEmpty()) {
+ return 0;
+ } else {
+ targets = actualTargets;
+ }
+ // Paper end
String s = resourcekey.location().toString();
- if (targets.size() == 1) {
+ if (actualTargets.size() == 1) { // Paper
source.sendSuccess(() -> {
- return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) targets.iterator().next()).getDisplayName());
+ return Component.translatable("commands.spawnpoint.success.single", pos.getX(), pos.getY(), pos.getZ(), angle, s, ((ServerPlayer) actualTargets.iterator().next()).getDisplayName()); // Paper
}, true);
} else {
source.sendSuccess(() -> {
- return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, targets.size());
+ return Component.translatable("commands.spawnpoint.success.multiple", pos.getX(), pos.getY(), pos.getZ(), angle, s, actualTargets.size()); // Paper
}, true);
}
- return targets.size();
+ return actualTargets.size(); // Paper
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java

View file

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
MobEffect mobeffectlist = effect.getEffect();
- if (mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) {
+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level.paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper
+ if ((mobeffectlist == MobEffects.REGENERATION || mobeffectlist == MobEffects.POISON) && this.level().paperConfig().entities.mobEffects.undeadImmuneToCertainEffects) { // Paper
return false;
}
}

View file

@ -13,10 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (entityitem.isMergable()) {
+ // Paper Start - Fix items merging through walls
+ if (this.level.paperConfig().fixes.fixItemsMergingThroughWalls) {
+ if (this.level().paperConfig().fixes.fixItemsMergingThroughWalls) {
+ net.minecraft.world.level.ClipContext rayTrace = new net.minecraft.world.level.ClipContext(this.position(), entityitem.position(),
+ net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, this);
+ net.minecraft.world.phys.BlockHitResult rayTraceResult = level.clip(rayTrace);
+ net.minecraft.world.phys.BlockHitResult rayTraceResult = this.level().clip(rayTrace);
+ if (rayTraceResult.getType() == net.minecraft.world.phys.HitResult.Type.BLOCK) continue;
+ }
+ // Paper End

View file

@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override
public boolean isInvulnerableTo(DamageSource damageSource) {
- return super.isInvulnerableTo(damageSource) || this.isChangingDimension();
+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !level.paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming
+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming
}
@Override

View file

@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ final ItemStack copy = copyItemStack ? itemStack.copy() : itemStack;
+ if (level.paperConfig().anticheat.obfuscation.items.hideDurability) {
+ if (this.level().paperConfig().anticheat.obfuscation.items.hideDurability) {
+ // Only show damage values for elytra's, since they show a different texture when broken.
+ if (!copy.is(Items.ELYTRA) || copy.getDamageValue() < copy.getMaxDamage() - 1) {
+ copy.setDamageValue(0);
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ final CompoundTag tag = copy.getTag();
+ if (level.paperConfig().anticheat.obfuscation.items.hideItemmeta) {
+ if (this.level().paperConfig().anticheat.obfuscation.items.hideItemmeta) {
+ // Some resource packs show different textures when there is more than one item. Since this shouldn't provide a big advantage,
+ // we'll tell the client if there's one or (more than) two items.
+ copy.setCount(copy.getCount() > 1 ? 2 : 1);
@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+
+ if (level.paperConfig().anticheat.obfuscation.items.hideItemmetaWithVisualEffects && tag != null) {
+ if (this.level().paperConfig().anticheat.obfuscation.items.hideItemmetaWithVisualEffects && tag != null) {
+ // Lodestone compasses
+ tag.remove("LodestonePos");
+ if (tag.contains("LodestoneDimension")) {

View file

@ -1219,14 +1219,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.tryCheckInsideBlocks();
float f = this.getBlockSpeedFactor();
- this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f));
this.setDeltaMovement(this.getDeltaMovement().multiply((double) f, 1.0D, (double) f));
- if (this.level().getBlockStatesIfLoaded(this.getBoundingBox().deflate(1.0E-6D)).noneMatch((iblockdata2) -> {
- return iblockdata2.is(BlockTags.FIRE) || iblockdata2.is(Blocks.LAVA);
- })) {
+ this.setDeltaMovement(this.getDeltaMovement().multiply((double) f2, 1.0D, (double) f2));
+ // Paper start - remove expensive streams from here
+ boolean noneMatch = true;
+ AABB fireSearchBox = this.getBoundingBox().deflate(1.0E-6D);

View file

@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper
- ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
+ ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.getLevel()); // Paper
+ ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.player.serverLevel()); // Paper
}
}
break;

View file

@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
+ // Paper start
+ BlockEntity tileentity = null;
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) {
+ tileentity = this.player.level.getBlockEntity(blockposition);
+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.serverLevel().isLoadedAndInBounds(blockposition)) {
+ tileentity = this.player.level().getBlockEntity(blockposition);
+ }
+ // Paper end

View file

@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public void onItemPickup(ItemEntity item) {
- Entity entity = item.getOwner();
+ Entity entity = item.thrower != null ? this.level.getGlobalPlayerByUUID(item.thrower) : null; // Paper - check all players
+ Entity entity = item.thrower != null ? this.level().getGlobalPlayerByUUID(item.thrower) : null; // Paper - check all players
if (entity instanceof ServerPlayer) {
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this);

View file

@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
}
+ if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - preserve this check from vanilla
+ if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // Paper - preserve this check from vanilla
// SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
this.dropFromLootTable(damageSource, this.lastHurtByPlayerTime > 0);
for (org.bukkit.inventory.ItemStack item : this.drops) {