├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitattributes ├── gradle.properties ├── .gitignore ├── settings.gradle.kts ├── pluto-server ├── minecraft-patches │ └── sources │ │ ├── net │ │ └── minecraft │ │ │ ├── world │ │ │ ├── item │ │ │ │ ├── trading │ │ │ │ │ └── Merchant.java.patch │ │ │ │ ├── BlockItem.java.patch │ │ │ │ └── EndCrystalItem.java.patch │ │ │ ├── level │ │ │ │ ├── block │ │ │ │ │ ├── entity │ │ │ │ │ │ ├── TickingBlockEntity.java.patch │ │ │ │ │ │ ├── BaseContainerBlockEntity.java.patch │ │ │ │ │ │ ├── ChiseledBookShelfBlockEntity.java.patch │ │ │ │ │ │ ├── TheEndGatewayBlockEntity.java.patch │ │ │ │ │ │ ├── ShelfBlockEntity.java.patch │ │ │ │ │ │ ├── DispenserBlockEntity.java.patch │ │ │ │ │ │ ├── ChestBlockEntity.java.patch │ │ │ │ │ │ ├── LecternBlockEntity.java.patch │ │ │ │ │ │ └── CreakingHeartBlockEntity.java.patch │ │ │ │ │ ├── CakeBlock.java.patch │ │ │ │ │ ├── BannerBlock.java.patch │ │ │ │ │ ├── AzaleaBlock.java.patch │ │ │ │ │ ├── CandleCakeBlock.java.patch │ │ │ │ │ ├── SeagrassBlock.java.patch │ │ │ │ │ ├── FungusBlock.java.patch │ │ │ │ │ ├── BonemealableFeaturePlacerBlock.java.patch │ │ │ │ │ ├── PoweredBlock.java.patch │ │ │ │ │ ├── DirtPathBlock.java.patch │ │ │ │ │ ├── ScaffoldingBlock.java.patch │ │ │ │ │ ├── TargetBlock.java.patch │ │ │ │ │ ├── ConcretePowderBlock.java.patch │ │ │ │ │ ├── MangrovePropaguleBlock.java.patch │ │ │ │ │ ├── TntBlock.java.patch │ │ │ │ │ ├── BrushableBlock.java.patch │ │ │ │ │ ├── NyliumBlock.java.patch │ │ │ │ │ ├── SmallDripleafBlock.java.patch │ │ │ │ │ ├── sounds │ │ │ │ │ │ └── AmbientDesertBlockSoundsPlayer.java.patch │ │ │ │ │ ├── FallingBlock.java.patch │ │ │ │ │ ├── CeilingHangingSignBlock.java.patch │ │ │ │ │ ├── piston │ │ │ │ │ │ ├── PistonStructureResolver.java.patch │ │ │ │ │ │ └── PistonBaseBlock.java.patch │ │ │ │ │ ├── CocoaBlock.java.patch │ │ │ │ │ ├── RedstoneWallTorchBlock.java.patch │ │ │ │ │ ├── SaplingBlock.java.patch │ │ │ │ │ ├── DaylightDetectorBlock.java.patch │ │ │ │ │ ├── JukeboxBlock.java.patch │ │ │ │ │ ├── CalibratedSculkSensorBlock.java.patch │ │ │ │ │ ├── ComparatorBlock.java.patch │ │ │ │ │ ├── MushroomBlock.java.patch │ │ │ │ │ ├── LecternBlock.java.patch │ │ │ │ │ ├── BasePressurePlateBlock.java.patch │ │ │ │ │ ├── ButtonBlock.java.patch │ │ │ │ │ ├── LeverBlock.java.patch │ │ │ │ │ ├── TripWireHookBlock.java.patch │ │ │ │ │ ├── TestBlock.java.patch │ │ │ │ │ ├── TrappedChestBlock.java.patch │ │ │ │ │ ├── MultifaceBlock.java.patch │ │ │ │ │ ├── CoralBlock.java.patch │ │ │ │ │ ├── LightningRodBlock.java.patch │ │ │ │ │ ├── ObserverBlock.java.patch │ │ │ │ │ ├── BaseCoralPlantTypeBlock.java.patch │ │ │ │ │ ├── WaterlilyBlock.java.patch │ │ │ │ │ ├── ComposterBlock.java.patch │ │ │ │ │ ├── state │ │ │ │ │ │ └── pattern │ │ │ │ │ │ │ └── BlockPattern.java.patch │ │ │ │ │ ├── DetectorRailBlock.java.patch │ │ │ │ │ ├── LeavesBlock.java.patch │ │ │ │ │ ├── SweetBerryBushBlock.java.patch │ │ │ │ │ ├── BonemealableBlock.java.patch │ │ │ │ │ ├── RedStoneOreBlock.java.patch │ │ │ │ │ ├── BigDripleafStemBlock.java.patch │ │ │ │ │ ├── LiquidBlock.java.patch │ │ │ │ │ ├── MossyCarpetBlock.java.patch │ │ │ │ │ ├── CampfireBlock.java.patch │ │ │ │ │ ├── TallSeagrassBlock.java.patch │ │ │ │ │ ├── RedstoneTorchBlock.java.patch │ │ │ │ │ ├── BuddingAmethystBlock.java.patch │ │ │ │ │ ├── VineBlock.java.patch │ │ │ │ │ ├── BambooSaplingBlock.java.patch │ │ │ │ │ └── BigDripleafBlock.java.patch │ │ │ │ ├── redstone │ │ │ │ │ ├── DefaultRedstoneWireEvaluator.java.patch │ │ │ │ │ ├── RedstoneWireEvaluator.java.patch │ │ │ │ │ ├── Orientation.java.patch │ │ │ │ │ └── NeighborUpdater.java.patch │ │ │ │ ├── material │ │ │ │ │ ├── FluidState.java.patch │ │ │ │ │ └── LavaFluid.java.patch │ │ │ │ ├── biome │ │ │ │ │ └── Biome.java.patch │ │ │ │ ├── dimension │ │ │ │ │ └── end │ │ │ │ │ │ └── EndDragonFight.java.patch │ │ │ │ ├── gameevent │ │ │ │ │ └── vibrations │ │ │ │ │ │ └── VibrationSystem.java.patch │ │ │ │ ├── pathfinder │ │ │ │ │ ├── SwimNodeEvaluator.java.patch │ │ │ │ │ ├── AmphibiousNodeEvaluator.java.patch │ │ │ │ │ └── WalkNodeEvaluator.java.patch │ │ │ │ ├── EmptyBlockAndTintGetter.java.patch │ │ │ │ ├── EmptyBlockGetter.java.patch │ │ │ │ └── BlockGetter.java.patch │ │ │ ├── entity │ │ │ │ ├── vehicle │ │ │ │ │ ├── ContainerEntity.java.patch │ │ │ │ │ ├── minecart │ │ │ │ │ │ ├── AbstractMinecart.java.patch │ │ │ │ │ │ └── AbstractMinecartContainer.java.patch │ │ │ │ │ └── boat │ │ │ │ │ │ ├── AbstractBoat.java.patch │ │ │ │ │ │ └── AbstractChestBoat.java.patch │ │ │ │ ├── npc │ │ │ │ │ ├── ClientSideMerchant.java.patch │ │ │ │ │ └── villager │ │ │ │ │ │ ├── AbstractVillager.java.patch │ │ │ │ │ │ └── Villager.java.patch │ │ │ │ ├── ai │ │ │ │ │ ├── navigation │ │ │ │ │ │ ├── AmphibiousPathNavigation.java.patch │ │ │ │ │ │ └── GroundPathNavigation.java.patch │ │ │ │ │ ├── goal │ │ │ │ │ │ ├── CatLieOnBedGoal.java.patch │ │ │ │ │ │ ├── CatSitOnBlockGoal.java.patch │ │ │ │ │ │ ├── BreathAirGoal.java.patch │ │ │ │ │ │ ├── RemoveBlockGoal.java.patch │ │ │ │ │ │ ├── GoalSelector.java.patch │ │ │ │ │ │ ├── DolphinJumpGoal.java.patch │ │ │ │ │ │ ├── EatBlockGoal.java.patch │ │ │ │ │ │ ├── MoveToBlockGoal.java.patch │ │ │ │ │ │ └── ClimbOnTopOfPowderSnowGoal.java.patch │ │ │ │ │ ├── behavior │ │ │ │ │ │ ├── PrepareRamNearestTarget.java.patch │ │ │ │ │ │ ├── VillagerPanicTrigger.java.patch │ │ │ │ │ │ ├── BehaviorUtils.java.patch │ │ │ │ │ │ ├── GoToClosestVillage.java.patch │ │ │ │ │ │ ├── TryFindLand.java.patch │ │ │ │ │ │ ├── TryFindLandNearWater.java.patch │ │ │ │ │ │ ├── RamTarget.java.patch │ │ │ │ │ │ └── TryFindWater.java.patch │ │ │ │ │ └── attributes │ │ │ │ │ │ └── AttributeMap.java.patch │ │ │ │ ├── boss │ │ │ │ │ └── wither │ │ │ │ │ │ └── WitherBoss.java.patch │ │ │ │ ├── monster │ │ │ │ │ ├── warden │ │ │ │ │ │ └── Warden.java.patch │ │ │ │ │ ├── piglin │ │ │ │ │ │ ├── Piglin.java.patch │ │ │ │ │ │ └── PiglinBrute.java.patch │ │ │ │ │ ├── hoglin │ │ │ │ │ │ └── Hoglin.java.patch │ │ │ │ │ ├── Zoglin.java.patch │ │ │ │ │ ├── breeze │ │ │ │ │ │ └── Breeze.java.patch │ │ │ │ │ ├── creaking │ │ │ │ │ │ └── Creaking.java.patch │ │ │ │ │ ├── zombie │ │ │ │ │ │ └── Drowned.java.patch │ │ │ │ │ ├── Silverfish.java.patch │ │ │ │ │ ├── EnderMan.java.patch │ │ │ │ │ ├── Ghast.java.patch │ │ │ │ │ ├── skeleton │ │ │ │ │ │ └── Stray.java.patch │ │ │ │ │ ├── Shulker.java.patch │ │ │ │ │ └── Strider.java.patch │ │ │ │ ├── EntityType.java.patch │ │ │ │ ├── animal │ │ │ │ │ ├── axolotl │ │ │ │ │ │ └── Axolotl.java.patch │ │ │ │ │ ├── goat │ │ │ │ │ │ └── Goat.java.patch │ │ │ │ │ ├── fox │ │ │ │ │ │ └── Fox.java.patch │ │ │ │ │ ├── frog │ │ │ │ │ │ ├── Tadpole.java.patch │ │ │ │ │ │ └── Frog.java.patch │ │ │ │ │ ├── equine │ │ │ │ │ │ └── AbstractHorse.java.patch │ │ │ │ │ ├── sniffer │ │ │ │ │ │ └── Sniffer.java.patch │ │ │ │ │ ├── armadillo │ │ │ │ │ │ └── Armadillo.java.patch │ │ │ │ │ ├── fish │ │ │ │ │ │ ├── WaterAnimal.java.patch │ │ │ │ │ │ └── TropicalFish.java.patch │ │ │ │ │ ├── rabbit │ │ │ │ │ │ └── Rabbit.java.patch │ │ │ │ │ ├── AgeableWaterCreature.java.patch │ │ │ │ │ ├── camel │ │ │ │ │ │ └── Camel.java.patch │ │ │ │ │ ├── golem │ │ │ │ │ │ └── CopperGolem.java.patch │ │ │ │ │ ├── happyghast │ │ │ │ │ │ └── HappyGhast.java.patch │ │ │ │ │ ├── dolphin │ │ │ │ │ │ └── Dolphin.java.patch │ │ │ │ │ ├── turtle │ │ │ │ │ │ └── Turtle.java.patch │ │ │ │ │ ├── squid │ │ │ │ │ │ └── Squid.java.patch │ │ │ │ │ └── allay │ │ │ │ │ │ └── Allay.java.patch │ │ │ │ ├── projectile │ │ │ │ │ ├── throwableitemprojectile │ │ │ │ │ │ ├── AbstractThrownPotion.java.patch │ │ │ │ │ │ └── ThrownEnderpearl.java.patch │ │ │ │ │ └── FishingHook.java.patch │ │ │ │ └── ExperienceOrb.java.patch │ │ │ ├── ticks │ │ │ │ └── ContainerSingleItem.java.patch │ │ │ ├── phys │ │ │ │ └── Vec3.java.patch │ │ │ ├── SimpleContainer.java.patch │ │ │ ├── inventory │ │ │ │ ├── TransientCraftingContainer.java.patch │ │ │ │ ├── ResultContainer.java.patch │ │ │ │ └── MerchantContainer.java.patch │ │ │ ├── Container.java.patch │ │ │ └── CompoundContainer.java.patch │ │ │ ├── util │ │ │ └── profiling │ │ │ │ └── Profiler.java.patch │ │ │ ├── core │ │ │ ├── cauldron │ │ │ │ └── CauldronInteraction.java.patch │ │ │ └── Holder.java.patch │ │ │ ├── server │ │ │ ├── network │ │ │ │ └── ServerGamePacketListenerImpl.java.patch │ │ │ └── dedicated │ │ │ │ └── DedicatedServer.java.patch │ │ │ └── network │ │ │ └── Connection.java.patch │ │ └── alternate │ │ └── current │ │ └── wire │ │ ├── UpdateOrder.java.patch │ │ └── WireHandler.java.patch ├── src │ └── main │ │ └── java │ │ ├── gg │ │ └── pufferfish │ │ │ └── pufferfish │ │ │ ├── util │ │ │ └── IterableWrapper.java │ │ │ ├── PufferfishLogger.java │ │ │ └── sentry │ │ │ └── SentryManager.java │ │ └── dev │ │ └── yive │ │ └── pluto │ │ └── commands │ │ ├── PlutoSubcommand.java │ │ └── PlutoCommands.java └── paper-patches │ └── files │ └── src │ └── main │ └── java │ ├── org │ └── bukkit │ │ └── craftbukkit │ │ ├── inventory │ │ ├── CraftMerchantCustom.java.patch │ │ ├── CraftShapelessRecipe.java.patch │ │ └── CraftInventoryCustom.java.patch │ │ ├── scheduler │ │ ├── CraftAsyncScheduler.java.patch │ │ └── CraftScheduler.java.patch │ │ ├── entity │ │ ├── CraftEntity.java.patch │ │ ├── CraftPlayer.java.patch │ │ └── CraftLivingEntity.java.patch │ │ ├── Main.java.patch │ │ ├── event │ │ └── CraftEventFactory.java.patch │ │ ├── util │ │ └── CraftMagicNumbers.java.patch │ │ └── CraftServer.java.patch │ └── io │ └── papermc │ └── paper │ ├── inventory │ └── PaperInventoryCustomHolderContainer.java.patch │ └── ServerBuildInfoImpl.java.patch ├── pluto-api ├── paper-patches │ └── files │ │ └── src │ │ └── main │ │ └── java │ │ ├── io │ │ └── papermc │ │ │ └── paper │ │ │ └── ServerBuildInfo.java.patch │ │ └── org │ │ └── bukkit │ │ ├── UnsafeValues.java.patch │ │ ├── entity │ │ └── LivingEntity.java.patch │ │ ├── map │ │ └── MapPalette.java.patch │ │ └── plugin │ │ ├── java │ │ ├── JavaPluginLoader.java.patch │ │ └── PluginClassLoader.java.patch │ │ └── SimplePluginManager.java.patch └── src │ └── main │ └── java │ └── gg │ └── pufferfish │ └── pufferfish │ └── simd │ ├── SIMDDetection.java │ └── SIMDChecker.java ├── scripts └── upstreamCommit.sh └── .editorconfig /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yive/Pluto/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.sh text eol=lf 4 | gradlew text eol=lf 5 | *.bat text eol=crlf 6 | 7 | *.jar binary 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | group = dev.yive.pluto 2 | version = 1.21.11-R0.1-SNAPSHOT 3 | 4 | apiVersion=1.21.11 5 | mcVersion = 1.21.11 6 | paperRef = 1f94f1f7af8204ec7bbd94f7b0c1a8ba5fcf5ba8 7 | 8 | org.gradle.jvmargs=-Xmx4G 9 | 10 | org.gradle.configuration-cache=true 11 | org.gradle.caching=true 12 | org.gradle.parallel=true 13 | org.gradle.vfs.watch=false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | /run 8 | 9 | /pluto-server/build.gradle.kts 10 | /pluto-server/src/minecraft 11 | /paper-server 12 | /pufferfish-server 13 | /pluto-api/build.gradle.kts 14 | /paper-api 15 | /paper-api-generator 16 | /pufferfish-api 17 | 18 | .idea/ 19 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | mavenLocal() 5 | maven("https://repo.papermc.io/repository/maven-public/") 6 | } 7 | } 8 | 9 | plugins { 10 | id("org.gradle.toolchains.foojay-resolver-convention") version("1.0.0") 11 | } 12 | 13 | rootProject.name = "pluto" 14 | 15 | include("pluto-api", "pluto-server") 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/item/trading/Merchant.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/item/trading/Merchant.java 2 | +++ b/net/minecraft/world/item/trading/Merchant.java 3 | @@ -52,5 +_,7 @@ 4 | 5 | boolean stillValid(Player player); 6 | 7 | + boolean stillValid(); // Pluto - Hoppers cache containers 8 | + 9 | org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant(); // CraftBukkit 10 | } 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/alternate/current/wire/UpdateOrder.java.patch: -------------------------------------------------------------------------------- 1 | --- a/alternate/current/wire/UpdateOrder.java 2 | +++ b/alternate/current/wire/UpdateOrder.java 3 | @@ -351,6 +_,8 @@ 4 | } 5 | }; 6 | 7 | + public static final UpdateOrder[] VALUES = values(); // Pluto - Avoid excessive calls to Enum#values 8 | + 9 | private final int[][] directNeighbors; 10 | private final int[][] cardinalNeighbors; 11 | 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/TickingBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/TickingBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/TickingBlockEntity.java 3 | @@ -10,4 +_,6 @@ 4 | BlockPos getPos(); 5 | 6 | String getType(); 7 | + 8 | + default long getChunkPos() { return net.minecraft.world.level.ChunkPos.asLong(getPos()); } // Pluto - Optimise block entity ticking 9 | } 10 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/vehicle/ContainerEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/vehicle/ContainerEntity.java 2 | +++ b/net/minecraft/world/entity/vehicle/ContainerEntity.java 3 | @@ -51,6 +_,8 @@ 4 | 5 | boolean isRemoved(); 6 | 7 | + @Override default boolean stillValid() { return !isRemoved(); } // Pluto - Hoppers cache containers 8 | + 9 | @Override 10 | default boolean isEmpty() { 11 | return this.isChestVehicleEmpty(); 12 | -------------------------------------------------------------------------------- /pluto-server/src/main/java/gg/pufferfish/pufferfish/util/IterableWrapper.java: -------------------------------------------------------------------------------- 1 | package gg.pufferfish.pufferfish.util; 2 | 3 | import java.util.Iterator; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | public class IterableWrapper implements Iterable { 7 | 8 | private final Iterator iterator; 9 | 10 | public IterableWrapper(Iterator iterator) { 11 | this.iterator = iterator; 12 | } 13 | 14 | @NotNull 15 | @Override 16 | public Iterator iterator() { 17 | return iterator; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /pluto-server/src/main/java/gg/pufferfish/pufferfish/PufferfishLogger.java: -------------------------------------------------------------------------------- 1 | package gg.pufferfish.pufferfish; 2 | 3 | import java.util.logging.Level; 4 | import java.util.logging.Logger; 5 | import org.bukkit.Bukkit; 6 | 7 | public class PufferfishLogger extends Logger { 8 | public static final PufferfishLogger LOGGER = new PufferfishLogger(); 9 | 10 | private PufferfishLogger() { 11 | super("Pufferfish", null); 12 | 13 | setParent(Bukkit.getLogger()); 14 | setLevel(Level.ALL); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/npc/ClientSideMerchant.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/npc/ClientSideMerchant.java 2 | +++ b/net/minecraft/world/entity/npc/ClientSideMerchant.java 3 | @@ -56,6 +_,8 @@ 4 | return this.source == player; 5 | } 6 | 7 | + @Override public boolean stillValid() { return true; } // Pluto - Hoppers cache containers 8 | + 9 | // Paper start 10 | @Override 11 | public org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant() { 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/alternate/current/wire/WireHandler.java.patch: -------------------------------------------------------------------------------- 1 | --- a/alternate/current/wire/WireHandler.java 2 | +++ b/alternate/current/wire/WireHandler.java 3 | @@ -489,7 +_,7 @@ 4 | } 5 | } 6 | 7 | - updateOrder = UpdateOrder.values()[level.paperConfig().misc.alternateCurrentUpdateOrder.ordinal()]; 8 | + updateOrder = UpdateOrder.VALUES[level.paperConfig().misc.alternateCurrentUpdateOrder.ordinal()]; // Pluto - Avoid excessive calls to Enum#values 9 | } 10 | 11 | /** 12 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java 3 | @@ -142,5 +_,7 @@ 4 | public boolean stillValid(Player player) { 5 | return this.tradingPlayer == player; 6 | } 7 | + 8 | + @Override public boolean stillValid() { return true; } // Pluto - Hoppers cache containers 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/ticks/ContainerSingleItem.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/ticks/ContainerSingleItem.java 2 | +++ b/net/minecraft/world/ticks/ContainerSingleItem.java 3 | @@ -62,5 +_,7 @@ 4 | default boolean stillValid(Player player) { 5 | return Container.stillValidBlockEntity(this.getContainerBlockEntity(), player); 6 | } 7 | + 8 | + @Override default boolean stillValid() { return !getContainerBlockEntity().isRemoved(); } // Pluto - Hoppers cache containers 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pluto-api/paper-patches/files/src/main/java/io/papermc/paper/ServerBuildInfo.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/io/papermc/paper/ServerBuildInfo.java 2 | +++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java 3 | @@ -19,6 +_,13 @@ 4 | */ 5 | Key BRAND_PAPER_ID = Key.key("papermc", "paper"); 6 | 7 | + // Pluto start - Branding 8 | + /** 9 | + * The brand id for Pluto. 10 | + */ 11 | + Key BRAND_PLUTO_ID = Key.key("yive", "pluto"); 12 | + // Pluto end - Branding 13 | + 14 | /** 15 | * Gets the {@code ServerBuildInfo}. 16 | * 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/npc/villager/AbstractVillager.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/npc/villager/AbstractVillager.java 2 | +++ b/net/minecraft/world/entity/npc/villager/AbstractVillager.java 3 | @@ -287,4 +_,6 @@ 4 | public boolean stillValid(Player player) { 5 | return this.getTradingPlayer() == player && this.isAlive() && player.isWithinEntityInteractionRange(this, 4.0); 6 | } 7 | + 8 | + @Override public boolean stillValid() { return !this.isRemoved(); } // Pluto - Hoppers cache containers 9 | } 10 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/CakeBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/CakeBlock.java 2 | +++ b/net/minecraft/world/level/block/CakeBlock.java 3 | @@ -145,7 +_,7 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - return level.getBlockState(pos.below()).isSolid(); 8 | + return level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()).isSolid(); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java 3 | @@ -133,6 +_,8 @@ 4 | return Container.stillValidBlockEntity(this, player); 5 | } 6 | 7 | + @Override public boolean stillValid() { return !isRemoved(); } // Pluto - Hoppers cache containers 8 | + 9 | @Override 10 | public void clearContent() { 11 | this.getItems().clear(); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BannerBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BannerBlock.java 2 | +++ b/net/minecraft/world/level/block/BannerBlock.java 3 | @@ -43,7 +_,7 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - return level.getBlockState(pos.below()).isSolid(); 8 | + return level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()).isSolid(); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/util/profiling/Profiler.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/util/profiling/Profiler.java 2 | +++ b/net/minecraft/util/profiling/Profiler.java 3 | @@ -45,6 +_,7 @@ 4 | } 5 | 6 | public static ProfilerFiller get() { 7 | + if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish 8 | return ACTIVE_COUNT.get() == 0 ? getDefaultFiller() : Objects.requireNonNullElseGet(ACTIVE.get(), Profiler::getDefaultFiller); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java 3 | @@ -123,6 +_,8 @@ 4 | return itemStack; 5 | } 6 | 7 | + @Override public boolean stillValid() { return !isRemoved(); } // Pluto - Hoppers cache containers 8 | + 9 | @Override 10 | public void setItem(int slot, ItemStack stack) { 11 | if (this.acceptsItemType(stack)) { 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/AzaleaBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/AzaleaBlock.java 2 | +++ b/net/minecraft/world/level/block/AzaleaBlock.java 3 | @@ -40,7 +_,7 @@ 4 | 5 | @Override 6 | public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { 7 | - return level.getFluidState(pos.above()).isEmpty(); 8 | + return level.pluto$getFluidState(pos.getX(), pos. getY() + 1, pos.getZ()).isEmpty(); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/CandleCakeBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/CandleCakeBlock.java 2 | +++ b/net/minecraft/world/level/block/CandleCakeBlock.java 3 | @@ -125,7 +_,7 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - return level.getBlockState(pos.below()).isSolid(); 8 | + return level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()).isSolid(); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/SeagrassBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/SeagrassBlock.java 2 | +++ b/net/minecraft/world/level/block/SeagrassBlock.java 3 | @@ -73,7 +_,7 @@ 4 | 5 | @Override 6 | public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { 7 | - return level.getBlockState(pos.above()).is(Blocks.WATER); 8 | + return level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).is(Blocks.WATER); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java 3 | @@ -256,7 +_,7 @@ 4 | public int getParticleAmount() { 5 | int i = 0; 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | i += this.shouldRenderFace(direction) ? 1 : 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/core/cauldron/CauldronInteraction.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/core/cauldron/CauldronInteraction.java 2 | +++ b/net/minecraft/core/cauldron/CauldronInteraction.java 3 | @@ -388,7 +_,7 @@ 4 | } 5 | 6 | private static boolean isUnderWater(Level level, BlockPos pos) { 7 | - FluidState fluidState = level.getFluidState(pos.above()); 8 | + FluidState fluidState = level.pluto$getFluidState(pos.getX(), pos.getY() + 1, pos.getZ()); // Pluto - Memory allocation optimisations 9 | return fluidState.is(FluidTags.WATER); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java 2 | +++ b/net/minecraft/world/entity/ai/navigation/AmphibiousPathNavigation.java 3 | @@ -40,7 +_,7 @@ 4 | 5 | @Override 6 | public boolean isStableDestination(BlockPos pos) { 7 | - return !this.level.getBlockState(pos.below()).isAir(); 8 | + return !this.level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()).isAir(); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/FungusBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/FungusBlock.java 2 | +++ b/net/minecraft/world/level/block/FungusBlock.java 3 | @@ -61,7 +_,7 @@ 4 | 5 | @Override 6 | public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { 7 | - BlockState blockState = level.getBlockState(pos.below()); 8 | + BlockState blockState = level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()); // Pluto - Memory allocation optimisations 9 | return blockState.is(this.requiredBlock); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator.java 2 | +++ b/net/minecraft/world/level/redstone/DefaultRedstoneWireEvaluator.java 3 | @@ -35,7 +_,7 @@ 4 | Set set = Sets.newHashSet(); 5 | set.add(pos); 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | set.add(pos.relative(direction)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/CatLieOnBedGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/CatLieOnBedGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/CatLieOnBedGoal.java 3 | @@ -52,6 +_,6 @@ 4 | 5 | @Override 6 | protected boolean isValidTarget(LevelReader level, BlockPos pos) { 7 | - return level.isEmptyBlock(pos.above()) && level.getBlockState(pos).is(BlockTags.BEDS); 8 | + return level.pluto$isEmptyBlock(pos.getX(), pos.getY() + 1, pos.getZ()) && level.getBlockState(pos).is(BlockTags.BEDS); // Pluto - Memory allocation optimisations 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BonemealableFeaturePlacerBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BonemealableFeaturePlacerBlock.java 2 | +++ b/net/minecraft/world/level/block/BonemealableFeaturePlacerBlock.java 3 | @@ -32,7 +_,7 @@ 4 | 5 | @Override 6 | public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { 7 | - return level.getBlockState(pos.above()).isAir(); 8 | + return level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).isAir(); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/CatSitOnBlockGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/CatSitOnBlockGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/CatSitOnBlockGoal.java 3 | @@ -44,7 +_,7 @@ 4 | 5 | @Override 6 | protected boolean isValidTarget(LevelReader level, BlockPos pos) { 7 | - if (!level.isEmptyBlock(pos.above())) { 8 | + if (!level.pluto$isEmptyBlock(pos.getX(), pos.getY() + 1, pos.getZ())) { // Pluto - Memory allocation optimisations 9 | return false; 10 | } else { 11 | BlockState blockState = level.getBlockState(pos); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/phys/Vec3.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/phys/Vec3.java 2 | +++ b/net/minecraft/world/phys/Vec3.java 3 | @@ -75,6 +_,12 @@ 4 | this(vector.getX(), vector.getY(), vector.getZ()); 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + public long asBlockPosLong() { 9 | + return net.minecraft.core.BlockPos.asLong(Mth.floor(x), Mth.floor(y), Mth.floor(z)); 10 | + } 11 | + // Pluto end - Memory allocation optimisations 12 | + 13 | public Vec3 vectorTo(Vec3 vec) { 14 | return new Vec3(vec.x - this.x, vec.y - this.y, vec.z - this.z); 15 | } 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/PoweredBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/PoweredBlock.java 2 | +++ b/net/minecraft/world/level/block/PoweredBlock.java 3 | @@ -28,4 +_,11 @@ 4 | protected int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) { 5 | return 15; 6 | } 7 | + 8 | + // Pluto start - Memory allocation optimisations 9 | + @Override 10 | + protected int pluto$getSignal(BlockState state, BlockGetter level, int x, int y, int z, Direction direction) { 11 | + return 15; 12 | + } 13 | + // Pluto end - Memory allocation optimisations 14 | } 15 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/ShelfBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/ShelfBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/ShelfBlockEntity.java 3 | @@ -124,6 +_,8 @@ 4 | return Container.stillValidBlockEntity(this, player); 5 | } 6 | 7 | + @Override public boolean stillValid() { return Container.stillValidBlockEntity(this); } // Pluto - Hoppers cache containers 8 | + 9 | public ItemStack swapItemNoUpdate(int slot, ItemStack stack) { 10 | ItemStack itemStack = this.removeItemNoUpdate(slot); 11 | this.setItemNoUpdate(slot, stack); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/boss/wither/WitherBoss.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/boss/wither/WitherBoss.java 2 | +++ b/net/minecraft/world/entity/boss/wither/WitherBoss.java 3 | @@ -88,6 +_,13 @@ 4 | this.xpReward = 50; 5 | } 6 | 7 | + // Pufferfish start - optimize suffocation 8 | + @Override 9 | + public boolean shouldCheckForSuffocation() { 10 | + return true; 11 | + } 12 | + // Pufferfish end 13 | + 14 | @Override 15 | protected PathNavigation createNavigation(Level level) { 16 | FlyingPathNavigation flyingPathNavigation = new FlyingPathNavigation(this, level); 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/DirtPathBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/DirtPathBlock.java 2 | +++ b/net/minecraft/world/level/block/DirtPathBlock.java 3 | @@ -70,7 +_,7 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - BlockState blockState = level.getBlockState(pos.above()); 8 | + BlockState blockState = level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()); // Pluto - Memory allocation optimisations 9 | return !blockState.isSolid() || blockState.getBlock() instanceof FenceGateBlock; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/material/FluidState.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/material/FluidState.java 2 | +++ b/net/minecraft/world/level/material/FluidState.java 3 | @@ -165,6 +_,8 @@ 4 | return this.owner.builtInRegistryHolder().tags(); 5 | } 6 | 7 | + public java.util.Collection> pluto$tags() { return this.owner.builtInRegistryHolder().pluto$tags(); } // Pluto - Streamless tags 8 | + 9 | public void entityInside(Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) { 10 | this.getType().entityInside(level, pos, entity, effectApplier); 11 | } 12 | -------------------------------------------------------------------------------- /pluto-api/paper-patches/files/src/main/java/org/bukkit/UnsafeValues.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/UnsafeValues.java 2 | +++ b/src/main/java/org/bukkit/UnsafeValues.java 3 | @@ -271,6 +_,13 @@ 4 | */ 5 | @NotNull Entity deserializeEntity(byte @NotNull [] data, @NotNull World world, boolean preserveUUID, boolean preservePassengers); 6 | 7 | + // Pluto start - Add method to obtain current entity id 8 | + /** 9 | + * Returns the latest entity id. 10 | + */ 11 | + public int currentEntityId(); 12 | + // Pluto end - Add method to obtain current entity id 13 | + 14 | /** 15 | * Creates and returns the next EntityId available. 16 | *

17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/ScaffoldingBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/ScaffoldingBlock.java 2 | +++ b/net/minecraft/world/level/block/ScaffoldingBlock.java 3 | @@ -165,7 +_,7 @@ 4 | return 0; 5 | } 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, direction)); 10 | if (blockState1.is(Blocks.SCAFFOLDING)) { 11 | i = Math.min(i, blockState1.getValue(DISTANCE) + 1); 12 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java 3 | @@ -51,6 +_,13 @@ 4 | executor.prestartAllCoreThreads(); 5 | } 6 | 7 | + // Pluto start - Add schedulers subcommand 8 | + @Override 9 | + public int pluto$getThreadCount() { 10 | + return executor.getPoolSize(); 11 | + } 12 | + // Pluto end - Add schedulers subcommand 13 | + 14 | @Override 15 | public void cancelTask(int taskId) { 16 | this.management.execute(() -> this.removeTask(taskId)); 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/warden/Warden.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/warden/Warden.java 2 | +++ b/net/minecraft/world/entity/monster/warden/Warden.java 3 | @@ -276,10 +_,12 @@ 4 | } 5 | } 6 | 7 | + private int behaviorTick = 0; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("wardenBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | super.customServerAiStep(level); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/TargetBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/TargetBlock.java 2 | +++ b/net/minecraft/world/level/block/TargetBlock.java 3 | @@ -117,6 +_,13 @@ 4 | return state.getValue(OUTPUT_POWER); 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return blockState.getValue(OUTPUT_POWER); 11 | + } 12 | + // Pluto end - Memory allocation optimisations 13 | + 14 | @Override 15 | protected boolean isSignalSource(BlockState state) { 16 | return true; 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/EntityType.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/EntityType.java 2 | +++ b/net/minecraft/world/entity/EntityType.java 3 | @@ -1227,6 +_,8 @@ 4 | private final float spawnDimensionsScale; 5 | private final FeatureFlagSet requiredFeatures; 6 | private final boolean allowedInPeaceful; 7 | + public boolean dabEnabled = false; // Pufferfish 8 | + public int spawnerTTL = -1; // Pluto - TTL setting for entities from spawners 9 | 10 | private static EntityType register(ResourceKey> key, EntityType.Builder builder) { 11 | return Registry.register(BuiltInRegistries.ENTITY_TYPE, key, builder.build(key)); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/BreathAirGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/BreathAirGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/BreathAirGoal.java 3 | @@ -73,6 +_,6 @@ 4 | 5 | private boolean givesAir(LevelReader level, BlockPos pos) { 6 | BlockState blockState = level.getBlockState(pos); 7 | - return (level.getFluidState(pos).isEmpty() || blockState.is(Blocks.BUBBLE_COLUMN)) && blockState.isPathfindable(PathComputationType.LAND); 8 | + return (blockState.getFluidState().isEmpty() || blockState.is(Blocks.BUBBLE_COLUMN)) && blockState.isPathfindable(PathComputationType.LAND); // Pluto - Decrease chunk/block lookups 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java 3 | @@ -146,7 +_,7 @@ 4 | List list = Lists.newArrayList(); 5 | BlockPos.MutableBlockPos mutableBlockPos = blockPos.mutable(); 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | mutableBlockPos.set(blockPos); 10 | 11 | for (int i = 0; i < this.maxRamDistance; i++) { 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/piglin/Piglin.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/piglin/Piglin.java 2 | +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java 3 | @@ -310,10 +_,12 @@ 4 | return !this.cannotHunt; 5 | } 6 | 7 | + private int behaviorTick; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("piglinBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | PiglinAi.updateActivity(this); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/ConcretePowderBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/ConcretePowderBlock.java 2 | +++ b/net/minecraft/world/level/block/ConcretePowderBlock.java 3 | @@ -75,7 +_,7 @@ 4 | boolean flag = false; 5 | BlockPos.MutableBlockPos mutableBlockPos = pos.mutable(); 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | BlockState blockState = level.getBlockState(mutableBlockPos); 10 | if (direction != Direction.DOWN || canSolidify(blockState)) { 11 | mutableBlockPos.setWithOffset(pos, direction); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java 3 | @@ -36,7 +_,11 @@ 4 | 5 | @Override 6 | protected void tick(ServerLevel level, Villager owner, long gameTime) { 7 | - if (gameTime % 100L == 0L) { 8 | + // Pufferfish start 9 | + if (owner.nextGolemPanic < 0) owner.nextGolemPanic = gameTime + 100; 10 | + if (--owner.nextGolemPanic < gameTime) { 11 | + owner.nextGolemPanic = -1; 12 | + // Pufferfish end 13 | owner.spawnGolemIfNeeded(level, gameTime, 3); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/axolotl/Axolotl.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java 2 | +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java 3 | @@ -324,10 +_,12 @@ 4 | return true; 5 | } 6 | 7 | + private int behaviorTick = 0; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("axolotlBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | profilerFiller.push("axolotlActivityUpdate"); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/item/BlockItem.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/item/BlockItem.java 2 | +++ b/net/minecraft/world/item/BlockItem.java 3 | @@ -244,6 +_,7 @@ 4 | public void onDestroyed(ItemEntity itemEntity) { 5 | ItemContainerContents itemContainerContents = itemEntity.getItem().set(DataComponents.CONTAINER, ItemContainerContents.EMPTY); 6 | if (itemContainerContents != null) { 7 | + if (itemEntity.level().plutoConfig().disableShulkersDroppingContentsWhenDestroyed && this.getBlock() instanceof ShulkerBoxBlock) return; // Pluto - Shulker configuration 8 | ItemUtils.onContainerDestroyed(itemEntity, itemContainerContents.nonEmptyItemsCopy()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/MangrovePropaguleBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/MangrovePropaguleBlock.java 2 | +++ b/net/minecraft/world/level/block/MangrovePropaguleBlock.java 3 | @@ -71,7 +_,7 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - return isHanging(state) ? level.getBlockState(pos.above()).is(Blocks.MANGROVE_LEAVES) : super.canSurvive(state, level, pos); 8 | + return isHanging(state) ? level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).is(Blocks.MANGROVE_LEAVES) : super.canSurvive(state, level, pos); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/TntBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/TntBlock.java 2 | +++ b/net/minecraft/world/level/block/TntBlock.java 3 | @@ -71,6 +_,7 @@ 4 | 5 | @Override 6 | public void wasExploded(ServerLevel level, BlockPos pos, Explosion explosion) { 7 | + if (level.plutoConfig().disableTntChainReaction) return; // Pluto - Option to disable TNT chain reactions | Might remove in future version due to gamerule 8 | if (level.getGameRules().get(GameRules.TNT_EXPLODES)) { 9 | PrimedTnt primedTnt = new PrimedTnt(level, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, explosion.getIndirectSourceEntity()); 10 | int fuse = primedTnt.getFuse(); 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/goat/Goat.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/goat/Goat.java 2 | +++ b/net/minecraft/world/entity/animal/goat/Goat.java 3 | @@ -187,10 +_,12 @@ 4 | return (Brain)super.getBrain(); 5 | } 6 | 7 | + private int behaviorTick = 0; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("goatBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | profilerFiller.push("goatActivityUpdate"); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/hoglin/Hoglin.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java 2 | +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java 3 | @@ -161,10 +_,12 @@ 4 | return (Brain)super.getBrain(); 5 | } 6 | 7 | + private int behaviorTick; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("hoglinBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | HoglinAi.updateActivity(this); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BrushableBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BrushableBlock.java 2 | +++ b/net/minecraft/world/level/block/BrushableBlock.java 3 | @@ -85,7 +_,7 @@ 4 | brushableBlockEntity.checkReset(level); 5 | } 6 | 7 | - if (FallingBlock.isFree(level.getBlockState(pos.below())) && pos.getY() >= level.getMinY()) { 8 | + if (FallingBlock.isFree(level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ())) && pos.getY() >= level.getMinY()) { // Pluto - Memory allocation optimisations 9 | FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(level, pos, state); 10 | fallingBlockEntity.disableDrop(); 11 | } 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java 2 | +++ b/net/minecraft/world/level/redstone/RedstoneWireEvaluator.java 3 | @@ -27,7 +_,7 @@ 4 | protected int getIncomingWireSignal(Level level, BlockPos pos) { 5 | int i = 0; 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | BlockPos blockPos = pos.relative(direction); 10 | BlockState blockState = level.getBlockState(blockPos); 11 | i = Math.max(i, this.getWireSignal(blockPos, blockState)); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/fox/Fox.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/fox/Fox.java 2 | +++ b/net/minecraft/world/entity/animal/fox/Fox.java 3 | @@ -743,7 +_,7 @@ 4 | double d4 = d2 == 0.0 ? d1 * (i1 / 6.0F) : d3 / d2; 5 | 6 | for (int i2 = 1; i2 < 4; i2++) { 7 | - if (!fox.level().getBlockState(BlockPos.containing(fox.getX() + d4, fox.getY() + i2, fox.getZ() + d3)).canBeReplaced()) { 8 | + if (!fox.level().pluto$getBlockState(Mth.floor(fox.getX() + d4), Mth.floor(fox.getY() + i2), Mth.floor(fox.getZ() + d3)).canBeReplaced()) { // Pluto - Memory allocation optimisations 9 | return false; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/frog/Tadpole.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/frog/Tadpole.java 2 | +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java 3 | @@ -97,10 +_,12 @@ 4 | return SoundEvents.TADPOLE_FLOP; 5 | } 6 | 7 | + private int behaviorTick = 0; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("tadpoleBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | profilerFiller.push("tadpoleActivityUpdate"); 16 | -------------------------------------------------------------------------------- /pluto-server/src/main/java/dev/yive/pluto/commands/PlutoSubcommand.java: -------------------------------------------------------------------------------- 1 | package dev.yive.pluto.commands; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | import org.bukkit.command.CommandSender; 6 | import org.checkerframework.checker.nullness.qual.NonNull; 7 | import org.checkerframework.framework.qual.DefaultQualifier; 8 | 9 | @DefaultQualifier(NonNull.class) 10 | public interface PlutoSubcommand { 11 | boolean execute(CommandSender sender, String subCommand, String[] args); 12 | 13 | default List tabComplete(final CommandSender sender, final String subCommand, final String[] args) { 14 | return Collections.emptyList(); 15 | } 16 | 17 | default boolean tabCompletes() { 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/NyliumBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/NyliumBlock.java 2 | +++ b/net/minecraft/world/level/block/NyliumBlock.java 3 | @@ -30,8 +_,7 @@ 4 | } 5 | 6 | private static boolean canBeNylium(BlockState state, LevelReader level, BlockPos pos) { 7 | - BlockPos blockPos = pos.above(); 8 | - BlockState blockState = level.getBlockState(blockPos); 9 | + BlockState blockState = level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()); // Pluto - Memory allocation optimisations 10 | int lightBlockInto = LightEngine.getLightBlockInto(state, blockState, Direction.UP, blockState.getLightBlock()); 11 | return lightBlockInto < 15; 12 | } 13 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/SmallDripleafBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/SmallDripleafBlock.java 2 | +++ b/net/minecraft/world/level/block/SmallDripleafBlock.java 3 | @@ -52,7 +_,7 @@ 4 | @Override 5 | protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { 6 | return state.is(BlockTags.SMALL_DRIPLEAF_PLACEABLE) 7 | - || level.getFluidState(pos.above()).isSourceOfType(Fluids.WATER) && super.mayPlaceOn(state, level, pos); 8 | + || level.pluto$getFluidState(pos.getX(), pos.getY() + 1, pos.getZ()).isSourceOfType(Fluids.WATER) && super.mayPlaceOn(state, level, pos); // Pluto - Memory allocation optimisations 9 | } 10 | 11 | @Override 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/sounds/AmbientDesertBlockSoundsPlayer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/sounds/AmbientDesertBlockSoundsPlayer.java 2 | +++ b/net/minecraft/world/level/block/sounds/AmbientDesertBlockSoundsPlayer.java 3 | @@ -58,7 +_,7 @@ 4 | int i1 = 0; 5 | BlockPos.MutableBlockPos mutableBlockPos = pos.mutable(); 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | mutableBlockPos.set(pos).move(direction, 8); 10 | if (columnContainsTriggeringBlock(level, mutableBlockPos) && i++ >= 3) { 11 | return true; 12 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java 3 | @@ -132,6 +_,13 @@ 4 | } 5 | // Paper end 6 | 7 | + 8 | + // Pluto start - Add schedulers subcommand 9 | + public int pluto$getThreadCount() { 10 | + return asyncScheduler instanceof CraftAsyncScheduler ? asyncScheduler.pluto$getThreadCount() : 0; 11 | + } 12 | + // Pluto end - Add schedulers subcommand 13 | + 14 | @Override 15 | public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task) { 16 | return this.scheduleSyncDelayedTask(plugin, task, 0L); 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/FallingBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/FallingBlock.java 2 | +++ b/net/minecraft/world/level/block/FallingBlock.java 3 | @@ -47,7 +_,7 @@ 4 | 5 | @Override 6 | protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { 7 | - if (isFree(level.getBlockState(pos.below())) && pos.getY() >= level.getMinY()) { 8 | + if (isFree(level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ())) && pos.getY() >= level.getMinY()) { // Pluto - Memory allocation optimisations 9 | FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(level, pos, state); 10 | this.falling(fallingBlockEntity); 11 | } 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/equine/AbstractHorse.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/equine/AbstractHorse.java 2 | +++ b/net/minecraft/world/entity/animal/equine/AbstractHorse.java 3 | @@ -343,7 +_,7 @@ 4 | @Override 5 | protected void playStepSound(BlockPos pos, BlockState block) { 6 | if (!block.liquid()) { 7 | - BlockState blockState = this.level().getBlockState(pos.above()); 8 | + BlockState blockState = this.level().pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()); // Pluto - Memory allocation optimisations 9 | SoundType soundType = block.getSoundType(); 10 | if (blockState.is(Blocks.SNOW)) { 11 | soundType = blockState.getSoundType(); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/throwableitemprojectile/AbstractThrownPotion.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/projectile/throwableitemprojectile/AbstractThrownPotion.java 2 | +++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/AbstractThrownPotion.java 3 | @@ -58,7 +_,7 @@ 4 | this.dowseFire(blockPos1); 5 | this.dowseFire(blockPos1.relative(direction.getOpposite())); 6 | 7 | - for (Direction direction1 : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | this.dowseFire(blockPos1.relative(direction1)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/frog/Frog.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/frog/Frog.java 2 | +++ b/net/minecraft/world/entity/animal/frog/Frog.java 3 | @@ -200,10 +_,12 @@ 4 | VariantUtils.readVariant(input, Registries.FROG_VARIANT).ifPresent(this::setVariant); 5 | } 6 | 7 | + private int behaviorTick = 0; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("frogBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | profilerFiller.push("frogActivityUpdate"); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/biome/Biome.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/biome/Biome.java 2 | +++ b/net/minecraft/world/level/biome/Biome.java 3 | @@ -136,7 +_,7 @@ 4 | } else { 5 | if (level.isInsideBuildHeight(water.getY()) && level.getBrightness(LightLayer.BLOCK, water) < 10) { 6 | BlockState blockState = level.getBlockState(water); 7 | - FluidState fluidState = level.getFluidState(water); 8 | + FluidState fluidState = blockState.getFluidState(); // Pluto start - Decrease chunk/block lookups 9 | if (fluidState.getType() == Fluids.WATER && blockState.getBlock() instanceof LiquidBlock) { 10 | if (!mustBeAtEdge) { 11 | return true; 12 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 3 | @@ -680,6 +_,13 @@ 4 | name = name.substring(0, 256); 5 | } 6 | 7 | + // Pluto start - Improve performance of custom name setting 8 | + if (this.getHandle().level().plutoConfig().useCustomNameOptimisation) { 9 | + this.getHandle().setCustomName(CraftChatMessage.fromStringOrNull(name, false, true)); 10 | + return; 11 | + } 12 | + // Pluto end - Improve performance of custom name setting 13 | + 14 | this.getHandle().setCustomName(CraftChatMessage.fromStringOrNull(name)); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/CeilingHangingSignBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/CeilingHangingSignBlock.java 2 | +++ b/net/minecraft/world/level/block/CeilingHangingSignBlock.java 3 | @@ -82,7 +_,10 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - return level.getBlockState(pos.above()).isFaceSturdy(level, pos.above(), Direction.DOWN, SupportType.CENTER); 8 | + // Pluto start - Memory allocation optimisations 9 | + BlockPos above = pos.above(); 10 | + return level.getBlockState(above).isFaceSturdy(level, above, Direction.DOWN, SupportType.CENTER); 11 | + // Pluto end - Memory allocation optimisations 12 | } 13 | 14 | @Override 15 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/DispenserBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/DispenserBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/DispenserBlockEntity.java 3 | @@ -68,6 +_,14 @@ 4 | 5 | public int getRandomSlot(RandomSource random) { 6 | this.unpackLootTable(null); 7 | + // Pluto start - Less random dispensing 8 | + if (this.level != null && this.level.plutoConfig().lessRandomDispensing) { 9 | + for (int i = 0; i < this.items.size(); i++) { 10 | + if (!this.items.get(i).isEmpty()) return i; 11 | + } 12 | + return -1; 13 | + } 14 | + // Pluto end - Less random dispensing 15 | int i = -1; 16 | int i1 = 1; 17 | 18 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonStructureResolver.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/piston/PistonStructureResolver.java 2 | +++ b/net/minecraft/world/level/block/piston/PistonStructureResolver.java 3 | @@ -168,7 +_,7 @@ 4 | private boolean addBranchingBlocks(BlockPos fromPos) { 5 | BlockState blockState = this.level.getBlockState(fromPos); 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | if (direction.getAxis() != this.pushDirection.getAxis()) { 10 | BlockPos blockPos = fromPos.relative(direction); 11 | BlockState blockState1 = this.level.getBlockState(blockPos); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/server/network/ServerGamePacketListenerImpl.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java 2 | +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java 3 | @@ -1293,6 +_,7 @@ 4 | 5 | @Override 6 | public void handleEditBook(ServerboundEditBookPacket packet) { 7 | + if (!gg.pufferfish.pufferfish.PufferfishConfig.enableBooks && !this.player.getBukkitEntity().hasPermission("pufferfish.usebooks")) return; // Pufferfish 8 | // Paper start - Book size limits 9 | final io.papermc.paper.configuration.type.number.IntOr.Disabled pageMax = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; 10 | if (!this.cserver.isPrimaryThread() && pageMax.enabled()) { 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtils.java 3 | @@ -152,7 +_,7 @@ 4 | Vec3 pos = DefaultRandomPos.getPos(pathfinder, radius, verticalDistance); 5 | int i = 0; 6 | 7 | - while (pos != null && !pathfinder.level().getBlockState(BlockPos.containing(pos)).isPathfindable(PathComputationType.WATER) && i++ < 10) { 8 | + while (pos != null && !pathfinder.level().pluto$getBlockState(pos.asBlockPosLong()).isPathfindable(PathComputationType.WATER) && i++ < 10) { // Pluto - Memory allocation optimisations 9 | pos = DefaultRandomPos.getPos(pathfinder, radius, verticalDistance); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Zoglin.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/Zoglin.java 2 | +++ b/net/minecraft/world/entity/monster/Zoglin.java 3 | @@ -247,10 +_,12 @@ 4 | this.setAggressive(this.brain.hasMemoryValue(MemoryModuleType.ATTACK_TARGET)); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("zoglinBrain"); 12 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | this.updateActivity(); 16 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/Main.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/Main.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/Main.java 3 | @@ -169,6 +_,14 @@ 4 | .ofType(String.class) 5 | .defaultsTo("Unknown Server") 6 | .describedAs("Name"); 7 | + 8 | + // Pluto start - Config 9 | + acceptsAll(asList("pluto", "pluto-settings"), "File for pluto settings") 10 | + .withRequiredArg() 11 | + .ofType(File.class) 12 | + .defaultsTo(new File("pluto.yml")) 13 | + .describedAs("Yml file"); 14 | + // Pluto end - Config 15 | } 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/breeze/Breeze.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/breeze/Breeze.java 2 | +++ b/net/minecraft/world/entity/monster/breeze/Breeze.java 3 | @@ -232,10 +_,12 @@ 4 | return pos.closerThan(center, 4.0, 10.0); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("breezeBrain"); 12 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 13 | this.getBrain().tick(level, this); 14 | profilerFiller.popPush("breezeActivityUpdate"); 15 | BreezeAi.updateActivity(this); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/dimension/end/EndDragonFight.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/dimension/end/EndDragonFight.java 2 | +++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java 3 | @@ -551,7 +_,7 @@ 4 | List list = Lists.newArrayList(); 5 | BlockPos blockPos1 = blockPos.above(1); 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | List entitiesOfClass = this.level.getEntitiesOfClass(EndCrystal.class, new AABB(blockPos1.relative(direction, 2))); 10 | if (entitiesOfClass.isEmpty()) { 11 | return false; // CraftBukkit - return value 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/creaking/Creaking.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/creaking/Creaking.java 2 | +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java 3 | @@ -203,10 +_,12 @@ 4 | return (Brain)super.getBrain(); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("creakingBrain"); 12 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 13 | this.getBrain().tick((ServerLevel)this.level(), this); 14 | profilerFiller.pop(); 15 | CreakingAi.updateActivity(this); 16 | -------------------------------------------------------------------------------- /pluto-api/paper-patches/files/src/main/java/org/bukkit/entity/LivingEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/entity/LivingEntity.java 2 | +++ b/src/main/java/org/bukkit/entity/LivingEntity.java 3 | @@ -990,6 +_,22 @@ 4 | */ 5 | void setMemory(@NotNull MemoryKey memoryKey, @Nullable T memoryValue); 6 | 7 | + // Pluto start - Expose some sound related functions 8 | + /** 9 | + * Gets entity sound volume 10 | + * 11 | + * @return entity sound volume 12 | + */ 13 | + float getSoundVolume(); 14 | + 15 | + /** 16 | + * Gets entity voice pitch 17 | + * 18 | + * @return entity voice pitch 19 | + */ 20 | + float getVoicePitch(); 21 | + // Pluto end - Expose some sound related functions 22 | + 23 | /** 24 | * Get the {@link Sound} this entity will make when damaged. 25 | * 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/CocoaBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/CocoaBlock.java 2 | +++ b/net/minecraft/world/level/block/CocoaBlock.java 3 | @@ -60,7 +_,10 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - BlockState blockState = level.getBlockState(pos.relative(state.getValue(FACING))); 8 | + // Pluto start - Memory allocation optimisations 9 | + Direction direction = state.getValue(FACING); 10 | + BlockState blockState = level.pluto$getBlockState(pos.getX() + direction.getStepX(), pos.getY() + direction.getStepY(), pos.getZ() + direction.getStepZ()); 11 | + // Pluto end - Memory allocation optimisations 12 | return blockState.is(BlockTags.JUNGLE_LOGS); 13 | } 14 | 15 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java 3 | @@ -2063,7 +_,7 @@ 4 | 5 | @Override 6 | public boolean canSee(org.bukkit.entity.Entity entity) { 7 | - return this.equals(entity) || entity.isVisibleByDefault() ^ this.invertedVisibilityEntities.containsKey(entity.getUniqueId()); // SPIGOT-7312: Can always see self 8 | + return this.equals(entity) || entity.isVisibleByDefault() ^ (!this.invertedVisibilityEntities.isEmpty() && this.invertedVisibilityEntities.containsKey(entity.getUniqueId())); // SPIGOT-7312: Can always see self // Pluto start - Optimise Player canSee lookups 9 | } 10 | 11 | public boolean canSeePlayer(UUID uuid) { 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/item/EndCrystalItem.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/item/EndCrystalItem.java 2 | +++ b/net/minecraft/world/item/EndCrystalItem.java 3 | @@ -50,7 +_,7 @@ 4 | level.addFreshEntity(endCrystal); 5 | level.gameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos); 6 | EndDragonFight dragonFight = ((ServerLevel)level).getDragonFight(); 7 | - if (dragonFight != null) { 8 | + if (dragonFight != null && gg.pufferfish.pufferfish.PufferfishConfig.allowEndCrystalRespawn) { // Pufferfish 9 | dragonFight.tryRespawn(aboveBlockPos); // Paper - Perf: Do crystal-portal proximity check before entity lookup 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/piglin/PiglinBrute.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java 2 | +++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java 3 | @@ -112,10 +_,12 @@ 4 | return stack.is(Items.GOLDEN_AXE) && super.wantsToPickUp(level, stack); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("piglinBruteBrain"); 12 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | PiglinBruteAi.updateActivity(this); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/sniffer/Sniffer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java 2 | +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java 3 | @@ -463,10 +_,12 @@ 4 | return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("snifferBrain"); 12 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 13 | this.getBrain().tick(level, this); 14 | profilerFiller.popPush("snifferActivityUpdate"); 15 | SnifferAi.updateActivity(this); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/armadillo/Armadillo.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java 2 | +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java 3 | @@ -127,10 +_,12 @@ 4 | return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic)); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("armadilloBrain"); 12 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 13 | ((Brain)this.brain).tick(level, this); 14 | profilerFiller.pop(); 15 | profilerFiller.push("armadilloActivityUpdate"); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/fish/WaterAnimal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/fish/WaterAnimal.java 2 | +++ b/net/minecraft/world/entity/animal/fish/WaterAnimal.java 3 | @@ -78,7 +_,9 @@ 4 | // Paper end - Make water animal spawn height configurable 5 | return pos.getY() >= i 6 | && pos.getY() <= seaLevel 7 | - && level.getFluidState(pos.below()).is(FluidTags.WATER) 8 | - && level.getBlockState(pos.above()).is(Blocks.WATER); 9 | + // Pluto start - Memory allocation optimisations 10 | + && level.pluto$getFluidState(pos.getX(), pos.getY() - 1, pos.getZ()).is(FluidTags.WATER) 11 | + && level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).is(Blocks.WATER); 12 | + // Pluto ebd - Memory efficient block lookups 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/rabbit/Rabbit.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/rabbit/Rabbit.java 2 | +++ b/net/minecraft/world/entity/animal/rabbit/Rabbit.java 3 | @@ -611,7 +_,7 @@ 4 | protected boolean isValidTarget(LevelReader level, BlockPos pos) { 5 | BlockState blockState = level.getBlockState(pos); 6 | if (blockState.is(Blocks.FARMLAND) && this.wantsToRaid && !this.canRaid) { 7 | - blockState = level.getBlockState(pos.above()); 8 | + blockState = level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()); // Pluto - Memory allocation optimisations 9 | if (blockState.getBlock() instanceof CarrotBlock && ((CarrotBlock)blockState.getBlock()).isMaxAge(blockState)) { 10 | this.canRaid = true; 11 | return true; 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/RedstoneWallTorchBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/RedstoneWallTorchBlock.java 2 | +++ b/net/minecraft/world/level/block/RedstoneWallTorchBlock.java 3 | @@ -89,6 +_,13 @@ 4 | return state.getValue(LIT) && state.getValue(FACING) != side ? 15 : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction side) { 10 | + return blockState.getValue(LIT) && blockState.getValue(FACING) != side ? 15 : 0; 11 | + } 12 | + // Pluto end - Memory allocation optimisations 13 | + 14 | @Override 15 | protected BlockState rotate(BlockState state, Rotation rotation) { 16 | return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); 17 | -------------------------------------------------------------------------------- /pluto-server/src/main/java/dev/yive/pluto/commands/PlutoCommands.java: -------------------------------------------------------------------------------- 1 | package dev.yive.pluto.commands; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import net.minecraft.server.MinecraftServer; 6 | import org.bukkit.command.Command; 7 | import org.checkerframework.checker.nullness.qual.NonNull; 8 | import org.checkerframework.framework.qual.DefaultQualifier; 9 | 10 | @DefaultQualifier(NonNull.class) 11 | public final class PlutoCommands { 12 | 13 | private PlutoCommands() { 14 | } 15 | 16 | private static final Map COMMANDS = new HashMap<>(); 17 | 18 | public static void registerCommands(final MinecraftServer server) { 19 | COMMANDS.put("pluto", new PlutoCommand("pluto")); 20 | 21 | COMMANDS.forEach((s, command) -> { 22 | server.server.getCommandMap().register(s, "Pluto", command); 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/AgeableWaterCreature.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/AgeableWaterCreature.java 2 | +++ b/net/minecraft/world/entity/animal/AgeableWaterCreature.java 3 | @@ -74,7 +_,9 @@ 4 | // Paper end - Make water animal spawn height configurable 5 | return pos.getY() >= i 6 | && pos.getY() <= seaLevel 7 | - && level.getFluidState(pos.below()).is(FluidTags.WATER) 8 | - && level.getBlockState(pos.above()).is(Blocks.WATER); 9 | + // Pluto start - Memory allocation optimisations 10 | + && level.pluto$getFluidState(pos.getX(), pos.getY() - 1, pos.getZ()).is(FluidTags.WATER) 11 | + && level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).is(Blocks.WATER); 12 | + // Pluto end - Memory allocation optimisations 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java 3 | @@ -2230,7 +_,7 @@ 4 | public static boolean handleBlockFailedDispenseEvent(ServerLevel serverLevel, BlockPos pos) { 5 | org.bukkit.block.Block block = CraftBlock.at(serverLevel, pos); 6 | io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block); 7 | - return event.callEvent(); 8 | + return event.callEvent() && !serverLevel.plutoConfig().skipFailedDispenseLevelEvent; // Pluto - Option to skip firing level events on failed dispense 9 | } 10 | 11 | public static boolean handleBlockPreDispenseEvent(ServerLevel serverLevel, BlockPos pos, ItemStack itemStack, int slot) { 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/camel/Camel.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/camel/Camel.java 2 | +++ b/net/minecraft/world/entity/animal/camel/Camel.java 3 | @@ -156,11 +_,13 @@ 4 | return pose == Pose.SITTING ? SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("camelBrain"); 12 | Brain brain = this.getBrain(); 13 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 14 | ((Brain)brain).tick(level, this); 15 | profilerFiller.pop(); 16 | profilerFiller.push("camelActivityUpdate"); 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/golem/CopperGolem.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/golem/CopperGolem.java 2 | +++ b/net/minecraft/world/entity/animal/golem/CopperGolem.java 3 | @@ -180,10 +_,12 @@ 4 | this.setWeatherState(input.read("weather_state", WeatheringCopper.WeatherState.CODEC).orElse(WeatheringCopper.WeatherState.UNAFFECTED)); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("copperGolemBrain"); 12 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | profilerFiller.push("copperGolemActivityUpdate"); 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/SaplingBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/SaplingBlock.java 2 | +++ b/net/minecraft/world/level/block/SaplingBlock.java 3 | @@ -45,7 +_,7 @@ 4 | 5 | @Override 6 | protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { 7 | - if (level.getMaxLocalRawBrightness(pos.above()) >= 9 && random.nextFloat() < (level.spigotConfig.saplingModifier / (100.0F * 7))) { // Spigot - SPIGOT-7159: Better modifier resolution 8 | + if ((level.plutoConfig().saplingIgnoreLightLevel || level.getMaxLocalRawBrightness(pos.above()) >= 9) && random.nextFloat() < (level.spigotConfig.saplingModifier / (100.0F * 7))) { // Spigot - SPIGOT-7159: Better modifier resolution // Pluto - Toggle for light lookups on certain flora 9 | this.advanceTree(level, pos, state, random); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java 3 | @@ -151,7 +_,9 @@ 4 | ChunkAccess chunk = level.getChunkIfLoadedImmediately(pos.getX() >> 4, pos.getZ() >> 4); // Paper - Prevent AI rules from loading chunks 5 | return chunk != null 6 | && chunk.getBlockState(pos).is(this.blockToRemove) 7 | - && chunk.getBlockState(pos.above()).isAir() 8 | - && chunk.getBlockState(pos.above(2)).isAir(); 9 | + // Pluto start - Memory allocation optimisations 10 | + && chunk.getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).isAir() 11 | + && chunk.getBlockState(pos.getX(), pos.getY() + 2, pos.getZ()).isAir(); 12 | + // Pluto end - Memory allocation optimisations 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/GoalSelector.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/GoalSelector.java 2 | +++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java 3 | @@ -36,9 +_,13 @@ 4 | } 5 | 6 | // Paper start - EAR 2 7 | - public boolean inactiveTick() { 8 | + // Pufferfish start 9 | + public boolean inactiveTick(int tickRate, boolean inactive) { 10 | + if (inactive && !gg.pufferfish.pufferfish.PufferfishConfig.dearEnabled) tickRate = 4; // reset to Paper's 11 | + tickRate = Math.min(tickRate, 3); 12 | this.curRate++; 13 | - return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct 14 | + return this.curRate % tickRate == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct 15 | + // Pufferfish end 16 | } 17 | 18 | public boolean hasTasks() { 19 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/DaylightDetectorBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/DaylightDetectorBlock.java 2 | +++ b/net/minecraft/world/level/block/DaylightDetectorBlock.java 3 | @@ -57,6 +_,13 @@ 4 | return state.getValue(POWER); 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return blockState.getValue(POWER); 11 | + } 12 | + // Pluto end - Memory allocation optimisations 13 | + 14 | private static void updateSignalStrength(BlockState state, Level level, BlockPos pos) { 15 | int i = level.getBrightness(LightLayer.SKY, pos) - level.getSkyDarken(); 16 | float f = level.environmentAttributes().getValue(EnvironmentAttributes.SUN_ANGLE, pos) * (float) (Math.PI / 180.0); 17 | -------------------------------------------------------------------------------- /scripts/upstreamCommit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # requires curl & jq 4 | 5 | # upstreamCommit 6 | # param: bashHash - the commit hash to use for comparing commits (baseHash...newHash) 7 | # param: newHash - the commit hash to use for comparing commits 8 | 9 | ( 10 | set -e 11 | PS1="$" 12 | 13 | paper=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/PaperMC/Paper/compare/$1...$2 | jq -r '.commits[] | "PaperMC/Paper@\(.sha[:7]) \(.commit.message | split("\r\n")[0] | split("\n")[0])"') 14 | 15 | updated="" 16 | logsuffix="" 17 | if [ ! -z "paper" ]; then 18 | logsuffix="$logsuffix\n\nPaper Changes:\n$paper" 19 | updated="Paper" 20 | fi 21 | disclaimer="Upstream has released updates that appear to apply and compile correctly" 22 | 23 | log="${UP_LOG_PREFIX}Updated Upstream ($updated)\n\n${disclaimer}${logsuffix}" 24 | 25 | echo -e "$log" | git commit -F - 26 | 27 | ) || exit 1 28 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/JukeboxBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/JukeboxBlock.java 2 | +++ b/net/minecraft/world/level/block/JukeboxBlock.java 3 | @@ -93,6 +_,13 @@ 4 | return level.getBlockEntity(pos) instanceof JukeboxBlockEntity jukeboxBlockEntity && jukeboxBlockEntity.getSongPlayer().isPlaying() ? 15 : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState state, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return level.getBlockEntity(new BlockPos(x, y, z)) instanceof JukeboxBlockEntity jukeboxBlockEntity && jukeboxBlockEntity.getSongPlayer().isPlaying() ? 15 : 0; 11 | + } 12 | + // Pluto end - Memory allocation optimisations 13 | + 14 | @Override 15 | protected boolean hasAnalogOutputSignal(BlockState state) { 16 | return true; 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/happyghast/HappyGhast.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java 2 | +++ b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java 3 | @@ -385,11 +_,13 @@ 4 | return HappyGhastAi.makeBrain(this.brainProvider().makeBrain(dynamic)); 5 | } 6 | 7 | + private int behaviourTick = 0; // Pluto - Add DAB to more entities 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | if (this.isBaby()) { 11 | ProfilerFiller profilerFiller = Profiler.get(); 12 | profilerFiller.push("happyGhastBrain"); 13 | + if (this.behaviourTick++ % this.activatedPriority == 0) // Pluto - Add DAB to more entities 14 | ((Brain)this.brain).tick(level, this); 15 | profilerFiller.pop(); 16 | profilerFiller.push("happyGhastActivityUpdate"); 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java 2 | +++ b/net/minecraft/world/level/block/CalibratedSculkSensorBlock.java 3 | @@ -58,6 +_,13 @@ 4 | return direction != state.getValue(FACING) ? super.getSignal(state, level, pos, direction) : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState state, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return direction != state.getValue(FACING) ? super.pluto$getSignal(state, level, x, y, z, direction) : 0; 11 | + } 12 | + // Pluto end - Memory allocation optimisations 13 | + 14 | @Override 15 | protected void createBlockStateDefinition(StateDefinition.Builder builder) { 16 | super.createBlockStateDefinition(builder); 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/DolphinJumpGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/DolphinJumpGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/DolphinJumpGoal.java 3 | @@ -42,7 +_,10 @@ 4 | 5 | private boolean waterIsClear(BlockPos pos, int dx, int dz, int scale) { 6 | BlockPos blockPos = pos.offset(dx * scale, 0, dz * scale); 7 | - return this.dolphin.level().getFluidState(blockPos).is(FluidTags.WATER) && !this.dolphin.level().getBlockState(blockPos).blocksMotion(); 8 | + // Pluto start - Decrease chunk/block lookups 9 | + net.minecraft.world.level.block.state.BlockState state = this.dolphin.level().getBlockState(blockPos); 10 | + return state.getFluidState().is(FluidTags.WATER) && !state.blocksMotion(); 11 | + // Pluto end - Decrease chunk/block lookups 12 | } 13 | 14 | private boolean surfaceIsClear(BlockPos pos, int dx, int dz, int scale) { 15 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/ComparatorBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/ComparatorBlock.java 2 | +++ b/net/minecraft/world/level/block/ComparatorBlock.java 3 | @@ -63,6 +_,13 @@ 4 | : super.updateShape(state, level, scheduledTickAccess, pos, direction, neighborPos, neighborState, random); 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getOutputSignal(BlockGetter level, int x, int y, int z, BlockState state) { 10 | + return level.getBlockEntity(new BlockPos(x, y, z)) instanceof ComparatorBlockEntity comparatorBlockEntity ? comparatorBlockEntity.getOutputSignal() : 0; 11 | + } 12 | + // Pluto end - Memory allocation optimisations 13 | + 14 | @Override 15 | protected int getOutputSignal(BlockGetter level, BlockPos pos, BlockState state) { 16 | BlockEntity blockEntity = level.getBlockEntity(pos); 17 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java 3 | @@ -856,6 +_,18 @@ 4 | this.getHandle().getBrain().setMemory(CraftMemoryKey.bukkitToMinecraft(memoryKey), CraftMemoryMapper.toNms(t)); 5 | } 6 | 7 | + // Pluto start - Expose some sound related functions 8 | + @Override 9 | + public float getSoundVolume() { 10 | + return this.getHandle().pluto$GetSoundVolume(); 11 | + } 12 | + 13 | + @Override 14 | + public float getVoicePitch() { 15 | + return this.getHandle().pluto$GetVoicePitch(); 16 | + } 17 | + // Pluto end - Expose some sound related functions 18 | + 19 | @Override 20 | public Sound getHurtSound() { 21 | SoundEvent sound = this.getHandle().getHurtSound(this.getHandle().damageSources().generic()); 22 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java 3 | @@ -44,6 +_,6 @@ 4 | data.add(this.toNMS(i, true)); 5 | } 6 | 7 | - MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data))); 8 | + MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftRecipe.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.ShapelessRecipe(this.getGroup(), CraftRecipe.getCategory(this.getCategory()), CraftItemStack.asNMSCopy(this.getResult()), data, true))); // Pufferfish 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/EatBlockGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/EatBlockGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/EatBlockGoal.java 3 | @@ -32,7 +_,12 @@ 4 | return false; 5 | } else { 6 | BlockPos blockPos = this.mob.blockPosition(); 7 | - return IS_EDIBLE.test(this.level.getBlockState(blockPos)) || this.level.getBlockState(blockPos.below()).is(Blocks.GRASS_BLOCK); 8 | + // Pluto start - Decrease chunk/block lookups 9 | + net.minecraft.world.level.chunk.LevelChunk chunk = this.level.getChunkIfLoaded(blockPos); 10 | + if (chunk == null) return false; 11 | + 12 | + return IS_EDIBLE.test(chunk.getBlockState(blockPos)) || chunk.getBlockState(blockPos.getX(), blockPos.getY() - 1, blockPos.getZ()).is(Blocks.GRASS_BLOCK); 13 | + // Pluto end - Decrease chunk/block lookups 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java 3 | @@ -119,6 +_,7 @@ 4 | for (int i4 = 0; i4 <= i3; i4 = i4 > 0 ? -i4 : 1 - i4) { 5 | for (int i5 = i4 < i3 && i4 > -i3 ? i3 : 0; i5 <= i3; i5 = i5 > 0 ? -i5 : 1 - i5) { 6 | mutableBlockPos.setWithOffset(blockPos, i4, i2 - 1, i5); 7 | + if (!this.mob.level().hasChunkAt(mutableBlockPos)) continue; // Pufferfish - if this block isn't loaded, continue 8 | if (this.mob.isWithinHome(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { 9 | this.blockPos = mutableBlockPos; 10 | this.mob.movingTarget = mutableBlockPos == BlockPos.ZERO ? null : mutableBlockPos.immutable(); // Paper 11 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/SimpleContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/SimpleContainer.java 2 | +++ b/net/minecraft/world/SimpleContainer.java 3 | @@ -63,6 +_,13 @@ 4 | return this.bukkitOwner; 5 | } 6 | 7 | + // Pluto start - Allow toggling snapshots for certain blocks 8 | + @Override 9 | + public org.bukkit.inventory.@Nullable InventoryHolder getOwner(boolean useSnapshot) { 10 | + return getOwner(); 11 | + } 12 | + // Pluto end - Allow toggling snapshots for certain blocks 13 | + 14 | @Override 15 | public org.bukkit.@Nullable Location getLocation() { 16 | // Paper start - Fix inventories returning null Locations 17 | @@ -243,6 +_,8 @@ 18 | public boolean stillValid(Player player) { 19 | return true; 20 | } 21 | + 22 | + @Override public boolean stillValid() { return true; } // Pluto - Hoppers cache containers 23 | 24 | @Override 25 | public void clearContent() { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java 2 | +++ b/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java 3 | @@ -254,7 +_,7 @@ 4 | Vec3 vec3 = new Vec3(Mth.floor(eventPos.x) + 0.5, Mth.floor(eventPos.y) + 0.5, Mth.floor(eventPos.z) + 0.5); 5 | Vec3 vec31 = new Vec3(Mth.floor(vibrationUserPos.x) + 0.5, Mth.floor(vibrationUserPos.y) + 0.5, Mth.floor(vibrationUserPos.z) + 0.5); 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | Vec3 vec32 = vec3.relative(direction, 1.0E-5F); 10 | if (level.isBlockInLine(new ClipBlockStateContext(vec32, vec31, state -> state.is(BlockTags.OCCLUDES_VIBRATION_SIGNALS))).getType() 11 | != HitResult.Type.BLOCK) { 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/GoToClosestVillage.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/GoToClosestVillage.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/GoToClosestVillage.java 3 | @@ -24,7 +_,7 @@ 4 | for (int i1 = 0; i1 < 5; i1++) { 5 | Vec3 pos = LandRandomPos.getPos(villager, 15, 7, pos1 -> -poiManager.sectionsToVillage(SectionPos.of(pos1))); 6 | if (pos != null) { 7 | - int i2 = poiManager.sectionsToVillage(SectionPos.of(BlockPos.containing(pos))); 8 | + int i2 = poiManager.sectionsToVillage(SectionPos.of(net.minecraft.util.Mth.floor(pos.x) >> 4, net.minecraft.util.Mth.floor(pos.y) >> 4, net.minecraft.util.Mth.floor(pos.z) >> 4)); // Pluto - Memory allocation optimisations 9 | if (i2 < i) { 10 | vec3 = pos; 11 | break; 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/MushroomBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/MushroomBlock.java 2 | +++ b/net/minecraft/world/level/block/MushroomBlock.java 3 | @@ -84,7 +_,7 @@ 4 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 5 | BlockPos blockPos = pos.below(); 6 | BlockState blockState = level.getBlockState(blockPos); 7 | - return blockState.is(BlockTags.MUSHROOM_GROW_BLOCK) || level.getRawBrightness(pos, 0) < 13 && this.mayPlaceOn(blockState, level, blockPos); 8 | + return blockState.is(BlockTags.MUSHROOM_GROW_BLOCK) || ((level instanceof ServerLevel serverLevel && serverLevel.plutoConfig().mushroomIgnoreLightLevel) || level.getRawBrightness(pos, 0) < 13) && this.mayPlaceOn(blockState, level, blockPos); // Pluto - Toggle for light lookups on certain flora 9 | } 10 | 11 | public boolean growMushroom(ServerLevel level, BlockPos pos, BlockState state, RandomSource random) { 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/LecternBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/LecternBlock.java 2 | +++ b/net/minecraft/world/level/block/LecternBlock.java 3 | @@ -220,6 +_,18 @@ 4 | return side == Direction.UP && state.getValue(POWERED) ? 15 : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return blockState.getValue(POWERED) ? 15 : 0; 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter blockAccess, int x, int y, int z, Direction side) { 15 | + return side == Direction.UP && blockState.getValue(POWERED) ? 15 : 0; 16 | + } 17 | + // Pluto end - Memory allocation optimisations 18 | + 19 | @Override 20 | protected boolean hasAnalogOutputSignal(BlockState state) { 21 | return true; 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BasePressurePlateBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BasePressurePlateBlock.java 2 | +++ b/net/minecraft/world/level/block/BasePressurePlateBlock.java 3 | @@ -147,6 +_,18 @@ 4 | return side == Direction.UP ? this.getSignalForState(state) : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return this.getSignalForState(blockState); 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction side) { 15 | + return side == Direction.UP ? this.getSignalForState(blockState) : 0; 16 | + } 17 | + // Pluto end - Memory allocation optimisations 18 | + 19 | @Override 20 | protected boolean isSignalSource(BlockState state) { 21 | return true; 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/ButtonBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/ButtonBlock.java 2 | +++ b/net/minecraft/world/level/block/ButtonBlock.java 3 | @@ -149,6 +_,18 @@ 4 | return state.getValue(POWERED) && getConnectedDirection(state) == side ? 15 : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return blockState.getValue(POWERED) ? 15 : 0; 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction side) { 15 | + return blockState.getValue(POWERED) && getConnectedDirection(blockState) == side ? 15 : 0; 16 | + } 17 | + // Pluto end - Memory allocation optimisations 18 | + 19 | @Override 20 | protected boolean isSignalSource(BlockState state) { 21 | return true; 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/LeverBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/LeverBlock.java 2 | +++ b/net/minecraft/world/level/block/LeverBlock.java 3 | @@ -141,6 +_,18 @@ 4 | return state.getValue(POWERED) && getConnectedDirection(state) == side ? 15 : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return blockState.getValue(POWERED) ? 15 : 0; 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter blockAccess, int x, int y, int z, Direction side) { 15 | + return blockState.getValue(POWERED) && getConnectedDirection(blockState) == side ? 15 : 0; 16 | + } 17 | + // Pluto end - Memory allocation optimisations 18 | + 19 | @Override 20 | protected boolean isSignalSource(BlockState state) { 21 | return true; 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/inventory/TransientCraftingContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/inventory/TransientCraftingContainer.java 2 | +++ b/net/minecraft/world/inventory/TransientCraftingContainer.java 3 | @@ -45,6 +_,13 @@ 4 | return (this.owner == null) ? null : this.owner.getBukkitEntity(); 5 | } 6 | 7 | + // Pluto start - Allow toggling snapshots for certain blocks 8 | + @Override 9 | + public @javax.annotation.Nullable org.bukkit.inventory.InventoryHolder getOwner(boolean useSnapshot) { 10 | + return getOwner(); 11 | + } 12 | + // Pluto end - Allow toggling snapshots for certain blocks 13 | + 14 | @Override 15 | public int getMaxStackSize() { 16 | return this.maxStack; 17 | @@ -138,6 +_,8 @@ 18 | public boolean stillValid(Player player) { 19 | return true; 20 | } 21 | + 22 | + @Override public boolean stillValid() { return true; } // Pluto - Hoppers cache containers 23 | 24 | @Override 25 | public void clearContent() { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java 2 | +++ b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecart.java 3 | @@ -330,10 +_,10 @@ 4 | int floor2 = Mth.floor(this.getZ()); 5 | if (useExperimentalMovement(this.level())) { 6 | double d = this.getY() - 0.1 - 1.0E-5F; 7 | - if (this.level().getBlockState(BlockPos.containing(floor, d, floor2)).is(BlockTags.RAILS)) { 8 | + if (this.level().pluto$getBlockState(floor, d, floor2).is(BlockTags.RAILS)) { // Pluto - Memory allocation optimisations 9 | floor1 = Mth.floor(d); 10 | } 11 | - } else if (this.level().getBlockState(new BlockPos(floor, floor1 - 1, floor2)).is(BlockTags.RAILS)) { 12 | + } else if (this.level().pluto$getBlockState(floor, floor1 - 1, floor2).is(BlockTags.RAILS)) { // Pluto - Memory allocation optimisations 13 | floor1--; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/core/Holder.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/core/Holder.java 2 | +++ b/net/minecraft/core/Holder.java 3 | @@ -29,6 +_,8 @@ 4 | 5 | Stream> tags(); 6 | 7 | + Collection> pluto$tags(); // Pluto - Streamless Tags 8 | + 9 | Either, T> unwrap(); 10 | 11 | Optional> unwrapKey(); 12 | @@ -105,6 +_,8 @@ 13 | public Stream> tags() { 14 | return Stream.of(); 15 | } 16 | + 17 | + @Override public Collection> pluto$tags() { return java.util.Set.of(); } // Pluto - Streamless Tags 18 | } 19 | 20 | public static enum Kind { 21 | @@ -234,6 +_,8 @@ 22 | public Stream> tags() { 23 | return this.boundTags().stream(); 24 | } 25 | + 26 | + @Override public Collection> pluto$tags() { return this.boundTags(); } // Pluto - Streamless tags 27 | 28 | @Override 29 | public String toString() { 30 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/TripWireHookBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/TripWireHookBlock.java 2 | +++ b/net/minecraft/world/level/block/TripWireHookBlock.java 3 | @@ -266,6 +_,22 @@ 4 | } 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return blockState.getValue(POWERED) ? 15 : 0; 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter blockAccess, int x, int y, int z, Direction side) { 15 | + if (!blockState.getValue(POWERED)) { 16 | + return 0; 17 | + } else { 18 | + return blockState.getValue(FACING) == side ? 15 : 0; 19 | + } 20 | + } 21 | + // Pluto end - Memory allocation optimisations 22 | + 23 | @Override 24 | protected boolean isSignalSource(BlockState state) { 25 | return true; 26 | -------------------------------------------------------------------------------- /pluto-api/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java: -------------------------------------------------------------------------------- 1 | package gg.pufferfish.pufferfish.simd; 2 | 3 | import java.util.logging.Logger; 4 | 5 | @Deprecated 6 | public class SIMDDetection { 7 | 8 | public static boolean isEnabled = false; 9 | public static boolean versionLimited = false; 10 | public static boolean testRun = false; 11 | 12 | @Deprecated 13 | public static boolean canEnable(Logger logger) { 14 | try { 15 | return SIMDChecker.canEnable(logger); 16 | } catch (NoClassDefFoundError | Exception ignored) { 17 | return false; 18 | } 19 | } 20 | 21 | @Deprecated 22 | public static int getJavaVersion() { 23 | // https://stackoverflow.com/a/2591122 24 | String version = System.getProperty("java.version"); 25 | if(version.startsWith("1.")) { 26 | version = version.substring(2, 3); 27 | } else { 28 | int dot = version.indexOf("."); 29 | if(dot != -1) { version = version.substring(0, dot); } 30 | } 31 | version = version.split("-")[0]; // Azul is stupid 32 | return Integer.parseInt(version); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/network/Connection.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/network/Connection.java 2 | +++ b/net/minecraft/network/Connection.java 3 | @@ -405,6 +_,14 @@ 4 | return; 5 | } 6 | 7 | + // Pluto start - Disabled packets 8 | + final net.minecraft.server.level.ServerPlayer player = this.getPlayer(); 9 | + if (player != null) { 10 | + if (player.level().plutoConfig().disableAllSounds && packet.type().id().getPath().startsWith("sound")) return; // Pluto - Option to disable all sound packets 11 | + if (player.level().plutoConfig().disableAllParticles && packet.type().id().getPath().contains("level_particles")) return; // Pluto - Option to disable all particle packets 12 | + } 13 | + // Pluto end - Disabled packets 14 | + 15 | packet.onPacketDispatch(this.getPlayer()); 16 | if (connected && (InnerUtil.canSendImmediate(this, packet) 17 | || (io.papermc.paper.util.MCUtil.isMainThread() && packet.isReady() && this.pendingActions.isEmpty() 18 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java 3 | @@ -180,6 +_,8 @@ 4 | return true; 5 | } 6 | 7 | + @Override public boolean stillValid() { return true; } // Pluto - Hoppers cache containers 8 | + 9 | @Override 10 | public List getContents() { 11 | return this.items; 12 | @@ -208,6 +_,13 @@ 13 | public InventoryHolder getOwner() { 14 | return this.owner; 15 | } 16 | + 17 | + // Pluto start - Allow toggling snapshots for certain blocks 18 | + @Override 19 | + public InventoryHolder getOwner(boolean useSnapshot) { 20 | + return getOwner(); 21 | + } 22 | + // Pluto end - Allow toggling snapshots for certain blocks 23 | 24 | @Override 25 | public boolean canPlaceItem(int slot, ItemStack stack) { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/Container.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/Container.java 2 | +++ b/net/minecraft/world/Container.java 3 | @@ -41,6 +_,14 @@ 4 | 5 | boolean stillValid(Player player); 6 | 7 | + // Pluto start - Hoppers cache containers 8 | + boolean stillValid(); 9 | + static boolean stillValidBlockEntity(BlockEntity blockEntity) { 10 | + Level level = blockEntity.getLevel(); 11 | + return level != null && level.getBlockEntity(blockEntity.getBlockPos()) == blockEntity; 12 | + } 13 | + // Pluto end - Hoppers cache containers 14 | + 15 | default void startOpen(ContainerUser user) { 16 | } 17 | 18 | @@ -151,6 +_,8 @@ 19 | java.util.List getViewers(); 20 | 21 | @javax.annotation.Nullable org.bukkit.inventory.InventoryHolder getOwner(); 22 | + 23 | + @javax.annotation.Nullable org.bukkit.inventory.InventoryHolder getOwner(boolean useSnapshot); // Pluto - Allow toggling snapshots for certain blocks 24 | 25 | void setMaxStackSize(int size); 26 | 27 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/TestBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/TestBlock.java 2 | +++ b/net/minecraft/world/level/block/TestBlock.java 3 | @@ -115,6 +_,19 @@ 4 | } 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState state, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + if (state.getValue(MODE) != TestBlockMode.START) { 11 | + return 0; 12 | + } else if (level.getBlockEntity(new BlockPos(x, y, z)) instanceof TestBlockEntity testBlockEntity) { 13 | + return testBlockEntity.isPowered() ? 15 : 0; 14 | + } else { 15 | + return 0; 16 | + } 17 | + } 18 | + // Pluto end - Memory allocation optimisations 19 | + 20 | @Override 21 | protected ItemStack getCloneItemStack(LevelReader level, BlockPos pos, BlockState state, boolean includeData) { 22 | ItemStack itemStack = super.getCloneItemStack(level, pos, state, includeData); 23 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/TryFindLand.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/TryFindLand.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/TryFindLand.java 3 | @@ -41,7 +_,7 @@ 4 | BlockState blockState = level.getBlockState(blockPos1); 5 | BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(blockPos1, Direction.DOWN)); 6 | if (!blockState.is(Blocks.WATER) 7 | - && level.getFluidState(blockPos1).isEmpty() 8 | + && blockState.getFluidState().isEmpty() // Pluto - Decrease chunk/block lookups 9 | && blockState.getCollisionShape(level, blockPos1, collisionContext).isEmpty() 10 | && blockState1.isFaceSturdy(level, mutableBlockPos, Direction.UP)) { 11 | BlockPos blockPos2 = blockPos1.immutable(); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/TrappedChestBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/TrappedChestBlock.java 2 | +++ b/net/minecraft/world/level/block/TrappedChestBlock.java 3 | @@ -52,4 +_,16 @@ 4 | protected int getDirectSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) { 5 | return side == Direction.UP ? state.getSignal(level, pos, side) : 0; 6 | } 7 | + 8 | + // Pluto start - Memory allocation optimisations 9 | + @Override 10 | + protected int pluto$getSignal(BlockState state, BlockGetter blockAccess, int x, int y, int z, Direction direction) { 11 | + return Mth.clamp(ChestBlockEntity.pluto$getOpenCount(blockAccess, x, y, z), 0, 15); 12 | + } 13 | + 14 | + @Override 15 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter blockAccess, int x, int y, int z, Direction side) { 16 | + return side == Direction.UP ? blockState.pluto$getSignal(blockAccess, x, y, z, side) : 0; 17 | + } 18 | + // Pluto end - Memory allocation optimisations 19 | } 20 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java 2 | +++ b/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java 3 | @@ -99,6 +_,8 @@ 4 | return this.delegate.stillValid(player); 5 | } 6 | 7 | + @Override public boolean stillValid() { return this.delegate.stillValid(); } // Pluto - Hoppers cache containers 8 | + 9 | @Override 10 | public List getContents() { 11 | return this.delegate.getContents(); 12 | @@ -123,6 +_,13 @@ 13 | public InventoryHolder getOwner() { 14 | return this.owner; 15 | } 16 | + 17 | + // Pluto start - Allow toggling snapshots for certain blocks 18 | + @Override 19 | + public InventoryHolder getOwner(boolean useSnapshot) { 20 | + return getOwner(); 21 | + } 22 | + // Pluto end - Allow toggling snapshots for certain blocks 23 | 24 | @Override 25 | public void setMaxStackSize(int size) { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/zombie/Drowned.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/zombie/Drowned.java 2 | +++ b/net/minecraft/world/entity/monster/zombie/Drowned.java 3 | @@ -345,8 +_,10 @@ 4 | 5 | @Override 6 | protected boolean isValidTarget(LevelReader level, BlockPos pos) { 7 | - BlockPos blockPos = pos.above(); 8 | - return level.isEmptyBlock(blockPos) && level.isEmptyBlock(blockPos.above()) && level.getBlockState(pos).entityCanStandOn(level, pos, this.drowned); 9 | + // Pluto start - Decrease chunk/block lookups 10 | + net.minecraft.world.level.chunk.ChunkAccess chunk = level.getChunk(pos); 11 | + return chunk.getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).isAir() && chunk.getBlockState(pos.getX(), pos.getY() + 2, pos.getZ()).isAir() && chunk.getBlockState(pos).entityCanStandOn(level, pos, this.drowned); // Pluto - Memory allocation optimisations 12 | + // Pluto end - Decrease chunk/block lookups 13 | } 14 | 15 | @Override 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java 2 | +++ b/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java 3 | @@ -324,7 +_,14 @@ 4 | if (!entities.isEmpty()) { 5 | boolean flag = !this.level().isClientSide() && !(this.getControllingPassenger() instanceof Player); 6 | 7 | + // Pluto start - Option to remove excess vehicles on collision 8 | + int boatCount = 0; 9 | for (Entity entity : entities) { 10 | + if (entity instanceof Boat && this.level().plutoConfig().removeExcessBoats && boatCount++ >= this.level().plutoConfig().excessBoatsLimit) { 11 | + entity.discard(); 12 | + continue; 13 | + } 14 | + // Pluto end - Option to remove excess vehicles on collision 15 | if (!entity.hasPassenger(this)) { 16 | if (flag 17 | && this.getPassengers().size() < this.getMaxPassengers() 18 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/MultifaceBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/MultifaceBlock.java 2 | +++ b/net/minecraft/world/level/block/MultifaceBlock.java 3 | @@ -73,7 +_,7 @@ 4 | } else { 5 | Set set = EnumSet.noneOf(Direction.class); 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : DIRECTIONS) { // Pluto - Avoid excessive calls to Enum#values 9 | if (hasFace(state, direction)) { 10 | set.add(direction); 11 | } 12 | @@ -86,7 +_,7 @@ 13 | public static Set unpack(byte packedDirections) { 14 | Set set = EnumSet.noneOf(Direction.class); 15 | 16 | - for (Direction direction : Direction.values()) { 17 | + for (Direction direction : DIRECTIONS) { // Pluto - Avoid excessive calls to Enum#values 18 | if ((packedDirections & (byte)(1 << direction.ordinal())) > 0) { 19 | set.add(direction); 20 | } 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/CoralBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/CoralBlock.java 2 | +++ b/net/minecraft/world/level/block/CoralBlock.java 3 | @@ -65,8 +_,13 @@ 4 | } 5 | 6 | protected boolean scanForWater(BlockGetter level, BlockPos pos) { 7 | - for (Direction direction : Direction.values()) { 8 | - FluidState fluidState = level.getFluidState(pos.relative(direction)); 9 | + // Pluto start - Memory allocation optimisations 10 | + final int x = pos.getX(); 11 | + final int y = pos.getY(); 12 | + final int z = pos.getZ(); 13 | + // Pluto end - Memory allocation optimisations 14 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 15 | + FluidState fluidState = level.pluto$getFluidState(x + direction.getStepX(), y + direction.getStepY(), z + direction.getStepZ()); // Pluto - Memory allocation optimisations 16 | if (fluidState.is(FluidTags.WATER)) { 17 | return true; 18 | } 19 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/TryFindLandNearWater.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/TryFindLandNearWater.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/TryFindLandNearWater.java 3 | @@ -40,7 +_,7 @@ 4 | && !level.getBlockState(mutableBlockPos.setWithOffset(blockPos1, Direction.DOWN)) 5 | .getCollisionShape(level, blockPos1, collisionContext) 6 | .isEmpty()) { 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | mutableBlockPos.setWithOffset(blockPos1, direction); 10 | if (level.getBlockState(mutableBlockPos).isAir() 11 | && level.getBlockState(mutableBlockPos.move(Direction.DOWN)).is(Blocks.WATER)) { 12 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java 3 | @@ -481,7 +_,7 @@ 4 | 5 | @Override 6 | public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { 7 | - return new com.destroystokyo.paper.PaperVersionFetcher(); 8 | + return new gg.pufferfish.pufferfish.PufferfishVersionFetcher(); // Pufferfish 9 | } 10 | 11 | @Override 12 | @@ -775,6 +_,13 @@ 13 | Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); 14 | return compound; 15 | } 16 | + 17 | + // Pluto start - Add method to obtain current entity id 18 | + @Override 19 | + public int currentEntityId() { 20 | + return net.minecraft.world.entity.Entity.currentEntityId(); 21 | + } 22 | + // Pluto end - Add method to obtain current entity id 23 | 24 | @Override 25 | public int nextEntityId() { 26 | -------------------------------------------------------------------------------- /pluto-api/paper-patches/files/src/main/java/org/bukkit/map/MapPalette.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/map/MapPalette.java 2 | +++ b/src/main/java/org/bukkit/map/MapPalette.java 3 | @@ -35,7 +_,7 @@ 4 | } 5 | 6 | @NotNull 7 | - static final Color[] colors = { 8 | + public static final Color[] colors = { // Pufferfish - public access 9 | // Start generate - MapPalette#colors 10 | new Color(0x00000000, true), 11 | new Color(0x00000000, true), 12 | @@ -394,6 +_,12 @@ 13 | temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth()); 14 | 15 | byte[] result = new byte[temp.getWidth() * temp.getHeight()]; 16 | + // Pufferfish start 17 | + if (gg.pufferfish.pufferfish.simd.SIMDDetection.isEnabled) { 18 | + gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result); 19 | + return result; 20 | + } 21 | + // Pufferfish end 22 | for (int i = 0; i < pixels.length; i++) { 23 | result[i] = matchColor(new Color(pixels[i], true)); 24 | } 25 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/npc/villager/Villager.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/npc/villager/Villager.java 2 | +++ b/net/minecraft/world/entity/npc/villager/Villager.java 3 | @@ -287,7 +_,10 @@ 4 | super.inactiveTick(); 5 | } 6 | // Paper end - EAR 2 7 | - 8 | + // Pufferfish start 9 | + public long nextGolemPanic = -1; 10 | + private int behaviorTick = 0; 11 | + // Pufferfish end 12 | @Override 13 | protected void customServerAiStep(ServerLevel level) { 14 | // Paper start - EAR 2 15 | @@ -297,7 +_,7 @@ 16 | // Paper end - EAR 2 17 | ProfilerFiller profilerFiller = Profiler.get(); 18 | profilerFiller.push("villagerBrain"); 19 | - if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2 20 | + if (!inactive && this.behaviorTick++ % this.activatedPriority == 0) this.getBrain().tick(level, this); // Paper - EAR 2 // Pufferfish 21 | profilerFiller.pop(); 22 | if (this.assignProfessionWhenSpawned) { 23 | this.assignProfessionWhenSpawned = false; 24 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/LightningRodBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/LightningRodBlock.java 2 | +++ b/net/minecraft/world/level/block/LightningRodBlock.java 3 | @@ -81,6 +_,18 @@ 4 | return state.getValue(POWERED) && state.getValue(FACING) == direction ? 15 : 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState state, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return state.getValue(POWERED) ? 15 : 0; 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getDirectSignal(BlockState state, BlockGetter level, int x, int y, int z, Direction direction) { 15 | + return state.getValue(POWERED) && state.getValue(FACING) == direction ? 15 : 0; 16 | + } 17 | + // Pluto end - Memory allocation optimisations 18 | + 19 | public void onLightningStrike(BlockState state, Level level, BlockPos pos) { 20 | // CraftBukkit start 21 | boolean powered = state.getValue(LightningRodBlock.POWERED); 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/ObserverBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/ObserverBlock.java 2 | +++ b/net/minecraft/world/level/block/ObserverBlock.java 3 | @@ -111,6 +_,18 @@ 4 | return state.getSignal(level, pos, side); 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter blockAccess, int x, int y, int z, Direction side) { 10 | + return blockState.pluto$getSignal(blockAccess, x, y, z, side); 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction side) { 15 | + return blockState.getValue(POWERED) && blockState.getValue(FACING) == side ? 15 : 0; 16 | + } 17 | + // Pluto end - Memory allocation optimisations 18 | + 19 | @Override 20 | protected int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) { 21 | return state.getValue(POWERED) && state.getValue(FACING) == side ? 15 : 0; 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/inventory/ResultContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/inventory/ResultContainer.java 2 | +++ b/net/minecraft/world/inventory/ResultContainer.java 3 | @@ -29,6 +_,13 @@ 4 | // Paper end - Add missing InventoryHolders 5 | } 6 | 7 | + // Pluto start - Allow toggling snapshots for certain blocks 8 | + @Override 9 | + public org.bukkit.inventory.@Nullable InventoryHolder getOwner(boolean useSnapshot) { 10 | + return getOwner(); 11 | + } 12 | + // Pluto end - Allow toggling snapshots for certain blocks 13 | + 14 | // Don't need a transaction; the InventoryCrafting keeps track of it for us 15 | public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {} 16 | public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity player) {} 17 | @@ -105,6 +_,8 @@ 18 | public boolean stillValid(Player player) { 19 | return true; 20 | } 21 | + 22 | + @Override public boolean stillValid() { return true; } // Pluto - Hoppers cache containers 23 | 24 | @Override 25 | public void clearContent() { 26 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java 2 | +++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java 3 | @@ -32,6 +_,8 @@ 4 | 5 | private static final String BRAND_PAPER_NAME = "Paper"; 6 | 7 | + private static final String BRAND_PLUTO_NAME = "Pluto"; // Pluto - Branding 8 | + 9 | private static final String BUILD_DEV = "DEV"; 10 | 11 | public ServerBuildInfoImpl() { 12 | @@ -42,9 +_,9 @@ 13 | this( 14 | getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID) 15 | .map(Key::key) 16 | - .orElse(BRAND_PAPER_ID), 17 | + .orElse(BRAND_PLUTO_ID), // Pluto - Branding 18 | getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME) 19 | - .orElse(BRAND_PAPER_NAME), 20 | + .orElse(BRAND_PLUTO_NAME), // Pluto - Branding 21 | SharedConstants.getCurrentVersion().id(), 22 | SharedConstants.getCurrentVersion().name(), 23 | getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER) 24 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java 2 | +++ b/net/minecraft/world/level/block/BaseCoralPlantTypeBlock.java 3 | @@ -42,8 +_,13 @@ 4 | if (state.getValue(WATERLOGGED)) { 5 | return true; 6 | } else { 7 | - for (Direction direction : Direction.values()) { 8 | - if (level.getFluidState(pos.relative(direction)).is(FluidTags.WATER)) { 9 | + // Pluto start - Memory allocation optimisations 10 | + final int x = pos.getX(); 11 | + final int y = pos.getY(); 12 | + final int z = pos.getZ(); 13 | + // Pluto end - Memory allocation optimisations 14 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 15 | + if (level.pluto$getFluidState(x + direction.getStepX(), y + direction.getStepY(), z + direction.getStepZ()).is(FluidTags.WATER)) { // Pluto - Memory allocation optimisations 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/WaterlilyBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/WaterlilyBlock.java 2 | +++ b/net/minecraft/world/level/block/WaterlilyBlock.java 3 | @@ -49,8 +_,12 @@ 4 | 5 | @Override 6 | protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { 7 | - FluidState fluidState = level.getFluidState(pos); 8 | - FluidState fluidState1 = level.getFluidState(pos.above()); 9 | - return (fluidState.getType() == Fluids.WATER || state.getBlock() instanceof IceBlock) && fluidState1.getType() == Fluids.EMPTY; 10 | + // Pluto start - Memory allocation optimisations 11 | + final int x = pos.getX(); 12 | + final int y = pos.getY(); 13 | + final int z = pos.getZ(); 14 | + FluidState fluidState = level.pluto$getFluidState(x, y, z); 15 | + return (fluidState.getType() == Fluids.WATER || state.getBlock() instanceof IceBlock) && level.pluto$getFluidState(x, y + 1, z).getType() == Fluids.EMPTY; // Pluto - Decrease chunk/block lookups 16 | + // Pluto end - Memory allocation optimisations 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/ChestBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/ChestBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/ChestBlockEntity.java 3 | @@ -208,6 +_,20 @@ 4 | return 0; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + public static int pluto$getOpenCount(BlockGetter level, int x, int y, int z) { 9 | + BlockState blockState = level.pluto$getBlockState(x, y, z); 10 | + if (blockState.hasBlockEntity()) { 11 | + BlockEntity blockEntity = level.getBlockEntity(new BlockPos(x, y, z)); 12 | + if (blockEntity instanceof ChestBlockEntity) { 13 | + return ((ChestBlockEntity)blockEntity).openersCounter.getOpenerCount(); 14 | + } 15 | + } 16 | + 17 | + return 0; 18 | + } 19 | + // Pluto end - Memory allocation optimisations 20 | + 21 | public static void swapContents(ChestBlockEntity chest, ChestBlockEntity otherChest) { 22 | NonNullList items = chest.getItems(); 23 | chest.setItems(otherChest.getItems()); 24 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/ComposterBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/ComposterBlock.java 2 | +++ b/net/minecraft/world/level/block/ComposterBlock.java 3 | @@ -431,6 +_,8 @@ 4 | public boolean canTakeItemThroughFace(int index, ItemStack stack, Direction direction) { 5 | return false; 6 | } 7 | + 8 | + @Override public boolean stillValid() { return false; } // Pluto - Hoppers cache containers 9 | } 10 | 11 | public static class InputContainer extends SimpleContainer implements WorldlyContainer { 12 | @@ -482,6 +_,8 @@ 13 | this.removeItemNoUpdate(0); 14 | } 15 | } 16 | + 17 | + @Override public boolean stillValid() { return false; } // Pluto - Hoppers cache containers 18 | } 19 | 20 | public static class OutputContainer extends SimpleContainer implements WorldlyContainer { 21 | @@ -530,5 +_,7 @@ 22 | } 23 | // CraftBukkit end 24 | } 25 | + 26 | + @Override public boolean stillValid() { return false; } // Pluto - Hoppers cache containers 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/piston/PistonBaseBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/piston/PistonBaseBlock.java 2 | +++ b/net/minecraft/world/level/block/piston/PistonBaseBlock.java 3 | @@ -128,7 +_,7 @@ 4 | } 5 | 6 | private boolean getNeighborSignal(SignalGetter level, BlockPos pos, Direction direction) { 7 | - for (Direction direction1 : Direction.values()) { 8 | + for (Direction direction1 : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | if (direction1 != direction && level.hasSignal(pos.relative(direction1), direction1)) { 10 | return true; 11 | } 12 | @@ -139,7 +_,7 @@ 13 | } else { 14 | BlockPos blockPos = pos.above(); 15 | 16 | - for (Direction direction2 : Direction.values()) { 17 | + for (Direction direction2 : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 18 | if (direction2 != Direction.DOWN && level.hasSignal(blockPos.relative(direction2), direction2)) { 19 | return true; 20 | } 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/fish/TropicalFish.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/fish/TropicalFish.java 2 | +++ b/net/minecraft/world/entity/animal/fish/TropicalFish.java 3 | @@ -261,8 +_,10 @@ 4 | public static boolean checkTropicalFishSpawnRules( 5 | EntityType entityType, LevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random 6 | ) { 7 | - return level.getFluidState(pos.below()).is(FluidTags.WATER) 8 | - && level.getBlockState(pos.above()).is(Blocks.WATER) 9 | + // Pluto start - Memory allocation optimisations 10 | + return level.pluto$getFluidState(pos.getX(), pos.getY() - 1, pos.getZ()).is(FluidTags.WATER) 11 | + && level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).is(Blocks.WATER) 12 | + // Pluto end - Memory allocation optimisations 13 | && ( 14 | level.getBiome(pos).is(BiomeTags.ALLOWS_TROPICAL_FISH_SPAWNS_AT_ANY_HEIGHT) 15 | || WaterAnimal.checkSurfaceWaterAnimalSpawnRules(entityType, level, spawnReason, pos, random) 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/state/pattern/BlockPattern.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/state/pattern/BlockPattern.java 2 | +++ b/net/minecraft/world/level/block/state/pattern/BlockPattern.java 3 | @@ -76,8 +_,10 @@ 4 | int max = Math.max(Math.max(this.width, this.height), this.depth); 5 | 6 | for (BlockPos blockPos : BlockPos.betweenClosed(pos, pos.offset(max - 1, max - 1, max - 1))) { 7 | - for (Direction direction : Direction.values()) { 8 | - for (Direction direction1 : Direction.values()) { 9 | + // Pluto start - Avoid excessive calls to Enum#values 10 | + for (Direction direction : Direction.VALUES) { 11 | + for (Direction direction1 : Direction.VALUES) { 12 | + // Pluto end - Avoid excessive calls to Enum#values 13 | if (direction1 != direction && direction1 != direction.getOpposite()) { 14 | BlockPattern.BlockPatternMatch blockPatternMatch = this.matches(blockPos, direction, direction1, loadingCache); 15 | if (blockPatternMatch != null) { 16 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/DetectorRailBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/DetectorRailBlock.java 2 | +++ b/net/minecraft/world/level/block/DetectorRailBlock.java 3 | @@ -78,6 +_,22 @@ 4 | } 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction direction) { 10 | + return blockState.getValue(POWERED) ? 15 : 0; 11 | + } 12 | + 13 | + @Override 14 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction side) { 15 | + if (!blockState.getValue(POWERED)) { 16 | + return 0; 17 | + } else { 18 | + return side == Direction.UP ? 15 : 0; 19 | + } 20 | + } 21 | + // Pluto end - Memory allocation optimisations 22 | + 23 | private void checkPressed(Level level, BlockPos pos, BlockState state) { 24 | if (this.canSurvive(state, level, pos)) { 25 | if (!state.is(this)) { return; } // Paper - Fix some rails connecting improperly 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/CompoundContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/CompoundContainer.java 2 | +++ b/net/minecraft/world/CompoundContainer.java 3 | @@ -44,6 +_,13 @@ 4 | return null; // This method won't be called since CraftInventoryDoubleChest doesn't defer to here 5 | } 6 | 7 | + // Pluto start - Allow toggling snapshots for certain blocks 8 | + @Override 9 | + public @javax.annotation.Nullable org.bukkit.inventory.InventoryHolder getOwner(boolean useSnapshot) { 10 | + return null; 11 | + } 12 | + // Pluto end - Allow toggling snapshots for certain blocks 13 | + 14 | public void setMaxStackSize(int size) { 15 | this.container1.setMaxStackSize(size); 16 | this.container2.setMaxStackSize(size); 17 | @@ -119,6 +_,8 @@ 18 | public boolean stillValid(Player player) { 19 | return this.container1.stillValid(player) && this.container2.stillValid(player); 20 | } 21 | + 22 | + @Override public boolean stillValid() { return this.container1.stillValid() && this.container2.stillValid(); } // Pluto - Hoppers cache containers 23 | 24 | @Override 25 | public void startOpen(ContainerUser user) { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/dolphin/Dolphin.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/dolphin/Dolphin.java 2 | +++ b/net/minecraft/world/entity/animal/dolphin/Dolphin.java 3 | @@ -443,8 +_,10 @@ 4 | } 5 | 6 | if (posTowards != null) { 7 | - BlockPos blockPos = BlockPos.containing(posTowards); 8 | - if (!level.getFluidState(blockPos).is(FluidTags.WATER) || !level.getBlockState(blockPos).isPathfindable(PathComputationType.WATER)) { 9 | + // Pluto start - Decrease chunk/block lookups 10 | + net.minecraft.world.level.block.state.BlockState state = level.pluto$getBlockState(posTowards.asBlockPosLong()); // Pluto - Memory allocation optimisations 11 | + if (!state.getFluidState().is(FluidTags.WATER) || !state.isPathfindable(PathComputationType.WATER)) { 12 | + // Pluto end - Decrease chunk/block lookups 13 | posTowards = DefaultRandomPos.getPosTowards(this.dolphin, 8, 5, vec3, (float) (Math.PI / 2)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /pluto-server/src/main/java/gg/pufferfish/pufferfish/sentry/SentryManager.java: -------------------------------------------------------------------------------- 1 | package gg.pufferfish.pufferfish.sentry; 2 | 3 | import io.sentry.Sentry; 4 | import org.apache.logging.log4j.LogManager; 5 | import org.apache.logging.log4j.Logger; 6 | import gg.pufferfish.pufferfish.PufferfishConfig; 7 | 8 | public class SentryManager { 9 | 10 | private static final Logger logger = LogManager.getLogger(SentryManager.class); 11 | 12 | private SentryManager() { 13 | 14 | } 15 | 16 | private static boolean initialized = false; 17 | 18 | public static synchronized void init() { 19 | if (initialized) { 20 | return; 21 | } 22 | try { 23 | initialized = true; 24 | 25 | Sentry.init(options -> { 26 | options.setDsn(PufferfishConfig.sentryDsn); 27 | options.setMaxBreadcrumbs(100); 28 | }); 29 | 30 | PufferfishSentryAppender appender = new PufferfishSentryAppender(); 31 | appender.start(); 32 | ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()).addAppender(appender); 33 | logger.info("Sentry logging started!"); 34 | } catch (Exception e) { 35 | logger.warn("Failed to initialize sentry!", e); 36 | initialized = false; 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java 2 | +++ b/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java 3 | @@ -51,7 +_,7 @@ 4 | int i = 0; 5 | Map map = Maps.newEnumMap(Direction.class); 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | Node node1 = this.findAcceptedNode(node.x + direction.getStepX(), node.y + direction.getStepY(), node.z + direction.getStepZ()); 10 | map.put(direction, node1); 11 | if (this.isNodeValid(node1)) { 12 | @@ -59,7 +_,7 @@ 13 | } 14 | } 15 | 16 | - for (Direction direction1 : Direction.Plane.HORIZONTAL) { 17 | + for (Direction direction1 : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 18 | Direction clockWise = direction1.getClockWise(); 19 | if (hasMalus(map.get(direction1)) && hasMalus(map.get(clockWise))) { 20 | Node node2 = this.findAcceptedNode( 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/LeavesBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/LeavesBlock.java 2 | +++ b/net/minecraft/world/level/block/LeavesBlock.java 3 | @@ -118,11 +_,14 @@ 4 | 5 | private static BlockState updateDistance(BlockState state, LevelAccessor level, BlockPos pos) { 6 | int i = 7; 7 | - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); 8 | + // Pluto start - Memory allocation optimisations 9 | + final int x = pos.getX(); 10 | + final int y = pos.getY(); 11 | + final int z = pos.getZ(); 12 | 13 | - for (Direction direction : Direction.values()) { 14 | - mutableBlockPos.setWithOffset(pos, direction); 15 | - i = Math.min(i, getDistanceAt(level.getBlockState(mutableBlockPos)) + 1); 16 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 17 | + i = Math.min(i, getDistanceAt(level.pluto$getBlockState(x + direction.getStepX(), y + direction.getStepY(), z + direction.getStepZ())) + 1); 18 | + // Pluto end - Memory allocation optimisations 19 | if (i == 1) { 20 | break; 21 | } 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/SweetBerryBushBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/SweetBerryBushBlock.java 2 | +++ b/net/minecraft/world/level/block/SweetBerryBushBlock.java 3 | @@ -71,7 +_,7 @@ 4 | @Override 5 | protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { 6 | int ageValue = state.getValue(AGE); 7 | - if (ageValue < 3 && random.nextFloat() < (level.spigotConfig.sweetBerryModifier / (100.0F * 5)) && level.getRawBrightness(pos.above(), 0) >= 9) { // Spigot - SPIGOT-7159: Better modifier resolution 8 | + if (ageValue < 3 && random.nextFloat() < (level.spigotConfig.sweetBerryModifier / (100.0F * 5)) && (level.plutoConfig().sweetBerryBushIgnoreLightLevel || level.getRawBrightness(pos.above(), 0) >= 9)) { // Spigot - SPIGOT-7159: Better modifier resolution // Pluto - Toggle for light lookups on certain flora 9 | BlockState blockState = state.setValue(AGE, ageValue + 1); 10 | if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(level, pos, blockState, 2)) return; // CraftBukkit 11 | level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); 12 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/redstone/Orientation.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/redstone/Orientation.java 2 | +++ b/net/minecraft/world/level/redstone/Orientation.java 3 | @@ -135,7 +_,7 @@ 4 | start.withSideBias.put(sideBias, generateContext(new Orientation(start.up, start.front, sideBias), output)); 5 | } 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | Direction direction1 = start.up; 10 | if (direction == start.up) { 11 | direction1 = start.front.getOpposite(); 12 | @@ -148,7 +_,7 @@ 13 | start.withFront.put(direction, generateContext(new Orientation(direction1, direction, start.sideBias), output)); 14 | } 15 | 16 | - for (Direction direction : Direction.values()) { 17 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 18 | Direction direction1x = start.front; 19 | if (direction == start.front) { 20 | direction1x = start.up.getOpposite(); 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/LecternBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/LecternBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/LecternBlockEntity.java 3 | @@ -76,6 +_,13 @@ 4 | return LecternBlockEntity.this.getOwner(); 5 | } 6 | 7 | + // Pluto start - Allow toggling snapshots for certain blocks 8 | + @Override 9 | + public org.bukkit.inventory.InventoryHolder getOwner(boolean useSnapshot) { 10 | + return LecternBlockEntity.this.getOwner(useSnapshot); 11 | + } 12 | + // Pluto end - Allow toggling snapshots for certain blocks 13 | + 14 | public LecternBlockEntity getLectern() { 15 | return LecternBlockEntity.this; 16 | } 17 | @@ -148,6 +_,8 @@ 18 | public boolean stillValid(Player player) { 19 | return Container.stillValidBlockEntity(LecternBlockEntity.this, player) && LecternBlockEntity.this.hasBook(); 20 | } 21 | + 22 | + @Override public boolean stillValid() { return !LecternBlockEntity.this.isRemoved(); } // Pluto - Hoppers cache containers 23 | 24 | @Override 25 | public boolean canPlaceItem(int slot, ItemStack stack) { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BonemealableBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BonemealableBlock.java 2 | +++ b/net/minecraft/world/level/block/BonemealableBlock.java 3 | @@ -26,9 +_,17 @@ 4 | } 5 | 6 | private static Optional getSpreadableNeighbourPos(List directions, LevelReader level, BlockPos pos, BlockState state) { 7 | + // Pluto start - Memory allocation optimisations 8 | + final int x = pos.getX(); 9 | + final int y = pos.getY(); 10 | + final int z = pos.getZ(); 11 | for (Direction direction : directions) { 12 | - BlockPos blockPos = pos.relative(direction); 13 | - if (level.isEmptyBlock(blockPos) && state.canSurvive(level, blockPos)) { 14 | + final int x1 = x + direction.getStepX(); 15 | + final int y1 = y + direction.getStepY(); 16 | + final int z1 = z + direction.getStepZ(); 17 | + BlockPos blockPos; 18 | + if (level.pluto$isEmptyBlock(x1, y1, z1) && state.canSurvive(level, blockPos = new BlockPos(x1, y1, z1))) { 19 | + // Pluto end - Memory allocation optimisations 20 | return Optional.of(blockPos); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/goal/ClimbOnTopOfPowderSnowGoal.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/goal/ClimbOnTopOfPowderSnowGoal.java 2 | +++ b/net/minecraft/world/entity/ai/goal/ClimbOnTopOfPowderSnowGoal.java 3 | @@ -23,9 +_,10 @@ 4 | public boolean canUse() { 5 | boolean flag = this.mob.wasInPowderSnow || this.mob.isInPowderSnow; 6 | if (flag && this.mob.getType().is(EntityTypeTags.POWDER_SNOW_WALKABLE_MOBS)) { 7 | - BlockPos blockPos = this.mob.blockPosition().above(); 8 | - BlockState blockState = this.level.getBlockState(blockPos); 9 | - return blockState.is(Blocks.POWDER_SNOW) || blockState.getCollisionShape(this.level, blockPos) == Shapes.empty(); 10 | + // Pluto start - Memory allocation optimisations 11 | + BlockState blockState = this.level.pluto$getBlockState(this.mob.blockPosition().getX(), this.mob.blockPosition().getY() + 1, this.mob.blockPosition().getZ()); 12 | + return blockState.is(Blocks.POWDER_SNOW) || blockState.getCollisionShape(this.level, this.mob.blockPosition().above()) == Shapes.empty(); 13 | + // Pluto end - Memory allocation optimisations 14 | } else { 15 | return false; 16 | } 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/turtle/Turtle.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/turtle/Turtle.java 2 | +++ b/net/minecraft/world/entity/animal/turtle/Turtle.java 3 | @@ -383,7 +_,7 @@ 4 | posTowards = DefaultRandomPos.getPosTowards(this.turtle, 8, 7, vec3, (float) (Math.PI / 2)); 5 | } 6 | 7 | - if (posTowards != null && !flag && !this.turtle.level().getBlockState(BlockPos.containing(posTowards)).is(Blocks.WATER)) { 8 | + if (posTowards != null && !flag && !this.turtle.level().pluto$getBlockState(posTowards.asBlockPosLong()).is(Blocks.WATER)) { // Pluto - Memory allocation optimisations 9 | posTowards = DefaultRandomPos.getPosTowards(this.turtle, 16, 5, vec3, (float) (Math.PI / 2)); 10 | } 11 | 12 | @@ -481,7 +_,7 @@ 13 | 14 | @Override 15 | protected boolean isValidTarget(LevelReader level, BlockPos pos) { 16 | - return level.isEmptyBlock(pos.above()) && TurtleEggBlock.isSand(level, pos); 17 | + return level.pluto$isEmptyBlock(pos.getX(), pos.getY() + 1, pos.getZ()) && TurtleEggBlock.isSand(level, pos); // Pluto - Memory allocation optimisations 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ExperienceOrb.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ExperienceOrb.java 2 | +++ b/net/minecraft/world/entity/ExperienceOrb.java 3 | @@ -180,7 +_,7 @@ 4 | this.applyEffectsFromBlocks(); 5 | float f = 0.98F; 6 | if (this.onGround()) { 7 | - f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; 8 | + f = this.level().pluto$getBlockState(this.pluto$getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; // Pluto - Memory allocation optimisations 9 | } 10 | 11 | this.setDeltaMovement(this.getDeltaMovement().scale(f)); 12 | @@ -239,6 +_,13 @@ 13 | public BlockPos getBlockPosBelowThatAffectsMyMovement() { 14 | return this.getOnPos(0.999999F); 15 | } 16 | + 17 | + // Pluto start - Memory allocation optimisations 18 | + @Override 19 | + public long pluto$getBlockPosBelowThatAffectsMyMovement() { 20 | + return this.pluto$getOnPos((float) DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0); 21 | + } 22 | + // Pluto end - Memory allocation optimisations 23 | 24 | private void scanForMerges() { 25 | if (this.level() instanceof ServerLevel) { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Silverfish.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/Silverfish.java 2 | +++ b/net/minecraft/world/entity/monster/Silverfish.java 3 | @@ -141,8 +_,7 @@ 4 | RandomSource random = this.mob.getRandom(); 5 | if (getServerLevel(this.mob).getGameRules().get(GameRules.MOB_GRIEFING) && random.nextInt(reducedTickDelay(10)) == 0) { 6 | this.selectedDirection = Direction.getRandom(random); 7 | - BlockPos blockPos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5, this.mob.getZ()).relative(this.selectedDirection); 8 | - BlockState blockState = this.mob.level().getBlockState(blockPos); 9 | + BlockState blockState = this.mob.level().pluto$getBlockState(net.minecraft.util.Mth.floor(this.mob.getX()) + this.selectedDirection.getStepX(), net.minecraft.util.Mth.floor(this.mob.getY() + 0.5) + this.selectedDirection.getStepY(), net.minecraft.util.Mth.floor(this.mob.getZ()) + this.selectedDirection.getStepZ()); // Pluto - Memory allocation optimisations 10 | if (InfestedBlock.isCompatibleHostBlock(blockState)) { 11 | this.doMerge = true; 12 | return true; 13 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/squid/Squid.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/squid/Squid.java 2 | +++ b/net/minecraft/world/entity/animal/squid/Squid.java 3 | @@ -260,9 +_,8 @@ 4 | Squid.this.getX() - lastHurtByMob.getX(), Squid.this.getY() - lastHurtByMob.getY(), Squid.this.getZ() - lastHurtByMob.getZ() 5 | ); 6 | BlockState blockState = Squid.this.level() 7 | - .getBlockState(BlockPos.containing(Squid.this.getX() + vec3.x, Squid.this.getY() + vec3.y, Squid.this.getZ() + vec3.z)); 8 | - FluidState fluidState = Squid.this.level() 9 | - .getFluidState(BlockPos.containing(Squid.this.getX() + vec3.x, Squid.this.getY() + vec3.y, Squid.this.getZ() + vec3.z)); 10 | + .pluto$getBlockState(Mth.floor(Squid.this.getX() + vec3.x), Mth.floor(Squid.this.getY() + vec3.y), Mth.floor(Squid.this.getZ() + vec3.z)); // Pluto - Memory allocation optimisations 11 | + FluidState fluidState = blockState.getFluidState(); // Pluto - Decrease chunk/block lookups 12 | if (fluidState.is(FluidTags.WATER) || blockState.isAir()) { 13 | double len = vec3.length(); 14 | if (len > 0.0) { 15 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/EnderMan.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/EnderMan.java 2 | +++ b/net/minecraft/world/entity/monster/EnderMan.java 3 | @@ -300,11 +_,15 @@ 4 | private boolean teleport(double x, double y, double z) { 5 | BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, y, z); 6 | 7 | - while (mutableBlockPos.getY() > this.level().getMinY() && !this.level().getBlockState(mutableBlockPos).blocksMotion()) { 8 | + // Pufferfish start - single chunk lookup 9 | + net.minecraft.world.level.chunk.LevelChunk chunk = this.level().getChunkIfLoaded(mutableBlockPos); 10 | + if (chunk == null) return false; 11 | + while (mutableBlockPos.getY() > this.level().getMinY() && !chunk.getBlockState(mutableBlockPos).blocksMotion()) { 12 | + // Pufferfish end 13 | mutableBlockPos.move(Direction.DOWN); 14 | } 15 | 16 | - BlockState blockState = this.level().getBlockState(mutableBlockPos); 17 | + BlockState blockState = chunk.getBlockState(mutableBlockPos); // Pufferfish 18 | boolean flag = blockState.blocksMotion(); 19 | boolean isWater = blockState.getFluidState().is(FluidTags.WATER); 20 | if (flag && !isWater) { 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java 2 | +++ b/net/minecraft/world/level/block/entity/CreakingHeartBlockEntity.java 3 | @@ -89,9 +_,11 @@ 4 | Vec3 vec3 = Vec3.atCenterOf(pos); 5 | float f = 0.2F + 0.8F * (100 - creakingHeart.emitter) / 100.0F; 6 | Vec3 vec31 = vec3.subtract(creakingHeart.emitterTarget).scale(f).add(creakingHeart.emitterTarget); 7 | - BlockPos blockPos = BlockPos.containing(vec31); 8 | + // Pluto start - Memory allocation optimisations 9 | + long blockPos = vec31.asBlockPosLong(); 10 | float f1 = creakingHeart.emitter / 2.0F / 100.0F + 0.5F; 11 | - serverLevel.playSound(null, blockPos, SoundEvents.CREAKING_HEART_HURT, SoundSource.BLOCKS, f1, 1.0F); 12 | + serverLevel.playSound(null, BlockPos.getX(blockPos) + 0.5, BlockPos.getY(blockPos) + 0.5, BlockPos.getZ(blockPos) + 0.5, SoundEvents.CREAKING_HEART_HURT, SoundSource.BLOCKS, f1, 1.0F); 13 | + // Pluto end - Memory allocation optimisations 14 | } 15 | 16 | creakingHeart.emitter--; 17 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/RedStoneOreBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/RedStoneOreBlock.java 2 | +++ b/net/minecraft/world/level/block/RedStoneOreBlock.java 3 | @@ -134,9 +_,13 @@ 4 | double d = 0.5625; 5 | RandomSource randomSource = level.random; 6 | 7 | - for (Direction direction : Direction.values()) { 8 | - BlockPos blockPos = pos.relative(direction); 9 | - if (!level.getBlockState(blockPos).isSolidRender()) { 10 | + // Pluto start - Memory allocation optimisations 11 | + final int x = pos.getX(); 12 | + final int y = pos.getY(); 13 | + final int z = pos.getZ(); 14 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 15 | + if (!level.pluto$getBlockState(x + direction.getStepX(), y + direction.getStepY(), z + direction.getStepZ()).isSolidRender()) { 16 | + // Pluto end - Memory allocation optimisations 17 | Direction.Axis axis = direction.getAxis(); 18 | double d1 = axis == Direction.Axis.X ? 0.5 + 0.5625 * direction.getStepX() : randomSource.nextFloat(); 19 | double d2 = axis == Direction.Axis.Y ? 0.5 + 0.5625 * direction.getStepY() : randomSource.nextFloat(); 20 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java 2 | +++ b/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java 3 | @@ -95,11 +_,9 @@ 4 | public PathType getPathType(PathfindingContext context, int x, int y, int z) { 5 | PathType pathTypeFromState = context.getPathTypeFromState(x, y, z); 6 | if (pathTypeFromState == PathType.WATER) { 7 | - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); 8 | 9 | - for (Direction direction : Direction.values()) { 10 | - mutableBlockPos.set(x, y, z).move(direction); 11 | - PathType pathTypeFromState1 = context.getPathTypeFromState(mutableBlockPos.getX(), mutableBlockPos.getY(), mutableBlockPos.getZ()); 12 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 13 | + PathType pathTypeFromState1 = context.getPathTypeFromState(x + direction.getStepX(), y + direction.getStepY(), z + direction.getStepZ()); // Pluto - Memory allocation optimisations 14 | if (pathTypeFromState1 == PathType.BLOCKED) { 15 | return PathType.WATER_BORDER; 16 | } 17 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | ij_any_block_comment_add_space = false 10 | ij_any_block_comment_at_first_column = false 11 | ij_any_line_comment_at_first_column = false 12 | ij_any_line_comment_add_space = true 13 | 14 | [*.tiny] 15 | indent_style = tab 16 | 17 | [*.bat] 18 | end_of_line = crlf 19 | 20 | [*.yml] 21 | indent_size = 2 22 | 23 | [*.patch] 24 | trim_trailing_whitespace = false 25 | 26 | [*.java] 27 | ij_continuation_indent_size = 4 28 | ij_java_class_count_to_use_import_on_demand = 999999 29 | ij_java_insert_inner_class_imports = false 30 | ij_java_names_count_to_use_import_on_demand = 999999 31 | ij_java_imports_layout = *, |, $* 32 | ij_java_generate_final_locals = true 33 | ij_java_generate_final_parameters = true 34 | ij_java_method_parameters_new_line_after_left_paren = true 35 | ij_java_method_parameters_right_paren_on_new_line = true 36 | ij_java_use_fq_class_names = false 37 | ij_java_class_names_in_javadoc = 1 38 | 39 | [pluto-server/src/minecraft/java/**/*.java] 40 | ij_java_use_fq_class_names = true 41 | 42 | [pluto-server/src/minecraft/resources/data/**/*.json] 43 | indent_size = 2 44 | 45 | [paper-{server,api}/src/generated/java/**/*.java] 46 | ij_java_imports_layout = $*, |, * 47 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/RamTarget.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/RamTarget.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/RamTarget.java 3 | @@ -116,8 +_,15 @@ 4 | 5 | private boolean hasRammedHornBreakingBlock(ServerLevel level, Goat owner) { 6 | Vec3 vec3 = owner.getDeltaMovement().multiply(1.0, 0.0, 1.0).normalize(); 7 | - BlockPos blockPos = BlockPos.containing(owner.position().add(vec3)); 8 | - return level.getBlockState(blockPos).is(BlockTags.SNAPS_GOAT_HORN) || level.getBlockState(blockPos.above()).is(BlockTags.SNAPS_GOAT_HORN); 9 | + // Pluto start - Decrease chunk/block lookups 10 | + final int x = Mth.floor(owner.position().x + vec3.x); 11 | + final int z = Mth.floor(owner.position().z + vec3.z); 12 | + net.minecraft.world.level.chunk.LevelChunk chunk = level.getChunkIfLoaded(x >> 4, z >> 4); 13 | + if (chunk == null) return false; 14 | + 15 | + final int y = Mth.floor(owner.position().z + vec3.z); 16 | + return chunk.getBlockState(x, y, z).is(BlockTags.SNAPS_GOAT_HORN) || chunk.getBlockState(x, y + 1, z).is(BlockTags.SNAPS_GOAT_HORN); 17 | + // Pluto end - Decrease chunk/block lookups 18 | } 19 | 20 | protected void finishRam(ServerLevel level, Goat owner) { 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java 2 | +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java 3 | @@ -129,7 +_,7 @@ 4 | 5 | double floorLevel = this.getFloorLevel(new BlockPos(node.x, node.y, node.z)); 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | Node node1 = this.findAcceptedNode(node.x + direction.getStepX(), node.y, node.z + direction.getStepZ(), i1, floorLevel, direction, cachedPathType1); 10 | this.reusableNeighbors[direction.get2DDataValue()] = node1; 11 | if (this.isNeighborValid(node1, node)) { 12 | @@ -137,7 +_,7 @@ 13 | } 14 | } 15 | 16 | - for (Direction directionx : Direction.Plane.HORIZONTAL) { 17 | + for (Direction directionx : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 18 | Direction clockWise = directionx.getClockWise(); 19 | if (this.isDiagonalValid(node, this.reusableNeighbors[directionx.get2DDataValue()], this.reusableNeighbors[clockWise.get2DDataValue()])) { 20 | Node node2 = this.findAcceptedNode( 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Ghast.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/Ghast.java 2 | +++ b/net/minecraft/world/entity/monster/Ghast.java 3 | @@ -305,7 +_,7 @@ 4 | } else if (blockState.is(BlockTags.HAPPY_GHAST_AVOIDS)) { 5 | return false; 6 | } else { 7 | - FluidState fluidState = level.getFluidState(pos); 8 | + FluidState fluidState = blockState.getFluidState(); // Pluto - Decrease chunk/block lookups 9 | if (!fluidState.isEmpty() && (!flag || this.ghast.collidedWithFluid(fluidState, pos, from, to))) { 10 | if (fluidState.is(FluidTags.WATER)) { 11 | return isInLava; 12 | @@ -462,7 +_,7 @@ 13 | if (!level.getBlockState(blockPos).isAir()) { 14 | return false; 15 | } else { 16 | - for (Direction direction : Direction.values()) { 17 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 18 | for (int i = 1; i < distanceToBlocks; i++) { 19 | BlockPos blockPos1 = blockPos.relative(direction, i); 20 | if (!level.getBlockState(blockPos1).isAir()) { 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/server/dedicated/DedicatedServer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/server/dedicated/DedicatedServer.java 2 | +++ b/net/minecraft/server/dedicated/DedicatedServer.java 3 | @@ -274,6 +_,10 @@ 4 | this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark 5 | com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics 6 | com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now 7 | + gg.pufferfish.pufferfish.PufferfishConfig.load(); // Pufferfish 8 | + gg.pufferfish.pufferfish.PufferfishCommand.init(); // Pufferfish 9 | + dev.yive.pluto.config.PlutoConfig.init((java.io.File) options.valueOf("pluto-settings")); // Pluto - Config 10 | + dev.yive.pluto.commands.PlutoCommands.registerCommands(this); // Pluto - Command 11 | 12 | // this.worldData.setGameType(properties.gameMode.get()); // CraftBukkit - moved to world loading 13 | LOGGER.info("Default game type: {}", properties.gameMode.get()); 14 | @@ -391,6 +_,7 @@ 15 | } 16 | 17 | this.notificationManager().serverStarted(); 18 | + if (gg.pufferfish.pufferfish.PufferfishConfig.enableAsyncMobSpawning) mobSpawnExecutor.start(); // Pufferfish 19 | return true; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java 2 | +++ b/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java 3 | @@ -97,11 +_,16 @@ 4 | private int getSurfaceY() { 5 | if (this.mob.isInWater() && this.canFloat()) { 6 | int blockY = this.mob.getBlockY(); 7 | - BlockState blockState = this.level.getBlockState(BlockPos.containing(this.mob.getX(), blockY, this.mob.getZ())); 8 | + // Pluto start - Decrease chunk/block lookups 9 | + final int x = Mth.floor(this.mob.getX()); 10 | + final int z = Mth.floor(this.mob.getZ()); 11 | + LevelChunk chunk = this.level.getChunk(x >> 4, z >> 4); 12 | + BlockState blockState = chunk.getBlockStateFinal(x, blockY, z); 13 | + // Pluto end - Decrease chunk/block lookups 14 | int i = 0; 15 | 16 | while (blockState.is(Blocks.WATER)) { 17 | - blockState = this.level.getBlockState(BlockPos.containing(this.mob.getX(), ++blockY, this.mob.getZ())); 18 | + blockState = chunk.getBlockStateFinal(x, ++blockY, z); // Pluto - Decrease chunk/block lookups 19 | if (++i > 16) { 20 | return this.mob.getBlockY(); 21 | } 22 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/skeleton/Stray.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/skeleton/Stray.java 2 | +++ b/net/minecraft/world/entity/monster/skeleton/Stray.java 3 | @@ -26,14 +_,20 @@ 4 | public static boolean checkStraySpawnRules( 5 | EntityType entityType, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random 6 | ) { 7 | - BlockPos blockPos = pos; 8 | + // Pluto start - Memory allocation optimisations 9 | + final int x = pos.getX(); 10 | + int y = pos.getY(); 11 | + final int z = pos.getZ(); 12 | + 13 | + net.minecraft.world.level.chunk.ChunkAccess chunk = level.getChunk(pos); 14 | 15 | do { 16 | - blockPos = blockPos.above(); 17 | - } while (level.getBlockState(blockPos).is(Blocks.POWDER_SNOW)); 18 | + y++; 19 | + } while (chunk.getBlockState(x, y, z).is(Blocks.POWDER_SNOW)); 20 | 21 | return Monster.checkMonsterSpawnRules(entityType, level, spawnReason, pos, random) 22 | - && (EntitySpawnReason.isSpawner(spawnReason) || level.canSeeSky(blockPos.below())); 23 | + && (EntitySpawnReason.isSpawner(spawnReason) || level.canSeeSky(new BlockPos(x, y - 1, z))); 24 | + // Pluto end - Memory allocation optimisations 25 | } 26 | 27 | @Override 28 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BigDripleafStemBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BigDripleafStemBlock.java 2 | +++ b/net/minecraft/world/level/block/BigDripleafStemBlock.java 3 | @@ -58,10 +_,15 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - BlockPos blockPos = pos.below(); 8 | - BlockState blockState = level.getBlockState(blockPos); 9 | - BlockState blockState1 = level.getBlockState(pos.above()); 10 | - return (blockState.is(this) || blockState.is(BlockTags.BIG_DRIPLEAF_PLACEABLE)) && (blockState1.is(this) || blockState1.is(Blocks.BIG_DRIPLEAF)); 11 | + // Pluto start - Memory allocation optimisations 12 | + final int x = pos.getX(); 13 | + final int y = pos.getY(); 14 | + final int z = pos.getZ(); 15 | + 16 | + BlockState blockState = level.pluto$getBlockState(x, y - 1, z); 17 | + BlockState blockState1; 18 | + return (blockState.is(this) || blockState.is(BlockTags.BIG_DRIPLEAF_PLACEABLE)) && ((blockState1 = level.pluto$getBlockState(x, y + 1, z)).is(this) || blockState1.is(Blocks.BIG_DRIPLEAF)); 19 | + // Pluto end - Memory allocation optimisations 20 | } 21 | 22 | protected static boolean place(LevelAccessor level, BlockPos pos, FluidState fluidState, Direction direction) { 23 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java 2 | +++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java 3 | @@ -181,11 +_,13 @@ 4 | } 5 | 6 | if (this.isAlive()) { 7 | - BlockPos blockPos = BlockPos.containing(this.position()); 8 | + long blockPos = this.position().asBlockPosLong(); // Pluto - Memory allocation optimisations 9 | if (( 10 | --this.ticketTimer <= 0L 11 | - || var7 != SectionPos.blockToSectionCoord(blockPos.getX()) 12 | - || sectionPosZ != SectionPos.blockToSectionCoord(blockPos.getZ()) 13 | + // Pluto start - Memory allocation optimisations 14 | + || var7 != SectionPos.blockToSectionCoord(BlockPos.getX(blockPos)) 15 | + || sectionPosZ != SectionPos.blockToSectionCoord(BlockPos.getZ(blockPos)) 16 | + // Pluto end - Memory allocation optimisations 17 | ) 18 | && entity instanceof ServerPlayer serverPlayer1) { 19 | this.ticketTimer = serverPlayer1.registerAndUpdateEnderPearlTicket(this); 20 | -------------------------------------------------------------------------------- /pluto-api/paper-patches/files/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java 2 | +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java 3 | @@ -329,7 +_,9 @@ 4 | try { 5 | jPlugin.setEnabled(true); 6 | } catch (Throwable ex) { 7 | + gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish 8 | server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); 9 | + gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish 10 | } 11 | 12 | // Perhaps abort here, rather than continue going, but as it stands, 13 | @@ -354,7 +_,9 @@ 14 | try { 15 | jPlugin.setEnabled(false); 16 | } catch (Throwable ex) { 17 | + gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish 18 | server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); 19 | + gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish 20 | } 21 | 22 | if (cloader instanceof PluginClassLoader) { 23 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/LiquidBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/LiquidBlock.java 2 | +++ b/net/minecraft/world/level/block/LiquidBlock.java 3 | @@ -196,6 +_,7 @@ 4 | for (Direction direction : POSSIBLE_FLOW_DIRECTIONS) { 5 | BlockPos blockPos = pos.relative(direction.getOpposite()); 6 | if (level.getFluidState(blockPos).is(FluidTags.WATER)) { 7 | + if (level.plutoConfig().disableBlockGenerationFromFluids) return false; // Pluto - Toggle for block generation from fluids 8 | Block block = level.getFluidState(pos).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; 9 | // CraftBukkit start 10 | if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState(), 3)) { 11 | @@ -206,6 +_,7 @@ 12 | } 13 | 14 | if (isSoulSoil && level.getBlockState(blockPos).is(Blocks.BLUE_ICE)) { 15 | + if (level.plutoConfig().disableBlockGenerationFromFluids) return false; // Pluto - Toggle for block generation from fluids 16 | // CraftBukkit start 17 | if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, Blocks.BASALT.defaultBlockState(), 3)) { 18 | this.fizz(level, pos); 19 | -------------------------------------------------------------------------------- /pluto-api/paper-patches/files/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java 2 | +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java 3 | @@ -51,6 +_,7 @@ 4 | private io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup classLoaderGroup; // Paper 5 | public io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext; // Paper 6 | 7 | + private boolean closed = false; // Pufferfish 8 | static { 9 | ClassLoader.registerAsParallelCapable(); 10 | } 11 | @@ -215,7 +_,7 @@ 12 | } 13 | Class result = classes.get(name); 14 | 15 | - if (result == null) { 16 | + if (result == null && !this.closed) { // Pufferfish 17 | String path = name.replace('.', '/').concat(".class"); 18 | // Add details to zip file errors - help debug classloading 19 | JarEntry entry; 20 | @@ -271,6 +_,7 @@ 21 | this.setClass(name, result); // Paper 22 | } 23 | 24 | + if (result == null) throw new ClassNotFoundException(name); // Pufferfish 25 | return result; 26 | } 27 | 28 | @@ -285,6 +_,7 @@ 29 | // Paper end 30 | super.close(); 31 | } finally { 32 | + this.closed = true; // Pufferfish 33 | jar.close(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/attributes/AttributeMap.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java 2 | +++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java 3 | @@ -18,9 +_,11 @@ 4 | private final Set attributesToSync = new ObjectOpenHashSet<>(); 5 | private final Set attributesToUpdate = new ObjectOpenHashSet<>(); 6 | private final AttributeSupplier supplier; 7 | + private final java.util.function.Function, AttributeInstance> createInstance; // Pufferfish 8 | 9 | public AttributeMap(AttributeSupplier supplier) { 10 | this.supplier = supplier; 11 | + this.createInstance = holder -> this.supplier.createInstance(this::onAttributeModified, holder); // Pufferfish 12 | } 13 | 14 | private void onAttributeModified(AttributeInstance instance) { 15 | @@ -43,7 +_,7 @@ 16 | } 17 | 18 | public @Nullable AttributeInstance getInstance(Holder attribute) { 19 | - return this.attributes.computeIfAbsent(attribute, holder -> this.supplier.createInstance(this::onAttributeModified, (Holder)holder)); 20 | + return this.attributes.computeIfAbsent(attribute, this.createInstance); // Pufferfish - cache lambda, as for some reason java allocates it anyways 21 | } 22 | 23 | public boolean hasAttribute(Holder attribute) { 24 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Shulker.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/Shulker.java 2 | +++ b/net/minecraft/world/entity/monster/Shulker.java 3 | @@ -342,7 +_,7 @@ 4 | } 5 | 6 | protected @Nullable Direction findAttachableSurface(BlockPos pos) { 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | if (this.canStayAt(pos, direction)) { 10 | return direction; 11 | } 12 | @@ -376,6 +_,7 @@ 13 | } 14 | 15 | protected boolean teleportSomewhere() { 16 | + if (this.level().plutoConfig().disableShulkerTeleporting) return false; // Pluto - Shulker configuration 17 | if (!this.isNoAi() && this.isAlive()) { 18 | BlockPos blockPos = this.blockPosition(); 19 | 20 | @@ -455,6 +_,7 @@ 21 | Vec3 vec3 = this.position(); 22 | AABB boundingBox = this.getBoundingBox(); 23 | if (!this.isClosed() && this.teleportSomewhere()) { 24 | + if (this.level().plutoConfig().disableShulkerSplitting) return; // Pluto - Shulker configuration 25 | int size = this.level().getEntities(EntityType.SHULKER, boundingBox.inflate(8.0), Entity::isAlive).size(); 26 | float f = (size - 1) / 5.0F; 27 | if (!(this.level().random.nextFloat() < f)) { 28 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/inventory/MerchantContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/inventory/MerchantContainer.java 2 | +++ b/net/minecraft/world/inventory/MerchantContainer.java 3 | @@ -50,6 +_,13 @@ 4 | return (this.merchant instanceof net.minecraft.world.entity.npc.villager.AbstractVillager abstractVillager) ? (org.bukkit.craftbukkit.entity.CraftAbstractVillager) abstractVillager.getBukkitEntity() : null; 5 | } 6 | 7 | + // Pluto start - Allow toggling snapshots for certain blocks 8 | + @Override 9 | + public @javax.annotation.Nullable org.bukkit.inventory.InventoryHolder getOwner(boolean useSnapshot) { 10 | + return getOwner(); 11 | + } 12 | + // Pluto end - Allow toggling snapshots for certain blocks 13 | + 14 | @Override 15 | public @javax.annotation.Nullable org.bukkit.Location getLocation() { 16 | return (this.merchant instanceof net.minecraft.world.entity.npc.villager.AbstractVillager abstractVillager) ? abstractVillager.getBukkitEntity().getLocation() : null; // Paper - Fix inventories returning null Locations 17 | @@ -118,6 +_,8 @@ 18 | public boolean stillValid(Player player) { 19 | return this.merchant.getTradingPlayer() == player; 20 | } 21 | + 22 | + @Override public boolean stillValid() { return this.merchant.stillValid(); } // Pluto - Hoppers cache containers 23 | 24 | @Override 25 | public void setChanged() { 26 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/vehicle/boat/AbstractChestBoat.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/vehicle/boat/AbstractChestBoat.java 2 | +++ b/net/minecraft/world/entity/vehicle/boat/AbstractChestBoat.java 3 | @@ -38,6 +_,34 @@ 4 | super(type, level, dropItem); 5 | } 6 | 7 | + // Pluto start - Entities search for hoppers 8 | + @Override 9 | + public boolean acceptItem(net.minecraft.world.level.block.entity.HopperBlockEntity hopper) { 10 | + return net.minecraft.world.level.block.entity.HopperBlockEntity.suckInItems(this.level(), hopper, this); 11 | + } 12 | + 13 | + @Override 14 | + public void tick() { 15 | + super.tick(); 16 | + if (!this.level().plutoConfig().entitiesSearchForHoppers) return; 17 | + foundHopper(); 18 | + } 19 | + 20 | + @Override 21 | + public void inactiveTick() { 22 | + super.inactiveTick(); 23 | + if (!this.level().plutoConfig().entitiesSearchForHoppers) return; 24 | + foundHopper(); 25 | + } 26 | + // Pluto end - Entities search for hoppers 27 | + 28 | + // Pluto start - Allow toggling snapshots for certain blocks 29 | + @Override 30 | + public org.bukkit.inventory.@Nullable InventoryHolder getOwner(boolean useSnapshot) { 31 | + return getOwner(); 32 | + } 33 | + // Pluto end - Allow toggling snapshots for certain blocks 34 | + 35 | @Override 36 | protected float getSinglePassengerXOffset() { 37 | return 0.15F; 38 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/MossyCarpetBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/MossyCarpetBlock.java 2 | +++ b/net/minecraft/world/level/block/MossyCarpetBlock.java 3 | @@ -129,7 +_,7 @@ 4 | BlockState blockState1 = null; 5 | tip |= state.getValue(BASE); 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | EnumProperty propertyForFace = getPropertyForFace(direction); 10 | WallSide wallSide = canSupportAtFace(level, pos, direction) ? (tip ? WallSide.LOW : state.getValue(propertyForFace)) : WallSide.NONE; 11 | if (wallSide == WallSide.LOW) { 12 | @@ -194,7 +_,7 @@ 13 | BlockState blockState1 = Blocks.PALE_MOSS_CARPET.defaultBlockState().setValue(BASE, false); 14 | BlockState updatedState = getUpdatedState(blockState1, level, pos.above(), true); 15 | 16 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 17 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 18 | EnumProperty propertyForFace = getPropertyForFace(direction); 19 | if (updatedState.getValue(propertyForFace) != WallSide.NONE && !placeSide.getAsBoolean()) { 20 | updatedState = updatedState.setValue(propertyForFace, WallSide.NONE); 21 | -------------------------------------------------------------------------------- /pluto-api/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java: -------------------------------------------------------------------------------- 1 | package gg.pufferfish.pufferfish.simd; 2 | 3 | import jdk.incubator.vector.FloatVector; 4 | import jdk.incubator.vector.IntVector; 5 | import jdk.incubator.vector.VectorSpecies; 6 | 7 | import java.util.logging.Level; 8 | import java.util.logging.Logger; 9 | 10 | /** 11 | * Basically, java is annoying and we have to push this out to its own class. 12 | */ 13 | @Deprecated 14 | public class SIMDChecker { 15 | 16 | @Deprecated 17 | public static boolean canEnable(Logger logger) { 18 | try { 19 | if (SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 25) { 20 | return false; 21 | } else { 22 | SIMDDetection.testRun = true; 23 | 24 | VectorSpecies ISPEC = IntVector.SPECIES_PREFERRED; 25 | VectorSpecies FSPEC = FloatVector.SPECIES_PREFERRED; 26 | 27 | logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)"); 28 | logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)"); 29 | 30 | if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) { 31 | logger.log(Level.WARNING, "SIMD is not properly supported on this system!"); 32 | return false; 33 | } 34 | 35 | return true; 36 | } 37 | } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it. 38 | return false; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/redstone/NeighborUpdater.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/redstone/NeighborUpdater.java 2 | +++ b/net/minecraft/world/level/redstone/NeighborUpdater.java 3 | @@ -49,6 +_,7 @@ 4 | static void executeUpdate(Level level, BlockState state, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston, BlockPos sourcePos) { 5 | // Paper end - Add source block to BlockPhysicsEvent 6 | try { 7 | + if (level instanceof net.minecraft.server.level.ServerLevel serverLevel && serverLevel.hasPhysicsEvent) { // Pluto - Don't fire BlockPhysicsEvent if we don't have anything listening to it. 8 | // CraftBukkit start 9 | org.bukkit.event.block.BlockPhysicsEvent event = new org.bukkit.event.block.BlockPhysicsEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, pos), org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(state), org.bukkit.craftbukkit.block.CraftBlock.at(level, sourcePos)); // Paper - Add source block to BlockPhysicsEvent 10 | level.getCraftServer().getPluginManager().callEvent(event); 11 | @@ -57,6 +_,7 @@ 12 | return; 13 | } 14 | // CraftBukkit end 15 | + } // Pluto - Don't fire BlockPhysicsEvent if we don't have anything listening to it. 16 | state.handleNeighborChanged(level, pos, neighborBlock, orientation, movedByPiston); 17 | // Spigot start 18 | } catch (StackOverflowError ex) { 19 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java 2 | +++ b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java 3 | @@ -32,6 +_,34 @@ 4 | super(type, level); 5 | } 6 | 7 | + // Pluto start - Entities search for hoppers 8 | + @Override 9 | + public boolean acceptItem(net.minecraft.world.level.block.entity.HopperBlockEntity hopper) { 10 | + return net.minecraft.world.level.block.entity.HopperBlockEntity.suckInItems(this.level(), hopper, this); 11 | + } 12 | + 13 | + @Override 14 | + public void tick() { 15 | + super.tick(); 16 | + if (!this.level().plutoConfig().entitiesSearchForHoppers) return; 17 | + foundHopper(); 18 | + } 19 | + 20 | + @Override 21 | + public void inactiveTick() { 22 | + super.inactiveTick(); 23 | + if (!this.level().plutoConfig().entitiesSearchForHoppers) return; 24 | + foundHopper(); 25 | + } 26 | + // Pluto end - Entities search for hoppers 27 | + 28 | + // Pluto start - Allow toggling snapshots for certain blocks 29 | + @Override 30 | + public org.bukkit.inventory.@Nullable InventoryHolder getOwner(boolean useSnapshot) { 31 | + return getOwner(); 32 | + } 33 | + // Pluto end - Allow toggling snapshots for certain blocks 34 | + 35 | @Override 36 | public void destroy(ServerLevel level, DamageSource damageSource) { 37 | super.destroy(level, damageSource); 38 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/CampfireBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/CampfireBlock.java 2 | +++ b/net/minecraft/world/level/block/CampfireBlock.java 3 | @@ -256,16 +_,24 @@ 4 | } 5 | 6 | public static boolean isSmokeyPos(Level level, BlockPos pos) { 7 | + // Pluto start - Decrease chunk/block lookups 8 | + net.minecraft.world.level.chunk.LevelChunk chunk = level.getChunkIfLoaded(pos); 9 | + if (chunk == null) return false; 10 | + 11 | + final int x = pos.getX(); 12 | + final int y = pos.getY(); 13 | + final int z = pos.getZ(); 14 | + // Pluto end - Decrease chunk/block lookups 15 | + 16 | for (int i = 1; i <= 5; i++) { 17 | - BlockPos blockPos = pos.below(i); 18 | - BlockState blockState = level.getBlockState(blockPos); 19 | + BlockState blockState = chunk.getBlockState(x, y - i, z); // Pluto - Decrease chunk/block lookups 20 | if (isLitCampfire(blockState)) { 21 | return true; 22 | } 23 | 24 | boolean flag = Shapes.joinIsNotEmpty(SHAPE_VIRTUAL_POST, blockState.getCollisionShape(level, pos, CollisionContext.empty()), BooleanOp.AND); 25 | if (flag) { 26 | - BlockState blockState1 = level.getBlockState(blockPos.below()); 27 | + BlockState blockState1 = chunk.getBlockState(x, y - (i + 1), z); // Pluto - Decrease chunk/block lookups 28 | return isLitCampfire(blockState1); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/monster/Strider.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/monster/Strider.java 2 | +++ b/net/minecraft/world/entity/monster/Strider.java 3 | @@ -321,7 +_,7 @@ 4 | if (this.isInLava()) { 5 | CollisionContext collisionContext = CollisionContext.of(this); 6 | if (collisionContext.isAbove(LiquidBlock.SHAPE_STABLE, this.blockPosition(), true) 7 | - && !this.level().getFluidState(this.blockPosition().above()).is(FluidTags.LAVA)) { 8 | + && !this.level().pluto$getFluidState(this.blockPosition().getX(), this.blockPosition().getY() + 1, this.blockPosition().getZ()).is(FluidTags.LAVA)) { // Pluto - Memory allocation optimisations 9 | this.setOnGround(true); 10 | } else { 11 | this.setDeltaMovement(this.getDeltaMovement().scale(0.5).add(0.0, 0.05, 0.0)); 12 | @@ -495,7 +_,10 @@ 13 | 14 | @Override 15 | protected boolean isValidTarget(LevelReader level, BlockPos pos) { 16 | - return level.getBlockState(pos).is(Blocks.LAVA) && level.getBlockState(pos.above()).isPathfindable(PathComputationType.LAND); 17 | + // Pluto start - Decrease chunk/block lookups 18 | + net.minecraft.world.level.chunk.ChunkAccess chunk = level.getChunk(pos); 19 | + return chunk.getBlockState(pos).is(Blocks.LAVA) && chunk.getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).isPathfindable(PathComputationType.LAND); 20 | + // Pluto end - Decrease chunk/block lookups 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /pluto-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java 2 | +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java 3 | @@ -992,6 +_,7 @@ 4 | 5 | org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot 6 | this.console.paperConfigurations.reloadConfigs(this.console); 7 | + dev.yive.pluto.config.PlutoConfig.init((File) console.options.valueOf("pluto-settings")); // Pluto - Config 8 | for (ServerLevel world : this.console.getAllLevels()) { 9 | // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty 10 | world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && world.getGameRules().get(GameRules.SPAWN_MONSTERS)); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) 11 | @@ -1023,6 +_,7 @@ 12 | this.reloadData(); 13 | org.spigotmc.SpigotConfig.registerCommands(); // Spigot 14 | io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper 15 | + dev.yive.pluto.commands.PlutoCommands.registerCommands(this.console); // Pluto - Command 16 | this.spark.registerCommandBeforePlugins(this); // Paper - spark 17 | this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); 18 | this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); 19 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/ai/behavior/TryFindWater.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/ai/behavior/TryFindWater.java 2 | +++ b/net/minecraft/world/entity/ai/behavior/TryFindWater.java 3 | @@ -32,10 +_,14 @@ 4 | 5 | for (BlockPos blockPos3 : BlockPos.withinManhattan(blockPos2, range, range, range)) { 6 | if (blockPos3.getX() != blockPos2.getX() || blockPos3.getZ() != blockPos2.getZ()) { 7 | - BlockState blockState = mob.level().getBlockState(blockPos3.above()); 8 | - BlockState blockState1 = mob.level().getBlockState(blockPos3); 9 | + // Pluto start - Decrease chunk/block lookups 10 | + net.minecraft.world.level.chunk.LevelChunk chunk = mob.level().getChunkIfLoaded(blockPos3); 11 | + if (chunk == null) continue; 12 | + 13 | + BlockState blockState1 = chunk.getBlockState(blockPos3); 14 | + // Pluto end - Decrease chunk/block lookups 15 | if (blockState1.is(Blocks.WATER)) { 16 | - if (blockState.isAir()) { 17 | + if (chunk.getBlockState(blockPos3.getX(), blockPos3.getY() + 1, blockPos3.getZ()).isAir()) { // Pluto - Decrease chunk/block lookups 18 | blockPos = blockPos3.immutable(); 19 | break; 20 | } 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/projectile/FishingHook.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/projectile/FishingHook.java 2 | +++ b/net/minecraft/world/entity/projectile/FishingHook.java 3 | @@ -346,7 +_,7 @@ 4 | double d = this.getX() + sin * this.timeUntilHooked * 0.1F; 5 | double d1 = Mth.floor(this.getY()) + 1.0F; 6 | double d2 = this.getZ() + cos * this.timeUntilHooked * 0.1F; 7 | - BlockState blockState = serverLevel.getBlockState(BlockPos.containing(d, d1 - 1.0, d2)); 8 | + BlockState blockState = serverLevel.pluto$getBlockState(d, d1 - 1.0, d2); // Pluto - Memory allocation optimisations 9 | if (blockState.is(Blocks.WATER)) { 10 | if (this.random.nextFloat() < 0.15F) { 11 | serverLevel.sendParticles(ParticleTypes.BUBBLE, d, d1 - 0.1F, d2, 1, sin, 0.1, cos, 0.0); 12 | @@ -408,7 +_,7 @@ 13 | double d = this.getX() + Mth.sin(sin) * cos * 0.1; 14 | double d1 = Mth.floor(this.getY()) + 1.0F; 15 | double d2 = this.getZ() + Mth.cos(sin) * cos * 0.1; 16 | - BlockState blockState = serverLevel.getBlockState(BlockPos.containing(d, d1 - 1.0, d2)); 17 | + BlockState blockState = serverLevel.pluto$getBlockState(d, d1 - 1.0, d2); // Pluto - Memory allocation optimisations 18 | if (blockState.is(Blocks.WATER)) { 19 | serverLevel.sendParticles(ParticleTypes.SPLASH, d, d1, d2, 2 + this.random.nextInt(2), 0.1F, 0.0, 0.1F, 0.0); 20 | } 21 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/TallSeagrassBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/TallSeagrassBlock.java 2 | +++ b/net/minecraft/world/level/block/TallSeagrassBlock.java 3 | @@ -54,7 +_,10 @@ 4 | public @Nullable BlockState getStateForPlacement(BlockPlaceContext context) { 5 | BlockState blockState = super.getStateForPlacement(context); 6 | if (blockState != null) { 7 | - FluidState fluidState = context.getLevel().getFluidState(context.getClickedPos().above()); 8 | + // Pluto start - Memory allocation optimisations 9 | + final BlockPos clickedPos = context.getClickedPos(); 10 | + FluidState fluidState = context.getLevel().pluto$getFluidState(clickedPos.getX(), clickedPos.getY() + 1, clickedPos.getZ()); 11 | + // Pluto end - Memory allocation optimisations 12 | if (fluidState.is(FluidTags.WATER) && fluidState.getAmount() == 8) { 13 | return blockState; 14 | } 15 | @@ -66,7 +_,7 @@ 16 | @Override 17 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 18 | if (state.getValue(HALF) == DoubleBlockHalf.UPPER) { 19 | - BlockState blockState = level.getBlockState(pos.below()); 20 | + BlockState blockState = level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()); // Pluto - Memory allocation optimisations 21 | return blockState.is(this) && blockState.getValue(HALF) == DoubleBlockHalf.LOWER; 22 | } else { 23 | FluidState fluidState = level.getFluidState(pos); 24 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/material/LavaFluid.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/material/LavaFluid.java 2 | +++ b/net/minecraft/world/level/material/LavaFluid.java 3 | @@ -140,7 +_,7 @@ 4 | } 5 | 6 | private boolean hasFlammableNeighbours(LevelReader level, BlockPos pos) { 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | if (this.isFlammable(level, pos.relative(direction))) { 10 | return true; 11 | } 12 | @@ -220,9 +_,8 @@ 13 | @Override 14 | protected void spreadTo(LevelAccessor level, BlockPos pos, BlockState state, Direction direction, FluidState fluidState) { 15 | if (direction == Direction.DOWN) { 16 | - FluidState fluidState1 = level.getFluidState(pos); 17 | - if (this.is(FluidTags.LAVA) && fluidState1.is(FluidTags.WATER)) { 18 | - if (state.getBlock() instanceof LiquidBlock) { 19 | + if (this.is(FluidTags.LAVA) && level.getFluidState(pos).is(FluidTags.WATER)) { // Pluto - Decrease chunk/block lookups 20 | + if (state.getBlock() instanceof LiquidBlock && !level.getMinecraftWorld().plutoConfig().disableBlockGenerationFromFluids) { // Pluto - Toggle for block generation from fluids 21 | // CraftBukkit start 22 | if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level.getMinecraftWorld(), pos, Blocks.STONE.defaultBlockState(), 3)) { 23 | return; 24 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/entity/animal/allay/Allay.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/entity/animal/allay/Allay.java 2 | +++ b/net/minecraft/world/entity/animal/allay/Allay.java 3 | @@ -223,10 +_,12 @@ 4 | return 0.4F; 5 | } 6 | 7 | + private int behaviorTick = 0; // Pufferfish 8 | @Override 9 | protected void customServerAiStep(ServerLevel level) { 10 | ProfilerFiller profilerFiller = Profiler.get(); 11 | profilerFiller.push("allayBrain"); 12 | + if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish 13 | this.getBrain().tick(level, this); 14 | profilerFiller.pop(); 15 | profilerFiller.push("allayActivityUpdate"); 16 | @@ -395,6 +_,7 @@ 17 | @Override 18 | public void updateDynamicGameEventListener(BiConsumer, ServerLevel> listenerConsumer) { 19 | if (this.level() instanceof ServerLevel serverLevel) { 20 | + if (serverLevel.plutoConfig().disableAllayGameEventListening) return; // Pluto - Allay Configuration 21 | listenerConsumer.accept(this.dynamicVibrationListener, serverLevel); 22 | listenerConsumer.accept(this.dynamicJukeboxListener, serverLevel); 23 | } 24 | @@ -501,7 +_,7 @@ 25 | } 26 | 27 | public boolean canDuplicate() { 28 | - return this.entityData.get(DATA_CAN_DUPLICATE); 29 | + return !this.level().plutoConfig().disableAllayDuplication && this.entityData.get(Allay.DATA_CAN_DUPLICATE); // Pluto - Allay configuration 30 | } 31 | 32 | private void removeInteractionItem(Player player, ItemStack stack) { 33 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/RedstoneTorchBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/RedstoneTorchBlock.java 2 | +++ b/net/minecraft/world/level/block/RedstoneTorchBlock.java 3 | @@ -48,7 +_,7 @@ 4 | private void notifyNeighbors(Level level, BlockPos pos, BlockState state) { 5 | Orientation orientation = this.randomOrientation(level, state); 6 | 7 | - for (Direction direction : Direction.values()) { 8 | + for (Direction direction : Direction.VALUES) { // Pluto - Avoid excessive calls to Enum#values 9 | level.updateNeighborsAt(pos.relative(direction), this, ExperimentalRedstoneUtils.withFront(orientation, direction)); 10 | } 11 | } 12 | @@ -131,6 +_,18 @@ 13 | protected int getDirectSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) { 14 | return side == Direction.DOWN ? state.getSignal(level, pos, side) : 0; 15 | } 16 | + 17 | + // Pluto start - Memory allocation optimisations 18 | + @Override 19 | + protected int pluto$getSignal(BlockState blockState, BlockGetter level, int x, int y, int z, Direction side) { 20 | + return blockState.getValue(LIT) && Direction.UP != side ? 15 : 0; 21 | + } 22 | + 23 | + @Override 24 | + protected int pluto$getDirectSignal(BlockState blockState, BlockGetter blockAccess, int x, int y, int z, Direction side) { 25 | + return side == Direction.DOWN ? blockState.pluto$getSignal(blockAccess, x, y, z, side) : 0; 26 | + } 27 | + // Pluto end - Memory allocation optimisations 28 | 29 | @Override 30 | protected boolean isSignalSource(BlockState state) { 31 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/EmptyBlockAndTintGetter.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/EmptyBlockAndTintGetter.java 2 | +++ b/net/minecraft/world/level/EmptyBlockAndTintGetter.java 3 | @@ -33,6 +_,48 @@ 4 | return null; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + public BlockState pluto$getBlockState(int x, int y, int z) { 10 | + return Blocks.AIR.defaultBlockState(); 11 | + } 12 | + 13 | + @Override 14 | + public BlockState pluto$getBlockState(long packedPos) { 15 | + return Blocks.AIR.defaultBlockState(); 16 | + } 17 | + 18 | + @Override 19 | + public @Nullable BlockState pluto$getBlockStateIfLoaded(int x, int y, int z) { 20 | + return null; 21 | + } 22 | + 23 | + @Override 24 | + public @Nullable BlockState pluto$getBlockStateIfLoaded(long packedPos) { 25 | + return null; 26 | + } 27 | + 28 | + @Override 29 | + public FluidState pluto$getFluidState(int x, int y, int z) { 30 | + return Fluids.EMPTY.defaultFluidState(); 31 | + } 32 | + 33 | + @Override 34 | + public FluidState pluto$getFluidState(long packedPos) { 35 | + return Fluids.EMPTY.defaultFluidState(); 36 | + } 37 | + 38 | + @Override 39 | + public @Nullable FluidState pluto$getFluidStateIfLoaded(int x, int y, int z) { 40 | + return null; 41 | + } 42 | + 43 | + @Override 44 | + public @Nullable FluidState pluto$getFluidStateIfLoaded(long packedPos) { 45 | + return null; 46 | + } 47 | + // Pluto end - Memory allocation optimisations 48 | + 49 | @Override 50 | public BlockState getBlockState(BlockPos pos) { 51 | return Blocks.AIR.defaultBlockState(); 52 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BuddingAmethystBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BuddingAmethystBlock.java 2 | +++ b/net/minecraft/world/level/block/BuddingAmethystBlock.java 3 | @@ -27,8 +_,10 @@ 4 | protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { 5 | if (random.nextInt(5) == 0) { 6 | Direction direction = DIRECTIONS[random.nextInt(DIRECTIONS.length)]; 7 | - BlockPos blockPos = pos.relative(direction); 8 | - BlockState blockState = level.getBlockState(blockPos); 9 | + // Pluto start - Memory allocation optimisations 10 | + BlockPos blockPos; 11 | + BlockState blockState = level.pluto$getBlockState(pos.getX() + direction.getStepX(), pos.getY() + direction.getStepY(), pos.getZ() + direction.getStepZ()); 12 | + // Pluto end - Memory allocation optimisations 13 | Block block = null; 14 | if (canClusterGrowAtState(blockState)) { 15 | block = Blocks.SMALL_AMETHYST_BUD; 16 | @@ -45,6 +_,7 @@ 17 | .setValue(AmethystClusterBlock.FACING, direction) 18 | .setValue(AmethystClusterBlock.WATERLOGGED, blockState.getFluidState().getType() == Fluids.WATER); 19 | // Paper start - Have Amethyst throw both spread and grow events 20 | + blockPos = pos.relative(direction); // Pluto - Memory allocation optimisations | Moved down 21 | if (block == Blocks.SMALL_AMETHYST_BUD) { 22 | org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(level, pos, blockPos, blockState1, 3); // CraftBukkit 23 | } else { 24 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/EmptyBlockGetter.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/EmptyBlockGetter.java 2 | +++ b/net/minecraft/world/level/EmptyBlockGetter.java 3 | @@ -16,6 +_,48 @@ 4 | return null; 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + @Override 9 | + public BlockState pluto$getBlockState(int x, int y, int z) { 10 | + return Blocks.AIR.defaultBlockState(); 11 | + } 12 | + 13 | + @Override 14 | + public BlockState pluto$getBlockState(long packedPos) { 15 | + return Blocks.AIR.defaultBlockState(); 16 | + } 17 | + 18 | + @Override 19 | + public BlockState pluto$getBlockStateIfLoaded(int x, int y, int z) { 20 | + return Blocks.AIR.defaultBlockState(); 21 | + } 22 | + 23 | + @Override 24 | + public BlockState pluto$getBlockStateIfLoaded(long packedPos) { 25 | + return Blocks.AIR.defaultBlockState(); 26 | + } 27 | + 28 | + @Override 29 | + public FluidState pluto$getFluidState(int x, int y, int z) { 30 | + return Fluids.EMPTY.defaultFluidState(); 31 | + } 32 | + 33 | + @Override 34 | + public FluidState pluto$getFluidState(long packedPos) { 35 | + return Fluids.EMPTY.defaultFluidState(); 36 | + } 37 | + 38 | + @Override 39 | + public FluidState pluto$getFluidStateIfLoaded(int x, int y, int z) { 40 | + return Fluids.EMPTY.defaultFluidState(); 41 | + } 42 | + 43 | + @Override 44 | + public FluidState pluto$getFluidStateIfLoaded(long packedPos) { 45 | + return Fluids.EMPTY.defaultFluidState(); 46 | + } 47 | + // Pluto end - Memory allocation optimisations 48 | + 49 | // Paper start - If loaded util 50 | @Override 51 | public final FluidState getFluidIfLoaded(BlockPos pos) { 52 | -------------------------------------------------------------------------------- /pluto-api/paper-patches/files/src/main/java/org/bukkit/plugin/SimplePluginManager.java.patch: -------------------------------------------------------------------------------- 1 | --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java 2 | +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java 3 | @@ -597,7 +_,9 @@ 4 | 5 | // Paper start 6 | private void handlePluginException(String msg, Throwable ex, Plugin plugin) { 7 | + gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish 8 | server.getLogger().log(Level.SEVERE, msg, ex); 9 | + gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish 10 | callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin))); 11 | } 12 | // Paper end 13 | @@ -667,9 +_,11 @@ 14 | )); 15 | } 16 | } catch (Throwable ex) { 17 | + gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish 18 | // Paper start - error reporting 19 | String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(); 20 | server.getLogger().log(Level.SEVERE, msg, ex); 21 | + gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish 22 | if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop 23 | callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event))); 24 | } 25 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/VineBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/VineBlock.java 2 | +++ b/net/minecraft/world/level/block/VineBlock.java 3 | @@ -125,7 +_,7 @@ 4 | 5 | BlockState blockState = null; 6 | 7 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 8 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 9 | BooleanProperty propertyForFace = getPropertyForFace(direction); 10 | if (state.getValue(propertyForFace)) { 11 | boolean canSupportAtFace = this.canSupportAtFace(level, pos, direction); 12 | @@ -215,7 +_,7 @@ 13 | 14 | BlockState blockState1 = state; 15 | 16 | - for (Direction clockWise : Direction.Plane.HORIZONTAL) { 17 | + for (Direction clockWise : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 18 | if (random.nextBoolean() || !isAcceptableNeighbour(level, blockPos.relative(clockWise), clockWise)) { 19 | blockState1 = blockState1.setValue(getPropertyForFace(clockWise), false); 20 | } 21 | @@ -246,7 +_,7 @@ 22 | } 23 | 24 | private BlockState copyRandomFaces(BlockState sourceState, BlockState spreadState, RandomSource random) { 25 | - for (Direction direction : Direction.Plane.HORIZONTAL) { 26 | + for (Direction direction : Direction.Plane.HORIZONTAL.faces) { // Pluto - Expose Direction$Plane's faces 27 | if (random.nextBoolean()) { 28 | BooleanProperty propertyForFace = getPropertyForFace(direction); 29 | if (sourceState.getValue(propertyForFace)) { 30 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BambooSaplingBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BambooSaplingBlock.java 2 | +++ b/net/minecraft/world/level/block/BambooSaplingBlock.java 3 | @@ -38,14 +_,14 @@ 4 | 5 | @Override 6 | protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { 7 | - if (random.nextFloat() < (level.spigotConfig.bambooModifier / (100.0F * 3)) && level.isEmptyBlock(pos.above()) && level.getRawBrightness(pos.above(), 0) >= 9) { // Spigot - SPIGOT-7159: Better modifier resolution 8 | + if (random.nextFloat() < (level.spigotConfig.bambooModifier / (100.0F * 3)) && level.pluto$isEmptyBlock(pos.getX(), pos.getY() + 1, pos.getZ()) && (level.plutoConfig().bambooSaplingIgnoreLightLevel || level.getRawBrightness(pos.above(), 0) >= 9)) { // Spigot - SPIGOT-7159: Better modifier resolution // Pluto - Toggle for light lookups on certain flora // Pluto - Memory allocation optimisations 9 | this.growBamboo(level, pos); 10 | } 11 | } 12 | 13 | @Override 14 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 15 | - return level.getBlockState(pos.below()).is(BlockTags.BAMBOO_PLANTABLE_ON); 16 | + return level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()).is(BlockTags.BAMBOO_PLANTABLE_ON); // Pluto - Memory allocation optimisations 17 | } 18 | 19 | @Override 20 | @@ -75,7 +_,7 @@ 21 | 22 | @Override 23 | public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { 24 | - return level.getBlockState(pos.above()).isAir(); 25 | + return level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()).isAir(); // Pluto - Memory allocation optimisations 26 | } 27 | 28 | @Override 29 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/BlockGetter.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/BlockGetter.java 2 | +++ b/net/minecraft/world/level/BlockGetter.java 3 | @@ -29,6 +_,32 @@ 4 | return blockEntity != null && blockEntity.getType() == type ? Optional.of((T)blockEntity) : Optional.empty(); 5 | } 6 | 7 | + // Pluto start - Memory allocation optimisations 8 | + default BlockState pluto$getBlockState(double x, double y, double z) { 9 | + return pluto$getBlockState(Mth.floor(x), Mth.floor(y), Mth.floor(z)); 10 | + } 11 | + BlockState pluto$getBlockState(int x, int y, int z); 12 | + BlockState pluto$getBlockState(long packedPos); 13 | + 14 | + default @Nullable BlockState pluto$getBlockStateIfLoaded(double x, double y, double z) { 15 | + return pluto$getBlockStateIfLoaded(Mth.floor(x), Mth.floor(y), Mth.floor(z)); 16 | + } 17 | + @Nullable BlockState pluto$getBlockStateIfLoaded(int x, int y, int z); 18 | + @Nullable BlockState pluto$getBlockStateIfLoaded(long packedPos); 19 | + 20 | + default FluidState pluto$getFluidState(double x, double y, double z) { 21 | + return pluto$getFluidState(Mth.floor(x), Mth.floor(y), Mth.floor(z)); 22 | + } 23 | + FluidState pluto$getFluidState(int x, int y, int z); 24 | + FluidState pluto$getFluidState(long packedPos); 25 | + 26 | + default @Nullable FluidState pluto$getFluidStateIfLoaded(double x, double y, double z) { 27 | + return pluto$getFluidStateIfLoaded(Mth.floor(x), Mth.floor(y), Mth.floor(z)); 28 | + } 29 | + @Nullable FluidState pluto$getFluidStateIfLoaded(int x, int y, int z); 30 | + @Nullable FluidState pluto$getFluidStateIfLoaded(long packedPos); 31 | + // Pluto end - Memory allocation optimisations 32 | + 33 | BlockState getBlockState(BlockPos pos); 34 | 35 | // Paper start - if loaded util 36 | -------------------------------------------------------------------------------- /pluto-server/minecraft-patches/sources/net/minecraft/world/level/block/BigDripleafBlock.java.patch: -------------------------------------------------------------------------------- 1 | --- a/net/minecraft/world/level/block/BigDripleafBlock.java 2 | +++ b/net/minecraft/world/level/block/BigDripleafBlock.java 3 | @@ -136,8 +_,7 @@ 4 | 5 | @Override 6 | protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { 7 | - BlockPos blockPos = pos.below(); 8 | - BlockState blockState = level.getBlockState(blockPos); 9 | + BlockState blockState = level.pluto$getBlockState(pos.getX(), pos.getY() - 1, pos.getZ()); // Pluto - Memory allocation optimisations 10 | return blockState.is(this) || blockState.is(Blocks.BIG_DRIPLEAF_STEM) || blockState.is(BlockTags.BIG_DRIPLEAF_PLACEABLE); 11 | } 12 | 13 | @@ -167,7 +_,7 @@ 14 | 15 | @Override 16 | public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { 17 | - BlockState blockState = level.getBlockState(pos.above()); 18 | + BlockState blockState = level.pluto$getBlockState(pos.getX(), pos.getY() + 1, pos.getZ()); // Pluto - Memory allocation optimisations 19 | return canReplace(blockState); 20 | } 21 | 22 | @@ -292,7 +_,7 @@ 23 | 24 | @Override 25 | public BlockState getStateForPlacement(BlockPlaceContext context) { 26 | - BlockState blockState = context.getLevel().getBlockState(context.getClickedPos().below()); 27 | + BlockState blockState = context.getLevel().pluto$getBlockState(context.getClickedPos().getX(), context.getClickedPos().getY() - 1, context.getClickedPos().getZ()); // Pluto - Memory allocation optimisations 28 | FluidState fluidState = context.getLevel().getFluidState(context.getClickedPos()); 29 | boolean flag = blockState.is(Blocks.BIG_DRIPLEAF) || blockState.is(Blocks.BIG_DRIPLEAF_STEM); 30 | return this.defaultBlockState() 31 | --------------------------------------------------------------------------------