Some more compile issues
This commit is contained in:
		
					parent
					
						
							
								4c984f6e46
							
						
					
				
			
			
				commit
				
					
						cc0308bf1d
					
				
			
		
					 13 changed files with 29 additions and 35 deletions
				
			
		| 
						 | 
				
			
			@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+
 | 
			
		||||
+            @Override
 | 
			
		||||
+            public void tick() {
 | 
			
		||||
+                if (this.mob.getY() <= Bee.this.level().getMinBuildHeight()) {
 | 
			
		||||
+                if (this.mob.getY() <= Bee.this.level().getMinY()) {
 | 
			
		||||
+                    this.mob.setNoGravity(false);
 | 
			
		||||
+                }
 | 
			
		||||
+                super.tick();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
     public static Optional<Entity> create(CompoundTag nbt, Level world, EntitySpawnReason reason) {
 | 
			
		||||
+    // Paper start - Don't fire sync event during generation
 | 
			
		||||
+        return create(nbt, world, false);
 | 
			
		||||
+        return create(nbt, world, reason, false);
 | 
			
		||||
+    }
 | 
			
		||||
+    public static Optional<Entity> create(CompoundTag nbt, Level world, EntitySpawnReason reason, boolean generation) {
 | 
			
		||||
+    // Paper end - Don't fire sync event during generation
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
             this.applyEffectsFromBlocks();
 | 
			
		||||
+            // Paper start - Configurable falling blocks height nerf
 | 
			
		||||
+            if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
 | 
			
		||||
+                if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
 | 
			
		||||
+                    this.spawnAtLocation(block);
 | 
			
		||||
+                if (this.dropItem && this.level() instanceof final ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
 | 
			
		||||
+                    this.spawnAtLocation(serverLevel, block);
 | 
			
		||||
+                }
 | 
			
		||||
+
 | 
			
		||||
+                this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
         }
 | 
			
		||||
 
 | 
			
		||||
         private boolean cannotPickUpBanner() {
 | 
			
		||||
+            if (!this.mob.level().getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
 | 
			
		||||
+            if (!getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
 | 
			
		||||
             if (!this.mob.hasActiveRaid()) {
 | 
			
		||||
                 return true;
 | 
			
		||||
             } else if (this.mob.getCurrentRaid().isOver()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
         if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, Raid.getOminousBannerInstance(this.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) {
 | 
			
		||||
+            // Paper start - EntityPickupItemEvent fixes
 | 
			
		||||
+            if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, item, 0, false).isCancelled()) {
 | 
			
		||||
+            if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, itemstack, 0, false).isCancelled()) {
 | 
			
		||||
+                return;
 | 
			
		||||
+            }
 | 
			
		||||
+            // Paper end - EntityPickupItemEvent fixes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -245,8 +245,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
+    // Paper start - Fix MC-123848 (spawn item frame drops above block)
 | 
			
		||||
+    @Nullable
 | 
			
		||||
+    @Override
 | 
			
		||||
+    public net.minecraft.world.entity.item.ItemEntity spawnAtLocation(ItemStack stack) {
 | 
			
		||||
+        return this.spawnAtLocation(stack, getDirection().equals(Direction.DOWN) ? -0.6F : 0.0F);
 | 
			
		||||
+    public net.minecraft.world.entity.item.ItemEntity spawnAtLocation(ServerLevel serverLevel, ItemStack stack) {
 | 
			
		||||
+        return this.spawnAtLocation(serverLevel, stack, getDirection().equals(Direction.DOWN) ? -0.6F : 0.0F);
 | 
			
		||||
+    }
 | 
			
		||||
+    // Paper end
 | 
			
		||||
+
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                             if (block instanceof InfestedBlock) {
 | 
			
		||||
                                 // CraftBukkit start
 | 
			
		||||
-                                if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
 | 
			
		||||
+                                BlockState afterState = world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? iblockdata.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1)); // Paper - fix wrong block state
 | 
			
		||||
+                                BlockState afterState = getServerLevel(world).getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? iblockdata.getFluidState().createLegacyBlock() : ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1)); // Paper - fix wrong block state
 | 
			
		||||
+                                if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, afterState)) { // Paper - fix wrong block state
 | 
			
		||||
                                     continue;
 | 
			
		||||
                                 }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -678,7 +678,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
         if (nbt.contains("LootTable", 8)) {
 | 
			
		||||
             this.setContainerLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable"))));
 | 
			
		||||
+            // Paper start - LootTable API
 | 
			
		||||
+            if (this.getLootTable() != null) {
 | 
			
		||||
+            if (this.getContainerLootTable() != null) {
 | 
			
		||||
+                this.lootableData().loadNbt(nbt);
 | 
			
		||||
+            }
 | 
			
		||||
+            // Paper end - LootTable API
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                     if (SpawnPlacements.isSpawnPositionOk(entitytypes, world, blockposition) && SpawnPlacements.checkSpawnRules(entitytypes, world, EntitySpawnReason.REINFORCEMENT, blockposition, world.random)) {
 | 
			
		||||
                         entityzombie.setPos((double) i1, (double) j1, (double) k1);
 | 
			
		||||
-                        if (!world.hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && world.isUnobstructed(entityzombie) && world.noCollision((Entity) entityzombie) && (entityzombie.canSpawnInLiquids() || !world.containsAnyLiquid(entityzombie.getBoundingBox()))) {
 | 
			
		||||
+                        if (!world.hasNearbyAlivePlayerhasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && world.isUnobstructed(entityzombie) && world.noCollision((Entity) entityzombie) && (entityzombie.canSpawnInLiquids() || !world.containsAnyLiquid(entityzombie.getBoundingBox()))) { // Paper - affects spawning api
 | 
			
		||||
+                        if (!world.hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && world.isUnobstructed(entityzombie) && world.noCollision((Entity) entityzombie) && (entityzombie.canSpawnInLiquids() || !world.containsAnyLiquid(entityzombie.getBoundingBox()))) { // Paper - affects spawning api
 | 
			
		||||
                             entityzombie.setTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit
 | 
			
		||||
                             entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), EntitySpawnReason.REINFORCEMENT, (SpawnGroupData) null);
 | 
			
		||||
                             world.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,6 +58,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
                 entityliving1 = entityliving2;
 | 
			
		||||
             } else {
 | 
			
		||||
                 entityliving1 = null;
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
 | 
			
		||||
@@ -0,0 +0,0 @@ public class Dolphin extends AgeableWaterCreature {
 | 
			
		||||
 
 | 
			
		||||
     @Nullable
 | 
			
		||||
     @Override
 | 
			
		||||
-    protected SoundEvent getDeathSound() {
 | 
			
		||||
+    public SoundEvent getDeathSound() { // Paper - remap fixes
 | 
			
		||||
         return SoundEvents.DOLPHIN_DEATH;
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1352,9 +1352,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
 
 | 
			
		||||
     public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, String translationKey, Optional<ResourceKey<LootTable>> lootTable, FeatureFlagSet requiredFeatures) {
 | 
			
		||||
+       // Paper start
 | 
			
		||||
+        this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, requiredFeatures, "custom");
 | 
			
		||||
+        this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, translationKey, lootTable, requiredFeatures, "custom");
 | 
			
		||||
+    }
 | 
			
		||||
+    public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures, String id) {
 | 
			
		||||
+    public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, String translationKey, Optional<ResourceKey<LootTable>> lootTable, FeatureFlagSet requiredFeatures, String id) {
 | 
			
		||||
+        this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick");
 | 
			
		||||
+        this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick");
 | 
			
		||||
+        this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick");
 | 
			
		||||
| 
						 | 
				
			
			@ -1378,15 +1378,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
     public boolean trackDeltas() {
 | 
			
		||||
         return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS;
 | 
			
		||||
     }
 | 
			
		||||
@@ -0,0 +0,0 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
 | 
			
		||||
                 Util.fetchChoiceType(References.ENTITY_TREE, registryKey.location().toString());
 | 
			
		||||
             }
 | 
			
		||||
 
 | 
			
		||||
-            return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, (String) this.descriptionId.get(registryKey), (Optional) this.lootTable.get(registryKey), this.requiredFeatures);
 | 
			
		||||
+            return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, (String) this.descriptionId.get(registryKey), (Optional) this.lootTable.get(registryKey), this.requiredFeatures, this.id); // Paper - add id
 | 
			
		||||
         }
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -139,7 +139,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
 | 
			
		|||
-            this.setContainerLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.parse(nbt.getString("LootTable"))));
 | 
			
		||||
+            this.setContainerLootTable(net.minecraft.Optionull.map(ResourceLocation.tryParse(nbt.getString("LootTable")), rl -> ResourceKey.create(Registries.LOOT_TABLE, rl))); // Paper - Validate ResourceLocation
 | 
			
		||||
             // Paper start - LootTable API
 | 
			
		||||
             if (this.getLootTable() != null) {
 | 
			
		||||
             if (this.getContainerLootTable() != null) {
 | 
			
		||||
                 this.lootableData().loadNbt(nbt);
 | 
			
		||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
 | 
			
		||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,24 +8,14 @@ diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src
 | 
			
		|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
 | 
			
		||||
--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
 | 
			
		||||
+++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
 | 
			
		||||
@@ -0,0 +0,0 @@ import java.util.function.ToIntFunction;
 | 
			
		||||
 import net.minecraft.core.BlockPos;
 | 
			
		||||
 import net.minecraft.core.Direction;
 | 
			
		||||
 import net.minecraft.core.component.DataComponents;
 | 
			
		||||
+import net.minecraft.server.level.ServerLevel;
 | 
			
		||||
 import net.minecraft.util.RandomSource;
 | 
			
		||||
+import net.minecraft.world.InteractionHand;
 | 
			
		||||
 import net.minecraft.world.InteractionResult;
 | 
			
		||||
 import net.minecraft.world.entity.player.Player;
 | 
			
		||||
 import net.minecraft.world.item.ItemStack;
 | 
			
		||||
@@ -0,0 +0,0 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
 | 
			
		||||
         builder.add(LEVEL, WATERLOGGED);
 | 
			
		||||
     }
 | 
			
		||||
 
 | 
			
		||||
+    // Paper start - prevent unintended light block manipulation
 | 
			
		||||
+    @Override
 | 
			
		||||
+    protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
 | 
			
		||||
+        if (player.getItemInHand(hand).getItem() != Items.LIGHT || (world instanceof final ServerLevel serverLevel && !player.mayInteract(serverLevel, pos)) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return net.minecraft.world.InteractionResult.PASS; } // Paper - Prevent unintended light block manipulation
 | 
			
		||||
+    protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, net.minecraft.world.InteractionHand hand, BlockHitResult hit) {
 | 
			
		||||
+        if (player.getItemInHand(hand).getItem() != Items.LIGHT || (world instanceof final net.minecraft.server.level.ServerLevel serverLevel && !player.mayInteract(serverLevel, pos)) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return net.minecraft.world.InteractionResult.PASS; } // Paper - Prevent unintended light block manipulation
 | 
			
		||||
+        return super.useItemOn(stack, state, world, pos, player, hand, hit);
 | 
			
		||||
+    }
 | 
			
		||||
+    // Paper end - prevent unintended light block manipulation
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue