mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
1.17 (#5881)
* hacked build changes, api applies cleanly * Did anyone say gradle? and paperweight? potentially even mojmap?! * Update paperweight & build config for Spigot changes * Move patches * Initial Spigot remap patches * Inital remap of patches * Move patches around * Remap POM changes patch Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * Rename POM changes to build system changes Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * Apply a few more patches Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * Rename all patches to correct numbering scheme Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * More remapped patches Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * ci: remove java 8 build Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * Update Timings patch (#5796) * fix: up the max memory for gradle Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * fix: add pom changes to gradle Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * fix: remove empty java file Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * fix: remove #isStopping check Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * fix: closer to compilable Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * fix: the server compiles Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * fix: map parent method where CB does not Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * feat: new maven group: io.papermc.paper Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com> * fix: Update paperweight mcdev and fix CraftBukkit patch * few fixes to make it actually run * Add Paper version back to manifest, add `runShadow`, `runReobf`, and `runDev` tasks for testing * fix adventure patch * rebase * more patches * more patches * more patches (#5799) * Add ASM dep to API and fix issues from title packet changes with bungee api * patches * fix PlayerUseUnknownEntityEvent patch (#5800) * some patches * even more progress * even even more progress * even even even even even even even more work * even even even even even even even even even more changes * fix profile cache mappings let me be OP god dammit! * even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even more work * even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even even more work * add mcdev imports file * More work * More more work * Fix patch, fix .gitattributes file name * More more more work * even more wooooooooooooooooooooooooork uwu * more patches (#5807) * Fix this stupid bullshit v2 * delete unneeded old patches * more patches (#5808) * more patches * gradlew.bat crlf fix (#5810) * more patches (#5811) * Cleanup project build config * Write API version to pom.properties for Versioning to read Maven writes this metadata normally, but we don't use maven. Maybe should modify Versioning instead in the future, but this works just fine for now. * wowe * Add `runWorkDir` property for setting a custom run task working directory * Use `mergeServiceFiles()` instead of AppendingTransformer * Bump tiny-remapper to 0.4.1 * Use `forUseAtConfigurationTime()` for run directory property * Resolve run working directory from rootProject * even even even even more work * wor * patches * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 8503c3c9 #621: Add HumanEntity#getItemInUse and Material#getSlipperiness 248deb09 #622: Add methods to check if item is the breed item for an entity 2ce691d8 Clarify Player#breakBlock only works for blocks in the same world 5dcdd48e SPIGOT-6514: Small Dripleaf block data is missing half property cc9610b7 #619: Add Player#breakBlock() 862bc475 Fix bad merge of SPIGOT-6502 fix 989bb0c1 Downgrade SnakeYAML due to issues with comments parsing 1dff62ae Fix inverted visual fire docs CraftBukkit Changes: 40caacc8 SPIGOT-6526: World entities are not populated when plugin onEnable is called c9a92ad0 SPIGOT-6536: Marker position not set on spawn 20d3e57c #855: Add HumanEntity#getItemInUse and Material#getSlipperiness d9c69b44 SPIGOT-6529: Fix BundleMeta#setItems 8bd43be5 SPIGOT-6535: PlayerGameModeChangeEvent event incorrectly reports old gamemode 4ece3ff3 #856: Add methods to check if item is the breed item for an entity dd4bec5f Add additional validation to Player#breakBlock bc835ae6 SPIGOT-6532: Fix Entity#setGlowing 384e116e Restore 1.16.5 behaviour of InventoryDragEvent being called even when a single item is 'dragged' to its own slot b42e708c Fix new map colors rendering as transparent cfe7fecf SPIGOT-6524: Inventory desync when InventoryClickEvent is cancelled eeae1b19 SPIGOT-6522: ItemStack on cursor is always AIR 7490724d Fix missing PlayerEditBookEvent 06875f76 SPIGOT-6513: Placing ItemStack in Inventory causes InventoryAction.NOTHING 27835bde SPIGOT-6519: Fix end gateway teleports 4ac634ad SPIGOT-6515: "Un-waterlogging" throws UnsupportedOperationException in some cases da425fa2 SPIGOT-6518: Anvils falling onto dripstone can sometimes crash server 50530da9 SPIGOT-6514: Small Dripleaf block data is missing half property 6fdecf20 #853: Implement Player#breakBlock() 4db9c49f SPIGOT-6510: Bukkit#createMap throws NullPointerException 89e2b127 SPIGOT-6517: Spider jockey crash on dripstone cbf2f678 SPIGOT-6508: Rename conflicted getServer 74575d48 SPIGOT-6506: Fix crash with custom inventories a3df386f Fix NPE with Entity.getNearbyEntities d747f8ed Fix NPE with World.getNearbyEntities 4d2c7800 Fix second usage of worldGenSettings just in case 5182f923 SPIGOT-6504: Fix generating fresh worlds Spigot Changes: 66f9d3c1 Rebuild patches 191e4971 Rebuild patches a09c0bb6 Restore Spigot experience merging * patches fix * patches and patches * patch * fix compile * Work * More work * More more work * Move this back * Fix compile * more work * fix kneny dumb * even more work * Fix recursive connection call causing StackOverflowException This was probably caused by the rename sendPacket->send and dispatchPacket->sendPacket * adjust material set tag sizes MC added a buuuunch of stuff * more patches * MOAR PATCHES * update github action to the new setup * update github action to the new setup * separate out the CI tasks * use local class for movecontrol stuff to prevent reobf mapping issue * eeeeww, maven * not even checkstyle can help us now * fix tests * EVEN MOOOOOAAAAAAARRRRRRR patches :) (#5820) * Use correct jetbrains annotations * work work (#5821) * patches * reorder patches after merge * small fixes * fix exception (#5822) * 2 patch * progress * Re-add xp orb merging patches (#5823) * ReAdded PreCreatureSpawnEvent from removed (#5814) * reorder * patches * Fix mojangapi build * Add back incremental chunk saving patch * add entity debug info patch back * more patches (#5827) * more patches * even moar patches * Add missing getLevel implementation to Hopper Minecart, add mapping to fix reobf * decomp fixes * more work uwu * fix issue in hopper patch * more work work work * even MOAR progress * need to look at this later, fails rn * even moar workkkkk * fix compile issues * even more compile fixes * fix no grav bee patch for world height changes * more patches * resolve paperweight from paper repo * run CI with --stacktrace * more patches * more patches & fixes to existing patches * add access transforming capabilities * continue to load paperclip from jfrog for now * more patches * Put pom in correct location for Paperclip install to maven local feature * Re-add Chunk Priority/Urgency System (#5829) * Organize removed patches (#5836) * tons of patches (#5835) * Fix AT format issue * Update editorconfig * patches * update mappings files * Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: ebb0e28d #631: Add Villager#shakeHead 751469c6 #629: Add LivingEntity#isClimbing CraftBukkit Changes: 622cf611 SPIGOT-6555: Cannot access shield BlockStateMeta 8b2e78ec SPIGOT-6542: Fix counting players with fauxSleeping = true f66c437a SPIGOT-6561: Add events for dripleaf tilting 6ed40004 SPIGOT-6560: Crash when falling stalactite hits player 72a2901b SPIGOT-6557: PlayerEditBookEvent#setNewBookMeta does not update meta a07e783a #865: Implement Villager#shakeHead 3252ff18 #863: Add LivingEntity#isClimbing 77058c79 SPIGOT-6554: Worlds created with the bukkit ChunkGenerator cannot save * fixes * Gradle & Paperclip updates * Fix mappings patches for Hopper getLevel issue * final patches from remapped and unmapped keep in mind many patches in the removed folder still need to be updated * update Fix incorrect status dataconverter for pre 1.13 chunks * Add back stream patch (#5838) * port some patches (#5837) * reorder patches after merge * Update to paperweight 1.0.0, with automatic library imports * Update paperweight to 1.0.1 * Run Gradle tasks in parallel by default * Remove now unnecessary scripts and update upstreamMerge.sh * Remove Paperclip submodule * Updated Upstream (CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: f992ce60 Fix duplicate datapack reload on /reload * revert accidental changes * update Optimize Pathfinder - Remove Streams / Optimized collections * Revert "Updated Upstream (CraftBukkit)" This reverts commitc9f654db91
. * add back optimizing hopper searches (#5839) * Clean cache on upstream update * Updated Upstream (CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: f992ce60 Fix duplicate datapack reload on /reload Spigot Changes: 9472b09d Rebuild patches * Remove sync loading of spawn chunks Adding the tickets is sufficient * BlockPos.withinManhattan decomp fix * Port anti x-ray patch * Fix ChunkPacketBlockControllerAntiXray initialize * Changes to xray patch * Port Stop-copy-on-write-operations-for-updating-light-dat * Disable Gradle file system watching by default It's unclear if this will help anything but we are getting a lot of issues with the daemon holdong on to files between builds and causing issues. * Add note on removed patch * start adding in ATs * AT bullshit * Fix a few cases of the vanilla mob goals * one missed AT * mojang mapped vanilla goals * added remaining hunks from chat/title packets (#5844) * fix StopAttackingIfTargetInvalid behavior * Update sync chunk load debug patch Had to drop some hunks modifying getEntities, as those methods were rewritten by Mojang in 1.17 * Updated Upstream (Bukkit/CraftBukkit) & more patches Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: e9ce88b9 SPIGOT-6562: Add more specific sculk sensor event CraftBukkit Changes: d7ef1e91 SPIGOT-6558: Attempt to improve SkullMeta e7a63287 SPIGOT-6562: Add more specific sculk sensor event * add more patches back * Update Paperweight to 1.0.2 * Update runDev task for Gradle 7.1 deprecations also no longer disable watchdog by default, instead require `disableWatchdog` Gradle property to be set * Bump paperweight to 1.0.3 * more patches added back * Bump paperweight to 1.0.4 * Revert "Re-add Chunk Priority/Urgency System (#5829)" This reverts commit24b7da65ee
. Patch was updated incorrectly and needs a closer look. * Temporarily revert incremental chunk saving patch Needs updating to hook into new entity storage system * Modify entity origin API to store world/pos seperatly * Fix comment * Update Asynchronous chunk IO and loading for variable world height limits * Port chunk priority urgency patch * Definitely readd this patch for the first time * Fix custom world height in xray patch * Port improve chunk status transition speed * remove optimise random tick patch for now * Fix entity death sounds * fixes issue with chunk saving fixes #5854 * Enable chunk load for feature search by default * remove some more obf helpers * update to Adventure 4.8.1 * Fix artifact ids * Minor patch cleanup * Bump paperweight to 1.0.5 * Add a note about deleting pom.xml in first patch * Relocate other libraries Spigot added and relocates in 1.17 * Update Entity load/save limit per chunk * Simplify Multi-Release plugin jar patch We don't have to worry about running on Java <9 anymore. * Bump paperweight to 1.1.0 This paperweight update uses Hypo to cleanup and fix reobf mappings based on the completed jar, which removes a lot of issues we were previously having around weird CraftBukkit edge cases and synthetic issues (as always). It's not yet perfect (PaperMC/paperweight#18) but it's much better than it was. * Update incremental chunk saving * Update author on my patches * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2dbec584 SPIGOT-6570: Missing InventoryType: COMPOSTER e9ce88b9 SPIGOT-6562: Add more specific sculk sensor event CraftBukkit Changes: 9122f5a6 #869: Fix BossBar setColor and setStyle updates 96a15d7a Incrase outdated build delay ded19075 SPIGOT-6570: Missing InventoryType: COMPOSTER d7ef1e91 SPIGOT-6558: Attempt to improve SkullMeta e7a63287 SPIGOT-6562: Add more specific sculk sensor event Spigot Changes: 101ebb63 SPIGOT-6573: Berry Bushes deal damage when not moving * remove remaining POMs * missing ats and mappings * check if sender is a player in paper dumpitem command, closes #5858 * remove system property for book size limits "It was from a different time before books were as jank as they are now. As time has gone on they've only proven to be worse and worse." * nuke a few more obfhelpers * deprecate all obfhelpers * death to more obfhelpers * fix build * remove more obfhelpers * Bump paperweight to 1.1.2 * Don't include log4j * Fix #5856 Entity origin (#5861) * Thanks for joining us for the magic show tonight * Move package version to server project * downgrade snakeyaml to fix issues with comments this was done by upstream, but got missed. Thanks @mrfloris for pointing this out. * Remove chat event APIs marked as deprecated for removal with 1.17 * Add task to print Minecraft version, add snapshots repo for publishing * Save BlockEntities on main for async chunk saves Closes #5854 * add back optimizing ServerLevel chunk checking methods * Updated Upstream (CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: 68d40318 SPIGOT-6580: Cancelling SlimeSplitEvent Causes Infinite Loop 78d93f77 SPIGOT-6576: BlockExpEvent does not show XP when breaking a furnace * Fix startup delay and warning caused by oshi * thank you for your service, old spigot mapped patches, you will not be missed. * fix patch mis-order Co-authored-by: Kyle Wood <kyle@denwav.dev> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: Jake Potrebic <15055071+Machine-Maker@users.noreply.github.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: KennyTV <jahnke.nassim@gmail.com> Co-authored-by: Aurora <aurora@relanet.eu> Co-authored-by: mechoriet <kevinworm92@gmail.com> Co-authored-by: Professor Bloodstone <git@bloodstone.dev> Co-authored-by: Omer Uddin <kickash32@gmail.com> Co-authored-by: Josh Roy <10731363+JRoy@users.noreply.github.com> Co-authored-by: Kyle Wood <demonwav@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Riley Park <riley.park@meino.net> Co-authored-by: djytw <djytw@live.com>
This commit is contained in:
commit
3d43c5e500
@ -1,6 +1,12 @@
|
||||
[*.java]
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
|
||||
[*.tiny]
|
||||
indent_style=tab
|
||||
|
||||
[*.bat]
|
||||
end_of_line=crlf
|
||||
|
7
.gitattributes
vendored
Normal file
7
.gitattributes
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
* text=auto
|
||||
|
||||
*.sh text eol=lf
|
||||
gradlew text eol=lf
|
||||
*.bat text eol=crlf
|
||||
|
||||
*.jar binary
|
17
.github/workflows/build.yml
vendored
17
.github/workflows/build.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [16, 8]
|
||||
java: [16]
|
||||
fail-fast: true
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -22,18 +22,19 @@ jobs:
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'adopt'
|
||||
- name: Cache maven
|
||||
- name: Cache gradle
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.m2/repository/
|
||||
work/Minecraft
|
||||
key: ${{ runner.os }}-paper-2-${{ hashFiles('**/pom.xml') }}
|
||||
~/.gradle/caches
|
||||
~/.gradle/jdks
|
||||
~/.gradle/native
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-paper-2-${{ hashFiles('**/*.gradle*', 'gradle/**', 'gradle.properties') }}
|
||||
restore-keys: ${{ runner.os }}-paper-2
|
||||
- name: Patch and build
|
||||
run: |
|
||||
git config --global user.email "no-reply@github.com"
|
||||
git config --global user.name "Github Actions"
|
||||
./paper build
|
||||
- name: Build javadocs
|
||||
run: mvn -pl Paper-API,Paper-MojangAPI -am javadoc:javadoc
|
||||
./gradlew applyPatches --stacktrace
|
||||
./gradlew build --stacktrace
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,6 @@
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Eclipse stuff
|
||||
.classpath
|
||||
.project
|
||||
@ -63,3 +66,5 @@ Paperclip.jar
|
||||
paperclip.jar
|
||||
paperclip-*.jar
|
||||
paperclip.properties
|
||||
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -10,6 +10,3 @@
|
||||
[submodule "work/Spigot"]
|
||||
path = work/Spigot
|
||||
url = https://hub.spigotmc.org/stash/scm/spigot/spigot.git
|
||||
[submodule "work/Paperclip"]
|
||||
path = work/Paperclip
|
||||
url = https://github.com/PaperMC/Paperclip.git
|
||||
|
35
Paper-MojangAPI/build.gradle.kts
Normal file
35
Paper-MojangAPI/build.gradle.kts
Normal file
@ -0,0 +1,35 @@
|
||||
import java.util.Locale
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://libraries.minecraft.net")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":Paper-API"))
|
||||
api("com.mojang:brigadier:1.0.18")
|
||||
|
||||
compileOnly("it.unimi.dsi:fastutil:8.2.2")
|
||||
compileOnly("org.jetbrains:annotations:18.0.0")
|
||||
|
||||
testImplementation("junit:junit:4.13.1")
|
||||
testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||
testImplementation("org.ow2.asm:asm-tree:7.3.1")
|
||||
}
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
artifactId = project.name.toLowerCase(Locale.ENGLISH)
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
@ -1,204 +0,0 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-mojangapi</artifactId>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Paper-MojangAPI</name>
|
||||
<url>https://github.com/PaperMC/Paper</url>
|
||||
<description>API additions that utilize Mojang Specific API's</description>
|
||||
|
||||
<properties>
|
||||
<!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigotmc-public</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>minecraft-libraries</id>
|
||||
<name>Minecraft Libraries</name>
|
||||
<url>https://libraries.minecraft.net</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spigotmc-public</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.destroystokyo.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- mojang api -->
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>brigadier</artifactId>
|
||||
<version>1.0.17</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- utils -->
|
||||
<dependency>
|
||||
<groupId>it.unimi.dsi</groupId>
|
||||
<artifactId>fastutil</artifactId>
|
||||
<version>8.2.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- annotations -->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains</groupId>
|
||||
<artifactId>annotations</artifactId>
|
||||
<version>18.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- testing -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm-tree</artifactId>
|
||||
<version>7.3.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean install</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<dependencies>
|
||||
<!-- we need our custom version as it fixes some bugs on case sensitive file systems -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-compiler-eclipse</artifactId>
|
||||
<version>2.8.5-spigotmc</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Automatic-Module-Name>org.bukkit</Automatic-Module-Name>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||
<!-- when downloading via Maven we can pull depends individually -->
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>development</id>
|
||||
<properties>
|
||||
<skipTests>false</skipTests>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>8.29</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.18</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
<artifactId>java18</artifactId>
|
||||
<version>1.0</version>
|
||||
</signature>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
@ -1,106 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 1 Mar 2016 00:16:08 +0100
|
||||
Subject: [PATCH] POM changes
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 0223e94c1243a58955f858c8bf6d5df4ca8cf0ec..fd663f5471516c3ebbab07c27197e5df48c481e6 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -2,33 +2,34 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
+ <parent>
|
||||
+ <groupId>com.destroystokyo.paper</groupId>
|
||||
+ <artifactId>paper-parent</artifactId>
|
||||
+ <version>dev-SNAPSHOT</version>
|
||||
+ </parent>
|
||||
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-api</artifactId>
|
||||
+ <groupId>com.destroystokyo.paper</groupId>
|
||||
+ <artifactId>paper-api</artifactId>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
- <name>Spigot-API</name>
|
||||
- <url>https://www.spigotmc.org/</url>
|
||||
+ <name>Paper-API</name>
|
||||
+ <url>https://github.com/PaperMC/Paper</url>
|
||||
<description>An enhanced plugin API for Minecraft servers.</description>
|
||||
|
||||
<properties>
|
||||
- <skipTests>true</skipTests>
|
||||
+ <!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
- <distributionManagement>
|
||||
+ <repositories>
|
||||
<repository>
|
||||
- <id>spigotmc-releases</id>
|
||||
- <url>https://hub.spigotmc.org/nexus/content/repositories/releases/</url>
|
||||
+ <id>sonatype</id>
|
||||
+ <url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
- <snapshotRepository>
|
||||
- <id>spigotmc-snapshots</id>
|
||||
- <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
- </snapshotRepository>
|
||||
- </distributionManagement>
|
||||
+ </repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -37,6 +38,20 @@
|
||||
<version>2.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
+ <!-- bundled with Minecraft, shouldn't ever change -->
|
||||
+ <dependency>
|
||||
+ <groupId>com.google.code.findbugs</groupId>
|
||||
+ <artifactId>jsr305</artifactId>
|
||||
+ <version>1.3.9</version>
|
||||
+ <scope>compile</scope>
|
||||
+ </dependency>
|
||||
+ <!-- used in previous versions of the API -->
|
||||
+ <dependency>
|
||||
+ <groupId>com.googlecode.json-simple</groupId>
|
||||
+ <artifactId>json-simple</artifactId>
|
||||
+ <version>1.1.1</version>
|
||||
+ <scope>compile</scope>
|
||||
+ </dependency>
|
||||
<!-- bundled with Minecraft, should be kept in sync -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@@ -112,6 +127,7 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
+ <defaultGoal>clean install</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.md-5</groupId>
|
||||
@@ -130,10 +146,6 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
- <configuration>
|
||||
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
|
||||
- <compilerId>eclipse</compilerId>
|
||||
- </configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
@@ -183,6 +195,7 @@
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
+ <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||
<!-- when downloading via Maven we can pull depends individually -->
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
</configuration>
|
@ -1,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 1 Apr 2016 00:02:47 -0400
|
||||
Subject: [PATCH] Add FastUtil to Bukkit
|
||||
|
||||
Doesn't expose to plugins, just allows Paper-API to use it for optimization
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 61b8ee4e3e122dd2671f50ea3b432e4abd4600a2..12306d830c6889c2c9b12699abebe0411262aef6 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -32,6 +32,12 @@
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
+ <dependency>
|
||||
+ <groupId>it.unimi.dsi</groupId>
|
||||
+ <artifactId>fastutil</artifactId>
|
||||
+ <version>8.2.2</version>
|
||||
+ <scope>provided</scope>
|
||||
+ </dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
@ -1,30 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Kyle Wood <demonwav@gmail.com>
|
||||
Date: Fri, 4 Dec 2020 15:53:19 -0800
|
||||
Subject: [PATCH] Enable multi-release plugin jars
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
index 11e5618ff66385574ba04db0942a75227cf8eb0f..c833cee9fddd12afdfe6bde1435559819b9ad656 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||
@@ -58,7 +58,18 @@ public final class PluginClassLoader extends URLClassLoader { // Spigot
|
||||
this.description = description;
|
||||
this.dataFolder = dataFolder;
|
||||
this.file = file;
|
||||
- this.jar = new JarFile(file);
|
||||
+ // Paper - enable multi-release jars for Java 9+
|
||||
+ JarFile jarFile;
|
||||
+ try {
|
||||
+ final java.lang.reflect.Method runtimeVersionMethod = JarFile.class.getMethod("runtimeVersion");
|
||||
+ final Object runtimeVersion = runtimeVersionMethod.invoke(null);
|
||||
+ @SuppressWarnings("JavaReflectionMemberAccess") final java.lang.reflect.Constructor<JarFile> constructor = JarFile.class.getConstructor(File.class, boolean.class, int.class, runtimeVersion.getClass());
|
||||
+ jarFile = constructor.newInstance(file, true, java.util.zip.ZipFile.OPEN_READ, runtimeVersion);
|
||||
+ } catch (Exception ignored) {
|
||||
+ jarFile = new JarFile(file);
|
||||
+ }
|
||||
+ this.jar = jarFile;
|
||||
+ // Paper end
|
||||
this.manifest = jar.getManifest();
|
||||
this.url = file.toURI().toURL();
|
||||
this.libraryLoader = libraryLoader;
|
@ -1,69 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Thu, 3 Dec 2020 14:04:57 -0800
|
||||
Subject: [PATCH] Better AnnotationTest printout
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 6b71d9a397dd5b72320402a47b8e7197d24e061c..73fbd5d5a591871a3a386fb5c455cd96a3992e7a 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -257,6 +257,19 @@
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
</configuration>
|
||||
</plugin>
|
||||
+ <plugin>
|
||||
+ <groupId>org.apache.maven.plugins</groupId>
|
||||
+ <artifactId>maven-surefire-plugin</artifactId>
|
||||
+ <version>2.22.2</version>
|
||||
+ <configuration>
|
||||
+ <properties>
|
||||
+ <property>
|
||||
+ <name>listener</name>
|
||||
+ <value>io.papermc.paper.JunitEventListener</value>
|
||||
+ </property>
|
||||
+ </properties>
|
||||
+ </configuration>
|
||||
+ </plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
diff --git a/src/test/java/io/papermc/paper/JunitEventListener.java b/src/test/java/io/papermc/paper/JunitEventListener.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..072ac1a96394b8d494f42fca8dfe08115eaed3fe
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/JunitEventListener.java
|
||||
@@ -0,0 +1,6 @@
|
||||
+package io.papermc.paper;
|
||||
+
|
||||
+import org.junit.runner.notification.RunListener;
|
||||
+
|
||||
+public class JunitEventListener extends RunListener {
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 03229d5f4ec36a82197beb391356d791ff67fb2f..19271057cf24329757c9419fa6c97848e008a96c 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -107,13 +107,18 @@ public class AnnotationTest {
|
||||
|
||||
Collections.sort(errors);
|
||||
|
||||
- System.out.println(errors.size() + " missing annotation(s):");
|
||||
+ StringBuilder builder = new StringBuilder()
|
||||
+ .append("There ")
|
||||
+ .append(errors.size() != 1 ? "are " : "is ")
|
||||
+ .append(errors.size())
|
||||
+ .append(" missing annotation")
|
||||
+ .append(errors.size() != 1 ? "s:\n" : ":\n");
|
||||
+
|
||||
for (String message : errors) {
|
||||
- System.out.print("\t");
|
||||
- System.out.println(message);
|
||||
+ builder.append("\t").append(message).append("\n");
|
||||
}
|
||||
|
||||
- Assert.fail("There " + errors.size() + " are missing annotation(s)");
|
||||
+ Assert.fail(builder.toString());
|
||||
}
|
||||
|
||||
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
|
@ -1,291 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 20:40:33 -0600
|
||||
Subject: [PATCH] POM Changes
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 3fc047371e8f8a626e69697fad549d689c5dce89..a5d87d22cb1588d15e08da3b37e51c5e261c7799 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,15 +1,14 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot</artifactId>
|
||||
+ <artifactId>paper</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.16.5-R0.1-SNAPSHOT</version>
|
||||
- <name>Spigot</name>
|
||||
- <url>https://www.spigotmc.org/</url>
|
||||
+ <name>Paper</name>
|
||||
+ <url>https://papermc.io</url>
|
||||
|
||||
<properties>
|
||||
- <skipTests>true</skipTests>
|
||||
+ <!-- <skipTests>true</skipTests> Paper - This [was] not going to end well -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<api.version>unknown</api.version>
|
||||
<bt.name>git</bt.name>
|
||||
@@ -20,21 +19,39 @@
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-parent</artifactId>
|
||||
+ <groupId>com.destroystokyo.paper</groupId>
|
||||
+ <artifactId>paper-parent</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
+ <dependencyManagement>
|
||||
+ <dependencies>
|
||||
+ <dependency>
|
||||
+ <groupId>org.apache.logging.log4j</groupId>
|
||||
+ <artifactId>log4j-bom</artifactId>
|
||||
+ <version>2.11.2</version>
|
||||
+ <type>pom</type>
|
||||
+ <scope>import</scope>
|
||||
+ </dependency>
|
||||
+ </dependencies>
|
||||
+ </dependencyManagement>
|
||||
+
|
||||
<dependencies>
|
||||
<dependency>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-api</artifactId>
|
||||
+ <groupId>com.destroystokyo.paper</groupId>
|
||||
+ <artifactId>paper-api</artifactId>
|
||||
+ <version>${project.version}</version>
|
||||
+ <scope>compile</scope>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>com.destroystokyo.paper</groupId>
|
||||
+ <artifactId>paper-mojangapi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
+ <groupId>io.papermc</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>${minecraft.version}-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
@@ -45,18 +62,15 @@
|
||||
<version>2.12.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>org.apache.logging.log4j</groupId>
|
||||
+ <artifactId>log4j-api</artifactId>
|
||||
+ <scope>compile</scope>
|
||||
+ </dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-iostreams</artifactId>
|
||||
- <version>2.8.1</version>
|
||||
<scope>compile</scope>
|
||||
- <exclusions>
|
||||
- <!-- included in minecraft-server -->
|
||||
- <exclusion>
|
||||
- <groupId>org.apache.logging.log4j</groupId>
|
||||
- <artifactId>log4j-api</artifactId>
|
||||
- </exclusion>
|
||||
- </exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
@@ -64,12 +78,23 @@
|
||||
<version>9.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
+ <dependency>
|
||||
+ <!-- wrapper to use either java 8 sun cleaner or java9+ official cleaner -->
|
||||
+ <groupId>co.aikar</groupId>
|
||||
+ <artifactId>cleaner</artifactId>
|
||||
+ <version>1.0-SNAPSHOT</version>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>io.netty</groupId>
|
||||
+ <artifactId>netty-all</artifactId>
|
||||
+ <version>4.1.50.Final</version>
|
||||
+ </dependency>
|
||||
<!-- deprecated API depend -->
|
||||
<dependency>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<version>1.1.1</version>
|
||||
- <scope>runtime</scope>
|
||||
+ <scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
@@ -80,7 +105,7 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
- <version>5.1.49</version>
|
||||
+ <version>8.0.23</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- add these back in as they are not exposed by the API -->
|
||||
@@ -105,7 +130,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
- <version>2.8.1</version>
|
||||
+ <!--<version>2.8.1</version>--> <!--handled by bom-->
|
||||
<scope>runtime</scope>
|
||||
<exclusions>
|
||||
<!-- included in minecraft-server -->
|
||||
@@ -132,34 +157,22 @@
|
||||
|
||||
<!-- This builds a completely 'ready to start' jar with all dependencies inside -->
|
||||
<build>
|
||||
+ <finalName>paper-${minecraft.version}</finalName>
|
||||
+ <defaultGoal>clean install</defaultGoal> <!-- Paper -->
|
||||
<plugins>
|
||||
<plugin>
|
||||
- <groupId>net.md-5</groupId>
|
||||
- <artifactId>scriptus</artifactId>
|
||||
- <version>0.4.1</version>
|
||||
+ <groupId>com.lukegb.mojo</groupId>
|
||||
+ <artifactId>gitdescribe-maven-plugin</artifactId>
|
||||
+ <version>1.3</version>
|
||||
+ <configuration>
|
||||
+ <outputPrefix>git-Paper-</outputPrefix>
|
||||
+ <scmDirectory>..</scmDirectory>
|
||||
+ </configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
- <id>ex-spigot</id>
|
||||
- <configuration>
|
||||
- <format>${bt.name}-Spigot-%s</format>
|
||||
- <scmDirectory>../</scmDirectory>
|
||||
- <descriptionProperty>spigot.desc</descriptionProperty>
|
||||
- </configuration>
|
||||
- <phase>initialize</phase>
|
||||
- <goals>
|
||||
- <goal>describe</goal>
|
||||
- </goals>
|
||||
- </execution>
|
||||
- <execution>
|
||||
- <id>ex-craftbukkit</id>
|
||||
- <configuration>
|
||||
- <format>-%s</format>
|
||||
- <scmDirectory>../../CraftBukkit</scmDirectory>
|
||||
- <descriptionProperty>craftbukkit.desc</descriptionProperty>
|
||||
- </configuration>
|
||||
- <phase>initialize</phase>
|
||||
+ <phase>compile</phase>
|
||||
<goals>
|
||||
- <goal>describe</goal>
|
||||
+ <goal>gitdescribe</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
@@ -169,6 +182,7 @@
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
+ <forceCreation>true</forceCreation> <!-- Required to prevent shading the jar multiple times -->
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultEntries>false</addDefaultEntries>
|
||||
@@ -176,11 +190,13 @@
|
||||
<manifestEntries>
|
||||
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
|
||||
<Implementation-Title>CraftBukkit</Implementation-Title>
|
||||
- <Implementation-Version>${spigot.desc}${craftbukkit.desc}</Implementation-Version>
|
||||
- <Implementation-Vendor>${project.build.outputTimestamp}</Implementation-Vendor>
|
||||
+ <!--suppress MavenModelInspection -->
|
||||
+ <Implementation-Version>${describe}</Implementation-Version>
|
||||
+ <Implementation-Vendor>${maven.build.timestamp}</Implementation-Vendor>
|
||||
<Specification-Title>Bukkit</Specification-Title>
|
||||
<Specification-Version>${api.version}</Specification-Version>
|
||||
<Specification-Vendor>Bukkit Team</Specification-Vendor>
|
||||
+ <Multi-Release>true</Multi-Release>
|
||||
</manifestEntries>
|
||||
<manifestSections>
|
||||
<manifestSection>
|
||||
@@ -216,14 +232,24 @@
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
+ <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <!-- Paper -->
|
||||
<createSourcesJar>${shadeSourcesJar}</createSourcesJar>
|
||||
<filters>
|
||||
<filter>
|
||||
- <artifact>org.spigotmc:minecraft-server</artifact>
|
||||
+ <artifact>io.papermc:minecraft-server</artifact>
|
||||
<excludes>
|
||||
<exclude>com/google/common/**</exclude>
|
||||
<exclude>com/google/gson/**</exclude>
|
||||
<exclude>com/google/thirdparty/**</exclude>
|
||||
+ <!-- paper -->
|
||||
+ <exclude>io/netty/**</exclude>
|
||||
+ <exclude>META-INF/native/libnetty*</exclude>
|
||||
+ <exclude>com/mojang/brigadier/**</exclude>
|
||||
+ <exclude>META-INF/MANIFEST.MF</exclude>
|
||||
+ <exclude>com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.class</exclude>
|
||||
+ <exclude>com/mojang/datafixers/util/Either*</exclude>
|
||||
+ <exclude>org/apache/logging/log4j/**</exclude>
|
||||
+ <exclude>META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
<filter>
|
||||
@@ -245,10 +271,11 @@
|
||||
<pattern>jline</pattern>
|
||||
<shadedPattern>org.bukkit.craftbukkit.libs.jline</shadedPattern>
|
||||
</relocation>
|
||||
- <relocation>
|
||||
- <pattern>it.unimi</pattern>
|
||||
- <shadedPattern>org.bukkit.craftbukkit.libs.it.unimi</shadedPattern>
|
||||
- </relocation>
|
||||
+ <!-- Paper - Don't relocate fastutil in order to prevent api breakage -->
|
||||
+ <!--<relocation>-->
|
||||
+ <!--<pattern>it.unimi</pattern>-->
|
||||
+ <!--<shadedPattern>org.bukkit.craftbukkit.libs.it.unimi</shadedPattern>-->
|
||||
+ <!--</relocation>-->
|
||||
<relocation>
|
||||
<pattern>org.apache.commons.codec</pattern>
|
||||
<shadedPattern>org.bukkit.craftbukkit.libs.org.apache.commons.codec</shadedPattern>
|
||||
@@ -316,10 +343,6 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
- <configuration>
|
||||
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
|
||||
- <compilerId>eclipse</compilerId>
|
||||
- </configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index 4452427d0a8298d119ca29ef397b7a94f19eec28..46a16e31775b28c44f95a8ac5545ebcb656c74b6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -186,7 +186,7 @@ public class Main {
|
||||
}
|
||||
|
||||
if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
|
||||
- Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L);
|
||||
+ Date buildDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(Main.class.getPackage().getImplementationVendor()); // Paper
|
||||
|
||||
Calendar deadline = Calendar.getInstance();
|
||||
deadline.add(Calendar.DAY_OF_YEAR, -28);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 93046379d0cefd5d3236fc59e698809acdc18f80..674096cab190d62622f9947853b056f57d43a2a5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.spigotmc/spigot-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.destroystokyo.paper/paper-api/pom.properties");
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
File diff suppressed because one or more lines are too long
@ -1,144 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 01:40:13 -0400
|
||||
Subject: [PATCH] Add MinecraftKey Information to Objects
|
||||
|
||||
Stores the reference to the objects respective MinecraftKey
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 68cd4134cb6a00c1768100462f8e9e94f3fa6279..6943524c2dd8b12691b8ac5b08daee823ce50c3d 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -208,7 +208,7 @@ public class PaperCommand extends Command {
|
||||
|
||||
Collection<Entity> entities = world.entitiesById.values();
|
||||
entities.forEach(e -> {
|
||||
- MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch
|
||||
+ MinecraftKey key = e.getMinecraftKey();
|
||||
|
||||
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
|
||||
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ);
|
||||
diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..500477f0d98a277145c2b0dbb4d1496e2a588542
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/KeyedObject.java
|
||||
@@ -0,0 +1,11 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import net.minecraft.resources.MinecraftKey;
|
||||
+
|
||||
+public interface KeyedObject {
|
||||
+ MinecraftKey getMinecraftKey();
|
||||
+ default String getMinecraftKeyString() {
|
||||
+ MinecraftKey key = getMinecraftKey();
|
||||
+ return key != null ? key.toString() : null;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 3c8767d5fab575e61ca179b517f0bff1a38405ce..ec553e7d7595ef3652bfa3325a07483bb3c32245 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -136,7 +136,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
// CraftBukkit end
|
||||
|
||||
-public abstract class Entity implements INamableTileEntity, ICommandListener {
|
||||
+public abstract class Entity implements INamableTileEntity, ICommandListener, net.minecraft.server.KeyedObject { // Paper
|
||||
|
||||
// CraftBukkit start
|
||||
private static final int CURRENT_LEVEL = 2;
|
||||
@@ -1762,12 +1762,31 @@ public abstract class Entity implements INamableTileEntity, ICommandListener {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private MinecraftKey entityKey;
|
||||
+ private String entityKeyString;
|
||||
+
|
||||
+ @Override
|
||||
+ public MinecraftKey getMinecraftKey() {
|
||||
+ if (entityKey == null) {
|
||||
+ this.entityKey = EntityTypes.getName(this.getEntityType());
|
||||
+ this.entityKeyString = this.entityKey != null ? this.entityKey.toString() : null;
|
||||
+ }
|
||||
+ return entityKey;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getMinecraftKeyString() {
|
||||
+ getMinecraftKey(); // Try to load if it doesn't exists. see: https://github.com/PaperMC/Paper/issues/1280
|
||||
+ return entityKeyString;
|
||||
+ }
|
||||
@Nullable
|
||||
public final String getSaveID() {
|
||||
EntityTypes<?> entitytypes = this.getEntityType();
|
||||
MinecraftKey minecraftkey = EntityTypes.getName(entitytypes);
|
||||
|
||||
- return entitytypes.a() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
+ return entitytypes != null && entitytypes.isPersistable() ? getMinecraftKeyString() : null;
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
protected abstract void loadData(NBTTagCompound nbttagcompound);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java
|
||||
index ac57ab9992e141c91cf48f033148ad78433b364c..dc92b112770955f9fa49a408262da2e5bbc4bf98 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java
|
||||
@@ -384,6 +384,7 @@ public class EntityTypes<T extends Entity> {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean isPersistable() { return a(); } // Paper - OBFHELPER
|
||||
public boolean a() {
|
||||
return this.bi;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
index 72d43b38de3e797a509de6591874af12fa7b9ec0..2b58ae6d91fe0d0f36eedbb78a3c8a8a66d92405 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
@@ -23,7 +23,7 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import org.spigotmc.CustomTimingsHandler; // Spigot
|
||||
|
||||
-public abstract class TileEntity {
|
||||
+public abstract class TileEntity implements net.minecraft.server.KeyedObject { // Paper
|
||||
|
||||
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
|
||||
// CraftBukkit start - data containers
|
||||
@@ -31,7 +31,7 @@ public abstract class TileEntity {
|
||||
public CraftPersistentDataContainer persistentDataContainer;
|
||||
// CraftBukkit end
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
- private final TileEntityTypes<?> tileType;
|
||||
+ private final TileEntityTypes<?> tileType; public TileEntityTypes getTileEntityType() { return tileType; } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
protected World world;
|
||||
protected BlockPosition position;
|
||||
@@ -45,6 +45,26 @@ public abstract class TileEntity {
|
||||
this.tileType = tileentitytypes;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private String tileEntityKeyString = null;
|
||||
+ private MinecraftKey tileEntityKey = null;
|
||||
+
|
||||
+ @Override
|
||||
+ public MinecraftKey getMinecraftKey() {
|
||||
+ if (tileEntityKey == null) {
|
||||
+ tileEntityKey = TileEntityTypes.a(this.getTileEntityType());
|
||||
+ tileEntityKeyString = tileEntityKey != null ? tileEntityKey.toString() : null;
|
||||
+ }
|
||||
+ return tileEntityKey;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public String getMinecraftKeyString() {
|
||||
+ getMinecraftKey(); // Try to load if it doesn't exists.
|
||||
+ return tileEntityKeyString;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Nullable
|
||||
public World getWorld() {
|
||||
return this.world;
|
@ -1,171 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 02:10:36 -0400
|
||||
Subject: [PATCH] Store reference to current Chunk for Entity and Block
|
||||
Entities
|
||||
|
||||
This enables us a fast reference to the entities current chunk instead
|
||||
of having to look it up by hashmap lookups.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index ec553e7d7595ef3652bfa3325a07483bb3c32245..2bea2f4748cadf479dd4f89792ef5ffdd88e9cab 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -261,7 +261,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
|
||||
public boolean isChunkLoaded() {
|
||||
- return world.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4);
|
||||
+ return getCurrentChunk() != null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -1763,6 +1763,23 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
|
||||
// Paper start
|
||||
+ public java.lang.ref.WeakReference<net.minecraft.world.level.chunk.Chunk> currentChunk = null;
|
||||
+
|
||||
+ public void setCurrentChunk(net.minecraft.world.level.chunk.Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
+ }
|
||||
+ /**
|
||||
+ * Returns the entities current registered chunk. If the entity is not added to a chunk yet, it will return null
|
||||
+ */
|
||||
+ public net.minecraft.world.level.chunk.Chunk getCurrentChunk() {
|
||||
+ final net.minecraft.world.level.chunk.Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||
+ if (chunk != null && chunk.loaded) {
|
||||
+ return chunk;
|
||||
+ }
|
||||
+
|
||||
+ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(chunkX, chunkZ);
|
||||
+ }
|
||||
+
|
||||
private MinecraftKey entityKey;
|
||||
private String entityKeyString;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
index 2b58ae6d91fe0d0f36eedbb78a3c8a8a66d92405..75110c41af3e0097aef65091a2497dd87d08b4b2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.EnumBlockMirror;
|
||||
import net.minecraft.world.level.block.EnumBlockRotation;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
+import net.minecraft.world.level.chunk.Chunk;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.util.Supplier;
|
||||
@@ -63,6 +64,15 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
|
||||
getMinecraftKey(); // Try to load if it doesn't exists.
|
||||
return tileEntityKeyString;
|
||||
}
|
||||
+
|
||||
+ private java.lang.ref.WeakReference<Chunk> currentChunk = null;
|
||||
+ public Chunk getCurrentChunk() {
|
||||
+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
|
||||
+ return chunk != null && chunk.loaded ? chunk : null;
|
||||
+ }
|
||||
+ public void setCurrentChunk(Chunk chunk) {
|
||||
+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
index b15200c2a3923bd8be2ee5e73fdadfeea3e3a8dc..929f6fcd4b9f1b9a1488e170d6a77a5d64beecf3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
@@ -90,11 +90,36 @@ public class Chunk implements IChunkAccess {
|
||||
this(world, chunkcoordintpair, biomestorage, ChunkConverter.a, TickListEmpty.b(), TickListEmpty.b(), 0L, (ChunkSection[]) null, (Consumer) null);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private class TileEntityHashMap extends java.util.HashMap<BlockPosition, TileEntity> {
|
||||
+ @Override
|
||||
+ public TileEntity put(BlockPosition key, TileEntity value) {
|
||||
+ TileEntity replaced = super.put(key, value);
|
||||
+ if (replaced != null) {
|
||||
+ replaced.setCurrentChunk(null);
|
||||
+ }
|
||||
+ if (value != null) {
|
||||
+ value.setCurrentChunk(Chunk.this);
|
||||
+ }
|
||||
+ return replaced;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public TileEntity remove(Object key) {
|
||||
+ TileEntity removed = super.remove(key);
|
||||
+ if (removed != null) {
|
||||
+ removed.setCurrentChunk(null);
|
||||
+ }
|
||||
+ return removed;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage, ChunkConverter chunkconverter, TickList<Block> ticklist, TickList<FluidType> ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer<Chunk> consumer) {
|
||||
this.sections = new ChunkSection[16];
|
||||
this.e = Maps.newHashMap();
|
||||
this.heightMap = Maps.newEnumMap(HeightMap.Type.class);
|
||||
- this.tileEntities = Maps.newHashMap();
|
||||
+ this.tileEntities = new TileEntityHashMap(); // Paper
|
||||
this.l = Maps.newHashMap();
|
||||
this.m = Maps.newHashMap();
|
||||
this.n = new ShortList[16];
|
||||
@@ -505,6 +530,7 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
entity.inChunk = true;
|
||||
+ entity.setCurrentChunk(this); // Paper
|
||||
entity.chunkX = this.loc.x;
|
||||
entity.chunkY = k;
|
||||
entity.chunkZ = this.loc.z;
|
||||
@@ -517,6 +543,7 @@ public class Chunk implements IChunkAccess {
|
||||
((HeightMap) this.heightMap.get(heightmap_type)).a(along);
|
||||
}
|
||||
|
||||
+ public final void removeEntity(Entity entity) { this.b(entity); } // Paper - OBFHELPER
|
||||
public void b(Entity entity) {
|
||||
this.a(entity, entity.chunkY);
|
||||
}
|
||||
@@ -531,7 +558,12 @@ public class Chunk implements IChunkAccess {
|
||||
i = this.entitySlices.length - 1;
|
||||
}
|
||||
|
||||
- this.entitySlices[i].remove(entity);
|
||||
+ // Paper start
|
||||
+ if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
|
||||
+ if (!this.entitySlices[i].remove(entity)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.entities.remove(entity); // Paper
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index df7e5f1d17ddfeffc15df02906c3bf9f9461d82b..eea242af23825ad29ada6e997205e87edffb6bb9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -145,6 +145,7 @@ import net.minecraft.world.entity.vehicle.EntityMinecartMobSpawner;
|
||||
import net.minecraft.world.entity.vehicle.EntityMinecartRideable;
|
||||
import net.minecraft.world.entity.vehicle.EntityMinecartTNT;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
+import org.bukkit.Chunk; // Paper
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
@@ -186,6 +187,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public Chunk getChunk() {
|
||||
+ net.minecraft.world.level.chunk.Chunk currentChunk = entity.getCurrentChunk();
|
||||
+ return currentChunk != null ? currentChunk.bukkitChunk : getLocation().getChunk();
|
||||
+ }
|
||||
+
|
||||
public static CraftEntity getEntity(CraftServer server, Entity entity) {
|
||||
/*
|
||||
* Order is *EXTREMELY* important -- keep it right! =D
|
@ -1,114 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 1 Mar 2016 13:02:51 -0600
|
||||
Subject: [PATCH] Configurable cactus bamboo and reed growth heights
|
||||
|
||||
Bamboo - Both the minimum fully-grown heights and the maximum are configurable
|
||||
- Machine_Maker
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index b31109d2dadd29e8852468c19265066b773d2be0..3618cc017feb60e257a28f67cbddca3f792a9833 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -65,4 +65,17 @@ public class PaperWorldConfig {
|
||||
config.addDefault("world-settings.default." + path, def);
|
||||
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
|
||||
}
|
||||
+
|
||||
+ public int cactusMaxHeight;
|
||||
+ public int reedMaxHeight;
|
||||
+ public int bambooMaxHeight;
|
||||
+ public int bambooMinHeight;
|
||||
+ private void blockGrowthHeight() {
|
||||
+ cactusMaxHeight = getInt("max-growth-height.cactus", 3);
|
||||
+ reedMaxHeight = getInt("max-growth-height.reeds", 3);
|
||||
+ bambooMaxHeight = getInt("max-growth-height.bamboo.max", 16);
|
||||
+ bambooMinHeight = getInt("max-growth-height.bamboo.min", 11);
|
||||
+ log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + ".");
|
||||
+
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockBamboo.java b/src/main/java/net/minecraft/world/level/block/BlockBamboo.java
|
||||
index 6d10a7cb48627f37dc91b73064edc5f18c2b5ce9..cd132eff3f82349518555d1d5a16778ca08a521b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockBamboo.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockBamboo.java
|
||||
@@ -124,7 +124,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
|
||||
if (random.nextInt(Math.max(1, (int) (100.0F / worldserver.spigotConfig.bambooModifier) * 3)) == 0 && worldserver.isEmpty(blockposition.up()) && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot
|
||||
int i = this.b(worldserver, blockposition) + 1;
|
||||
|
||||
- if (i < 16) {
|
||||
+ if (i < worldserver.paperConfig.bambooMaxHeight) { // Paper
|
||||
this.a(iblockdata, (World) worldserver, blockposition, random, i);
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
|
||||
int i = this.a(iblockaccess, blockposition);
|
||||
int j = this.b(iblockaccess, blockposition);
|
||||
|
||||
- return i + j + 1 < 16 && (Integer) iblockaccess.getType(blockposition.up(i)).get(BlockBamboo.f) != 1;
|
||||
+ return i + j + 1 < ((World) iblockaccess).paperConfig.bambooMaxHeight && (Integer) iblockaccess.getType(blockposition.up(i)).get(BlockBamboo.f) != 1; // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,7 +174,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
|
||||
BlockPosition blockposition1 = blockposition.up(i);
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition1);
|
||||
|
||||
- if (k >= 16 || !iblockdata1.a(Blocks.BAMBOO) || (Integer) iblockdata1.get(BlockBamboo.f) == 1 || !worldserver.isEmpty(blockposition1.up())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here
|
||||
+ if (k >= worldserver.paperConfig.bambooMaxHeight || !iblockdata1.a(Blocks.BAMBOO) || (Integer) iblockdata1.get(BlockBamboo.f) == 1 || !worldserver.isEmpty(blockposition1.up())) { // CraftBukkit - If the BlockSpreadEvent was cancelled, we have no bamboo here // Paper - Configurable cactus bamboo and reed growth heights
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
|
||||
}
|
||||
|
||||
int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1;
|
||||
- int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;
|
||||
+ int k = (i < world.paperConfig.bambooMinHeight || random.nextFloat() >= 0.25F) && i != (world.paperConfig.bambooMaxHeight - 1) ? 0 : 1; // Paper
|
||||
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3)) {
|
||||
@@ -230,7 +230,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
|
||||
protected int a(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
int i;
|
||||
|
||||
- for (i = 0; i < 16 && iblockaccess.getType(blockposition.up(i + 1)).a(Blocks.BAMBOO); ++i) {
|
||||
+ for (i = 0; i < ((World) iblockaccess).paperConfig.bambooMaxHeight && iblockaccess.getType(blockposition.up(i + 1)).a(Blocks.BAMBOO); ++i) { // Paper
|
||||
;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement {
|
||||
protected int b(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
int i;
|
||||
|
||||
- for (i = 0; i < 16 && iblockaccess.getType(blockposition.down(i + 1)).a(Blocks.BAMBOO); ++i) {
|
||||
+ for (i = 0; i < ((World) iblockaccess).paperConfig.bambooMaxHeight && iblockaccess.getType(blockposition.down(i + 1)).a(Blocks.BAMBOO); ++i) { // Paper
|
||||
;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockCactus.java b/src/main/java/net/minecraft/world/level/block/BlockCactus.java
|
||||
index c2316e346f9b647edae4c9709defa4531e04eaa6..9f1e9fc5361cd051b909e2e1b2095722064185da 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockCactus.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockCactus.java
|
||||
@@ -55,7 +55,7 @@ public class BlockCactus extends Block {
|
||||
;
|
||||
}
|
||||
|
||||
- if (i < 3) {
|
||||
+ if (i < worldserver.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height
|
||||
int j = (Integer) iblockdata.get(BlockCactus.AGE);
|
||||
|
||||
if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockReed.java b/src/main/java/net/minecraft/world/level/block/BlockReed.java
|
||||
index eb95d65e1a37b91a71a9ad8968710ba9047f3980..a4ede7968ba0134f0d2cf880a6b4a6b9a81f2fcd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockReed.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockReed.java
|
||||
@@ -51,7 +51,7 @@ public class BlockReed extends Block {
|
||||
;
|
||||
}
|
||||
|
||||
- if (i < 3) {
|
||||
+ if (i < worldserver.paperConfig.reedMaxHeight) { // Paper - Configurable growth height
|
||||
int j = (Integer) iblockdata.get(BlockReed.AGE);
|
||||
|
||||
if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot
|
@ -1,51 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 1 Mar 2016 13:09:16 -0600
|
||||
Subject: [PATCH] Configurable baby zombie movement speed
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 3618cc017feb60e257a28f67cbddca3f792a9833..796c17e0941922a9716212c6eae91643d8360418 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -78,4 +78,15 @@ public class PaperWorldConfig {
|
||||
log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + ".");
|
||||
|
||||
}
|
||||
+
|
||||
+ public double babyZombieMovementModifier;
|
||||
+ private void babyZombieMovementModifier() {
|
||||
+ babyZombieMovementModifier = getDouble("baby-zombie-movement-modifier", 0.5D);
|
||||
+ if (PaperConfig.version < 20) {
|
||||
+ babyZombieMovementModifier = getDouble("baby-zombie-movement-speed", 0.5D);
|
||||
+ set("baby-zombie-movement-modifier", babyZombieMovementModifier);
|
||||
+ }
|
||||
+
|
||||
+ log("Baby zombies will move at the speed of " + babyZombieMovementModifier);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
index daa6d1ca20f952971a2ad6a0c4cba0bef6e43bf6..219e3b1626d68ede57b08a706d24bb6bc4b13fac 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
@@ -82,7 +82,7 @@ import org.bukkit.event.entity.EntityTransformEvent;
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
- private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE);
|
||||
+ private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.c; // Paper - remove static - Make baby speed configurable
|
||||
private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<Integer> bo = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b);
|
||||
public static final DataWatcherObject<Boolean> DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i);
|
||||
@@ -185,9 +185,9 @@ public class EntityZombie extends EntityMonster {
|
||||
if (this.world != null && !this.world.isClientSide) {
|
||||
AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
- attributemodifiable.removeModifier(EntityZombie.c);
|
||||
+ attributemodifiable.removeModifier(this.babyModifier); // Paper
|
||||
if (flag) {
|
||||
- attributemodifiable.b(EntityZombie.c);
|
||||
+ attributemodifiable.b(this.babyModifier); // Paper
|
||||
}
|
||||
}
|
||||
|
@ -1,98 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 1 Mar 2016 13:24:16 -0600
|
||||
Subject: [PATCH] Allow nerfed mobs to jump and take water damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 78948c42b13194005bdbbbc69c2b7ae0732a78c5..b41e7922dd96c3358eb849ab39982a75736e3476 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -97,4 +97,9 @@ public class PaperWorldConfig {
|
||||
fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600);
|
||||
log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks");
|
||||
}
|
||||
+
|
||||
+ public boolean nerfedMobsShouldJump;
|
||||
+ private void nerfedMobsShouldJump() {
|
||||
+ nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index db8970539f7f69c9087abe43286bca008cb4594d..0b86c697541e3ee6083b3c10ab3618ef740b1904 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1105,6 +1105,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
return this.isInWater() || this.isInRain();
|
||||
}
|
||||
|
||||
+ public final boolean isInWaterOrRainOrBubble() { return aG(); } // Paper - OBFHELPER
|
||||
public boolean aG() {
|
||||
return this.isInWater() || this.isInRain() || this.k();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
index dbfcdc3cc7c1dccf785f5e13634e84c5af088985..28aa0a9361e8a32763d7fe1af060f0016e8c1e50 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -98,6 +98,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
private final EntityAIBodyControl c;
|
||||
protected NavigationAbstract navigation;
|
||||
public PathfinderGoalSelector goalSelector;
|
||||
+ @Nullable public PathfinderGoalFloat goalFloat; // Paper
|
||||
public PathfinderGoalSelector targetSelector;
|
||||
private EntityLiving goalTarget;
|
||||
private final EntitySenses bo;
|
||||
@@ -784,7 +785,17 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
@Override
|
||||
protected final void doTick() {
|
||||
++this.ticksFarFromPlayer;
|
||||
- if (!this.aware) return; // CraftBukkit
|
||||
+ if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage
|
||||
+ if (goalFloat != null) {
|
||||
+ if (goalFloat.validConditions()) goalFloat.update();
|
||||
+ this.getControllerJump().jumpIfSet();
|
||||
+ }
|
||||
+ if ((this instanceof EntityBlaze || this instanceof EntityEnderman) && isInWaterOrRainOrBubble()) {
|
||||
+ damageEntity(DamageSource.DROWN, 1.0F);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.world.getMethodProfiler().enter("sensing");
|
||||
this.bo.a();
|
||||
this.world.getMethodProfiler().exit();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java
|
||||
index 9767ac416fcd60a8a57b648dcb3f1e427bacd54d..1a9b3e0e0c090683e332dfa53708f8a62c8f14e0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java
|
||||
@@ -15,6 +15,7 @@ public class ControllerJump {
|
||||
this.a = true;
|
||||
}
|
||||
|
||||
+ public final void jumpIfSet() { this.b(); } // Paper - OBFHELPER
|
||||
public void b() {
|
||||
this.b.setJumping(this.a);
|
||||
this.a = false;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java
|
||||
index 8dfa1a6ade7f51e5d68b290f5376d999bb4c60ab..a6c8763139ed18fe73b2d6f6ec511e59666dc843 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java
|
||||
@@ -11,15 +11,18 @@ public class PathfinderGoalFloat extends PathfinderGoal {
|
||||
|
||||
public PathfinderGoalFloat(EntityInsentient entityinsentient) {
|
||||
this.a = entityinsentient;
|
||||
+ if (entityinsentient.getWorld().paperConfig.nerfedMobsShouldJump) entityinsentient.goalFloat = this; // Paper
|
||||
this.a(EnumSet.of(PathfinderGoal.Type.JUMP));
|
||||
entityinsentient.getNavigation().d(true);
|
||||
}
|
||||
|
||||
+ public final boolean validConditions() { return this.a(); } // Paper - OBFHELPER
|
||||
@Override
|
||||
public boolean a() {
|
||||
return this.a.isInWater() && this.a.b((Tag) TagsFluid.WATER) > this.a.cx() || this.a.aQ();
|
||||
}
|
||||
|
||||
+ public void update() { this.e(); } // Paper - OBFHELPER
|
||||
@Override
|
||||
public void e() {
|
||||
if (this.a.getRandom().nextFloat() < 0.8F) {
|
@ -1,94 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Tue, 1 Mar 2016 14:14:15 -0600
|
||||
Subject: [PATCH] Drop falling block and tnt entities at the specified height
|
||||
|
||||
* Dec 2, 2020 Added tnt nerf for tnt minecarts - Machine_Maker
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 89e76dd73811fd0f6f8c8e7e5af804d5a4bb5a75..d16ae924bcbe31c964f7fb448757c748e5c4418c 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -124,4 +124,14 @@ public class PaperWorldConfig {
|
||||
keepSpawnInMemory = getBoolean("keep-spawn-loaded", true);
|
||||
log("Keep spawn chunk loaded: " + keepSpawnInMemory);
|
||||
}
|
||||
+
|
||||
+ public int fallingBlockHeightNerf;
|
||||
+ public int entityTNTHeightNerf;
|
||||
+ private void heightNerfs() {
|
||||
+ fallingBlockHeightNerf = getInt("falling-block-height-nerf", 0);
|
||||
+ entityTNTHeightNerf = getInt("tnt-entity-height-nerf", 0);
|
||||
+
|
||||
+ if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
|
||||
+ if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0b86c697541e3ee6083b3c10ab3618ef740b1904..d7dfb89faa47817c51257bb124cfb3806c5e27da 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1850,6 +1850,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
return this.a(itemstack, 0.0F);
|
||||
}
|
||||
|
||||
+ @Nullable public final EntityItem dropItem(ItemStack itemstack, float offset) { return this.a(itemstack, offset); } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
public EntityItem a(ItemStack itemstack, float f) {
|
||||
if (itemstack.isEmpty()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
index b3dea8d65c3d1e27e59be142ec9e2ebb4164aed0..901522f24b8bc58861e46eda400dbab92bb6401d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
@@ -124,6 +124,17 @@ public class EntityFallingBlock extends Entity {
|
||||
}
|
||||
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
+
|
||||
+ // Paper start - Configurable EntityFallingBlock height nerf
|
||||
+ if (this.world.paperConfig.fallingBlockHeightNerf != 0 && this.locY() > this.world.paperConfig.fallingBlockHeightNerf) {
|
||||
+ if (this.dropItem && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
+ this.a(block);
|
||||
+ }
|
||||
+
|
||||
+ this.die();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (!this.world.isClientSide) {
|
||||
blockposition = this.getChunkCoordinates();
|
||||
boolean flag = this.block.getBlock() instanceof BlockConcretePowder;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
index c2e7161dc103c971908ff217eaf972e9f175d044..4f4b2b8d58223fa22d6a7af5c94cfb36399b9641 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
@@ -70,6 +70,12 @@ public class EntityTNTPrimed extends Entity {
|
||||
}
|
||||
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
+ // Paper start - Configurable TNT entity height nerf
|
||||
+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) {
|
||||
+ this.die();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.setMot(this.getMot().a(0.98D));
|
||||
if (this.onGround) {
|
||||
this.setMot(this.getMot().d(0.7D, -0.5D, 0.7D));
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
||||
index ee31704ffb88ab68702657554d386e8ebfa05d03..4bec5c1d504b9456dafe1b76bdbb523d0a324abe 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
|
||||
@@ -47,6 +47,12 @@ public class EntityMinecartTNT extends EntityMinecartAbstract {
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.b > 0) {
|
||||
+ // Paper start - Configurable TNT entity height nerf
|
||||
+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) {
|
||||
+ this.die();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
--this.b;
|
||||
this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D);
|
||||
} else if (this.b == 0) {
|
@ -1,157 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Tue, 1 Mar 2016 14:47:52 -0600
|
||||
Subject: [PATCH] Player affects spawning API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 20e4ff812960a54872f2fea8fe6baf7bb1ef077d..cae9da158f54438d2a397665c7ce964f6f755469 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1354,6 +1354,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
return MathHelper.c(f * f + f1 * f1 + f2 * f2);
|
||||
}
|
||||
|
||||
+ public double getDistanceSquared(double x, double y, double z) { return h(x, y, z); } // Paper - OBFHELPER
|
||||
public double h(double d0, double d1, double d2) {
|
||||
double d3 = this.locX() - d0;
|
||||
double d4 = this.locY() - d1;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
index f93af56f68d5fd27eca38d333ca429ce22fc397b..0631cd531647239858b2a7298f58cc770720f69a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -756,7 +756,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.L()) {
|
||||
this.die();
|
||||
} else if (!this.isPersistent() && !this.isSpecialPersistence()) {
|
||||
- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||
+ EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D, IEntitySelector.affectsSpawning); // Paper
|
||||
|
||||
if (entityhuman != null) {
|
||||
double d0 = entityhuman.h((Entity) this); // CraftBukkit - decompile error
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java
|
||||
index 6e78192a5898df017d96acba845a288011d24e35..dfcfdb31ca9531913d705aaaf85fb67399cfdc8c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java
|
||||
@@ -29,6 +29,12 @@ public final class IEntitySelector {
|
||||
return !entity.isSpectator();
|
||||
};
|
||||
|
||||
+ // Paper start
|
||||
+ public static final Predicate<Entity> affectsSpawning = (entity) -> {
|
||||
+ return !entity.isSpectator() && entity.isAlive() && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).affectsSpawning;
|
||||
+ };
|
||||
+ // Paper end
|
||||
+
|
||||
public static Predicate<Entity> a(double d0, double d1, double d2, double d3) {
|
||||
double d4 = d3 * d3;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java b/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
index 0b3b430766fba602e74727f78173567ca10fabc6..e1fcb1be102822e87eaf7757fbd64a516b2f58ac 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java
|
||||
@@ -122,7 +122,7 @@ public class EntitySilverfish extends EntityMonster {
|
||||
if (c(entitytypes, generatoraccess, enummobspawn, blockposition, random)) {
|
||||
EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true);
|
||||
|
||||
- return entityhuman == null;
|
||||
+ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
index 1017ee73b8617ce2b6734469fa49aaff7563c2b1..f42e16589476c1bd10b13214dda5ac7bb3e52131 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
@@ -164,6 +164,9 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
private final ItemCooldown bM;
|
||||
@Nullable
|
||||
public EntityFishingHook hookedFish;
|
||||
+ // Paper start
|
||||
+ public boolean affectsSpawning = true;
|
||||
+ // Paper end
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java
|
||||
index 4ece69851e7b05016f52c291ce911eb791cf3a23..6d5d4c3df65995b9a13b66d070ba08d553cc98a2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java
|
||||
@@ -92,8 +92,9 @@ public interface IEntityAccess {
|
||||
}
|
||||
}
|
||||
|
||||
- @Nullable
|
||||
- default EntityHuman a(double d0, double d1, double d2, double d3, @Nullable Predicate<Entity> predicate) {
|
||||
+ default EntityHuman findNearbyPlayer(Entity entity, double d0, @Nullable Predicate<Entity> predicate) { return this.findNearbyPlayer(entity.locX(), entity.locY(), entity.locZ(), d0, predicate); } // Paper
|
||||
+ @Nullable default EntityHuman findNearbyPlayer(double d0, double d1, double d2, double d3, @Nullable Predicate<Entity> predicate) { return a(d0, d1, d2, d3, predicate); } // Paper - OBFHELPER
|
||||
+ @Nullable default EntityHuman a(double d0, double d1, double d2, double d3, @Nullable Predicate<Entity> predicate) { // Paper
|
||||
double d4 = -1.0D;
|
||||
EntityHuman entityhuman = null;
|
||||
Iterator iterator = this.getPlayers().iterator();
|
||||
@@ -126,6 +127,27 @@ public interface IEntityAccess {
|
||||
return this.a(d0, d1, d2, d3, predicate);
|
||||
}
|
||||
|
||||
+ // Paper end
|
||||
+ default boolean isAffectsSpawningPlayerNearby(double d0, double d1, double d2, double d3) {
|
||||
+ Iterator iterator = this.getPlayers().iterator();
|
||||
+ double d4;
|
||||
+ do {
|
||||
+ EntityHuman entityhuman;
|
||||
+ do {
|
||||
+ if (!iterator.hasNext()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ entityhuman = (EntityHuman) iterator.next();
|
||||
+ } while (!IEntitySelector.affectsSpawning.test(entityhuman));
|
||||
+
|
||||
+ d4 = entityhuman.getDistanceSquared(d0, d1, d2);
|
||||
+ } while (d3 >= 0.0D && d4 >= d3 * d3);
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
default boolean isPlayerNearby(double d0, double d1, double d2, double d3) {
|
||||
Iterator iterator = this.getPlayers().iterator();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
index 33cba4e475edc0573b901f70c61d3659fd63ad62..8d8b03074df1635946f81bec0feae18d2f3e20aa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
@@ -66,7 +66,7 @@ public abstract class MobSpawnerAbstract {
|
||||
private boolean h() {
|
||||
BlockPosition blockposition = this.b();
|
||||
|
||||
- return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange);
|
||||
+ return this.a().isAffectsSpawningPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper
|
||||
}
|
||||
|
||||
public void c() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 6ab14bccb1fcd108931bf7ec331e60f652e0b42d..cc471418b37a745ecea1af964e81bc0362cf7d94 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1770,8 +1770,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@Override
|
||||
public String getLocale() {
|
||||
return getHandle().locale;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ // Paper start
|
||||
+ public void setAffectsSpawning(boolean affects) {
|
||||
+ this.getHandle().affectsSpawning = affects;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean getAffectsSpawning() {
|
||||
+ return this.getHandle().affectsSpawning;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void updateCommands() {
|
||||
if (getHandle().playerConnection == null) return;
|
@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Tue, 1 Mar 2016 15:08:03 -0600
|
||||
Subject: [PATCH] Remove invalid mob spawner tile entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
index ac576d268b23148089d404cb22d8c2f9d1a79d6e..a2d80c2c8e4f080f60746548f75631c5946ba8e2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
@@ -40,9 +40,11 @@ import net.minecraft.world.level.TickListChunk;
|
||||
import net.minecraft.world.level.TickListEmpty;
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.BlockMobSpawner;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.ITileEntity;
|
||||
import net.minecraft.world.level.block.entity.TileEntity;
|
||||
+import net.minecraft.world.level.block.entity.TileEntityMobSpawner;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.levelgen.ChunkProviderDebug;
|
||||
import net.minecraft.world.level.levelgen.HeightMap;
|
||||
@@ -648,6 +650,10 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
+ // Paper start - Remove invalid mob spawner tile entities
|
||||
+ } else if (tileentity instanceof TileEntityMobSpawner && !(getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getBlock() instanceof BlockMobSpawner)) {
|
||||
+ this.tileEntities.remove(blockposition);
|
||||
+ // Paper end
|
||||
} else {
|
||||
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ()
|
||||
+ " (" + getType(blockposition) + ") where there was no entity tile!");
|
@ -1,248 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 8 Mar 2015 22:55:25 -0600
|
||||
Subject: [PATCH] Optimize TileEntity Ticking
|
||||
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
index d4ebcf8f66197299256bd6b65710a1488c90ea41..c9164dfdb27ddf3709129c8aec54903a1df121ff 100644
|
||||
--- a/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
+++ b/src/main/java/co/aikar/timings/TimingsExport.java
|
||||
@@ -109,7 +109,7 @@ public class TimingsExport extends Thread {
|
||||
pair("end", System.currentTimeMillis() / 1000),
|
||||
pair("online-mode", Bukkit.getServer().getOnlineMode()),
|
||||
pair("sampletime", (System.currentTimeMillis() - TimingsManager.timingStart) / 1000),
|
||||
- pair("datapacks", toArrayMapper(MinecraftServer.getServer().getResourcePackRepository().d(), pack -> {
|
||||
+ pair("datapacks", toArrayMapper(MinecraftServer.getServer().getResourcePackRepository().e(), pack -> {
|
||||
// Don't feel like obf helper'ing these, non fatal if its temp missed.
|
||||
return ChatColor.stripColor(CraftChatMessage.fromComponent(pack.a(true)));
|
||||
}))
|
||||
@@ -148,8 +148,8 @@ public class TimingsExport extends Thread {
|
||||
);
|
||||
|
||||
parent.put("worlds", toObjectMapper(MinecraftServer.getServer().getWorlds(), world -> {
|
||||
- if (world.getWorldData().getName().equals("worldeditregentempworld")) return null;
|
||||
- return pair(world.getWorldData().getName(), createObject(
|
||||
+ if (world.getWorld().getName().equals("worldeditregentempworld")) return null;
|
||||
+ return pair(world.getWorld().getName(), createObject(
|
||||
pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> {
|
||||
return pair(rule, world.getWorld().getGameRuleValue(rule));
|
||||
})),
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java
|
||||
index 60e7dc1910ae9214d84d65b011cfec278b6b32ae..b229faad99120c67b089f7680d800fbe594fe7da 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java
|
||||
@@ -54,8 +54,8 @@ import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
public class BlockChest extends BlockChestAbstract<TileEntityChest> implements IBlockWaterlogged {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
- public static final BlockStateEnum<BlockPropertyChestType> c = BlockProperties.aF;
|
||||
- public static final BlockStateBoolean d = BlockProperties.C;
|
||||
+ public static final BlockStateEnum<BlockPropertyChestType> c = BlockProperties.aF; public static final BlockStateEnum<BlockPropertyChestType> CHEST_TYPE_PROPERTY = c; // Paper - OBFHELPER
|
||||
+ public static final BlockStateBoolean d = BlockProperties.C; public static final BlockStateBoolean waterlogged() { return d; } // Paper OBFHELPER
|
||||
protected static final VoxelShape e = Block.a(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D);
|
||||
protected static final VoxelShape f = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D);
|
||||
protected static final VoxelShape g = Block.a(0.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
|
||||
index eed95b370d1d624ffc6b7a35357b7028ec58c584..51167d776c710decb0107bebcb35bdf43103772b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.chat.ChatMessage;
|
||||
import net.minecraft.network.chat.IChatBaseComponent;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.sounds.SoundCategory;
|
||||
import net.minecraft.sounds.SoundEffect;
|
||||
import net.minecraft.sounds.SoundEffects;
|
||||
@@ -33,7 +34,7 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
// CraftBukkit end
|
||||
|
||||
-public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
+public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITickable
|
||||
|
||||
private NonNullList<ItemStack> items;
|
||||
protected float a;
|
||||
@@ -111,14 +112,20 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
- @Override
|
||||
public void tick() {
|
||||
int i = this.position.getX();
|
||||
int j = this.position.getY();
|
||||
int k = this.position.getZ();
|
||||
|
||||
++this.j;
|
||||
- this.viewingCount = a(this.world, this, this.j, i, j, k, this.viewingCount);
|
||||
+ }
|
||||
+
|
||||
+ public void doOpenLogic() {
|
||||
+ int i = this.position.getX();
|
||||
+ int j = this.position.getY();
|
||||
+ int k = this.position.getZ();
|
||||
+
|
||||
+ //this.viewingCount = a(this.world, this, this.j, i, j, k, this.viewingCount); // Paper - check is faulty given our logic is called before active container set
|
||||
this.b = this.a;
|
||||
float f = 0.1F;
|
||||
|
||||
@@ -132,8 +139,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
if (this.viewingCount > 0 && this.a == 0.0F) {
|
||||
this.playOpenSound(SoundEffects.BLOCK_CHEST_OPEN);
|
||||
}
|
||||
+ }
|
||||
|
||||
- if (this.viewingCount == 0 && this.a > 0.0F || this.viewingCount > 0 && this.a < 1.0F) {
|
||||
+ public void doCloseLogic() {
|
||||
+ if (this.viewingCount == 0 /* && this.a > 0.0F || this.viewingCount > 0 && this.a < 1.0F */) { // Paper - disable all but player count check
|
||||
+ /* // Paper - disable animation stuff
|
||||
float f1 = this.a;
|
||||
|
||||
if (this.viewingCount > 0) {
|
||||
@@ -149,8 +159,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
float f2 = 0.5F;
|
||||
|
||||
if (this.a < 0.5F && f1 >= 0.5F) {
|
||||
+ */
|
||||
+ MCUtil.scheduleTask(10, () -> {
|
||||
this.playOpenSound(SoundEffects.BLOCK_CHEST_CLOSE);
|
||||
- }
|
||||
+ }, "Chest Sounds");
|
||||
+ //} // Paper end
|
||||
|
||||
if (this.a < 0.0F) {
|
||||
this.a = 0.0F;
|
||||
@@ -189,6 +202,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
}
|
||||
|
||||
public void playOpenSound(SoundEffect soundeffect) {
|
||||
+ if (!this.getBlock().contains(BlockChest.CHEST_TYPE_PROPERTY)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074
|
||||
BlockPropertyChestType blockpropertychesttype = (BlockPropertyChestType) this.getBlock().get(BlockChest.c);
|
||||
|
||||
if (blockpropertychesttype != BlockPropertyChestType.LEFT) {
|
||||
@@ -227,6 +241,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
|
||||
++this.viewingCount;
|
||||
if (this.world == null) return; // CraftBukkit
|
||||
+ doOpenLogic(); // Paper
|
||||
|
||||
// CraftBukkit start - Call redstone event
|
||||
if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) {
|
||||
@@ -249,6 +264,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable {
|
||||
--this.viewingCount;
|
||||
|
||||
// CraftBukkit start - Call redstone event
|
||||
+ doCloseLogic(); // Paper
|
||||
if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) {
|
||||
int newPower = Math.max(0, Math.min(15, this.viewingCount));
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
|
||||
index 930f1bd091d9754f7ca5d9e36cdf49b2be03eb23..2bc4213c70be47ca8bbc24898cc92e43f4228821 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java
|
||||
@@ -1,11 +1,12 @@
|
||||
package net.minecraft.world.level.block.entity;
|
||||
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.sounds.SoundCategory;
|
||||
import net.minecraft.sounds.SoundEffects;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
-public class TileEntityEnderChest extends TileEntity implements ITickable {
|
||||
+public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable
|
||||
|
||||
public float a;
|
||||
public float b;
|
||||
@@ -16,18 +17,28 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
||||
super(TileEntityTypes.ENDER_CHEST);
|
||||
}
|
||||
|
||||
- @Override
|
||||
public void tick() {
|
||||
if (++this.g % 20 * 4 == 0) {
|
||||
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
|
||||
}
|
||||
|
||||
this.b = this.a;
|
||||
+ /* // Paper
|
||||
int i = this.position.getX();
|
||||
int j = this.position.getY();
|
||||
int k = this.position.getZ();
|
||||
float f = 0.1F;
|
||||
double d0;
|
||||
+ // Paper start
|
||||
+ */
|
||||
+ }
|
||||
+
|
||||
+ private void doOpenLogic() {
|
||||
+ int i = this.position.getX();
|
||||
+ int j = this.position.getY();
|
||||
+ int k = this.position.getZ();
|
||||
+ double d0;
|
||||
+ // Paper end
|
||||
|
||||
if (this.c > 0 && this.a == 0.0F) {
|
||||
double d1 = (double) i + 0.5D;
|
||||
@@ -35,8 +46,17 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
||||
d0 = (double) k + 0.5D;
|
||||
this.world.playSound((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.BLOCK_ENDER_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
+ // Paper start
|
||||
+ }
|
||||
|
||||
- if (this.c == 0 && this.a > 0.0F || this.c > 0 && this.a < 1.0F) {
|
||||
+ private void doCloseLogic() {
|
||||
+ int i = this.position.getX();
|
||||
+ int j = this.position.getY();
|
||||
+ int k = this.position.getZ();
|
||||
+ double d0;
|
||||
+
|
||||
+ if (this.c == 0) { /* && this.a > 0.0F || this.c > 0 && this.a < 1.0F) {
|
||||
+ // Paper end
|
||||
float f1 = this.a;
|
||||
|
||||
if (this.c > 0) {
|
||||
@@ -52,11 +72,14 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
||||
float f2 = 0.5F;
|
||||
|
||||
if (this.a < 0.5F && f1 >= 0.5F) {
|
||||
+ // Paper start
|
||||
+ */
|
||||
d0 = (double) i + 0.5D;
|
||||
double d2 = (double) k + 0.5D;
|
||||
|
||||
+ MCUtil.scheduleTask(10, () -> {
|
||||
this.world.playSound((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.BLOCK_ENDER_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
|
||||
- }
|
||||
+ }, "Chest Sounds");
|
||||
|
||||
if (this.a < 0.0F) {
|
||||
this.a = 0.0F;
|
||||
@@ -84,11 +107,13 @@ public class TileEntityEnderChest extends TileEntity implements ITickable {
|
||||
public void d() {
|
||||
++this.c;
|
||||
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
|
||||
+ doOpenLogic(); // Paper
|
||||
}
|
||||
|
||||
public void f() {
|
||||
--this.c;
|
||||
this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c);
|
||||
+ doCloseLogic(); // Paper
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java
|
||||
index e4b59a85ee9b435b2e86d4c7d78b7224773f6967..ba046cffdd8331c7e0427f19fa54d0c7a99077d9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java
|
||||
@@ -84,6 +84,7 @@ public abstract class IBlockDataHolder<O, S> {
|
||||
return Collections.unmodifiableCollection(this.b.keySet());
|
||||
}
|
||||
|
||||
+ public <T extends Comparable<T>> boolean contains(IBlockState<T> iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER
|
||||
public <T extends Comparable<T>> boolean b(IBlockState<T> iblockstate) {
|
||||
return this.b.containsKey(iblockstate);
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Tue, 1 Mar 2016 23:45:08 -0600
|
||||
Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/NBTTagList.java b/src/main/java/net/minecraft/nbt/NBTTagList.java
|
||||
index 4f6f6f51f9807bafa88482c0fe776c8b163107d7..ce6572df63c4e7341708aee60330fb214a3fe416 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NBTTagList.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NBTTagList.java
|
||||
@@ -190,6 +190,7 @@ public class NBTTagList extends NBTList<NBTBase> {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
+ public final double getDoubleAt(int i) { return this.h(i); } // Paper - OBFHELPER
|
||||
public double h(int i) {
|
||||
if (i >= 0 && i < this.list.size()) {
|
||||
NBTBase nbtbase = (NBTBase) this.list.get(i);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index cf38d517821659e25e786a805e229ef2d626d75f..26d461196b4a998b445f8c6e67fd7ec0606344f6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1246,6 +1246,11 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
this.navigators.add(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
entity.valid = true; // CraftBukkit
|
||||
+ // Paper start - Set origin location when the entity is being added to the world
|
||||
+ if (entity.origin == null) {
|
||||
+ entity.origin = entity.getBukkitEntity().getLocation();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index cae9da158f54438d2a397665c7ce964f6f755469..f6f0d551e22ff085935c1543bf84392de0368214 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -247,6 +247,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
|
||||
public boolean forceExplosionKnockback; // SPIGOT-949
|
||||
public boolean persistentInvisibility = false;
|
||||
+ public org.bukkit.Location origin; // Paper
|
||||
// Spigot start
|
||||
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
||||
public final boolean defaultActivationState;
|
||||
@@ -1625,6 +1626,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
this.bukkitEntity.storeBukkitValues(nbttagcompound);
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - Save the entity's origin location
|
||||
+ if (this.origin != null) {
|
||||
+ nbttagcompound.setUUID("Paper.OriginWorld", origin.getWorld().getUID());
|
||||
+ nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
|
||||
+ }
|
||||
+ // Paper end
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||
@@ -1747,6 +1754,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start - Restore the entity's origin location
|
||||
+ NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6);
|
||||
+ if (!originTag.isEmpty()) {
|
||||
+ org.bukkit.World originWorld = world.getWorld();
|
||||
+ if (nbttagcompound.hasKey("Paper.OriginWorld")) {
|
||||
+ originWorld = Bukkit.getWorld(nbttagcompound.getUUID("Paper.OriginWorld"));
|
||||
+ }
|
||||
+ origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -1808,6 +1826,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
|
||||
protected abstract void saveData(NBTTagCompound nbttagcompound);
|
||||
|
||||
+ protected final NBTTagList createList(double... adouble) { return a(adouble); } // Paper - OBFHELPER
|
||||
protected NBTTagList a(double... adouble) {
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
double[] adouble1 = adouble;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
index 901522f24b8bc58861e46eda400dbab92bb6401d..3f10e41b18e09186635fd6f7c653b04db7b39d8e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
@@ -293,6 +293,14 @@ public class EntityFallingBlock extends Entity {
|
||||
this.block = Blocks.SAND.getBlockData();
|
||||
}
|
||||
|
||||
+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility
|
||||
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
|
||||
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
|
||||
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
|
||||
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
|
||||
+ origin = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
public void a(boolean flag) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
index 4f4b2b8d58223fa22d6a7af5c94cfb36399b9641..535e7d7297d81026b8586d5049b72fa65519b464 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
@@ -120,6 +120,14 @@ public class EntityTNTPrimed extends Entity {
|
||||
@Override
|
||||
protected void loadData(NBTTagCompound nbttagcompound) {
|
||||
this.setFuseTicks(nbttagcompound.getShort("Fuse"));
|
||||
+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility
|
||||
+ if (nbttagcompound.hasKey("SourceLoc_x")) {
|
||||
+ int srcX = nbttagcompound.getInt("SourceLoc_x");
|
||||
+ int srcY = nbttagcompound.getInt("SourceLoc_y");
|
||||
+ int srcZ = nbttagcompound.getInt("SourceLoc_z");
|
||||
+ origin = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 3cf81734c8580f4d88ea97b6ac737a370b413c84..220bad90bbb9a90c3f23562bf0fb109fce379682 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1062,4 +1062,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return spigot;
|
||||
}
|
||||
// Spigot end
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public Location getOrigin() {
|
||||
+ Location origin = getHandle().origin;
|
||||
+ return origin == null ? null : origin.clone();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 1 Mar 2016 23:52:34 -0600
|
||||
Subject: [PATCH] Prevent tile entity and entity crashes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index 62735e7908f86e31f7a89ce2071ddebe176c0385..87e37c38825ad20fc11f41ea2a4512753266d2b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -737,11 +737,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
gameprofilerfiller.exit();
|
||||
} catch (Throwable throwable) {
|
||||
- CrashReport crashreport = CrashReport.a(throwable, "Ticking block entity");
|
||||
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block entity being ticked");
|
||||
-
|
||||
- tileentity.a(crashreportsystemdetails);
|
||||
- throw new ReportedException(crashreport);
|
||||
+ // Paper start - Prevent tile entity and entity crashes
|
||||
+ System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ());
|
||||
+ throwable.printStackTrace();
|
||||
+ tilesThisCycle--;
|
||||
+ this.tileEntityListTick.remove(tileTickPosition--);
|
||||
+ continue;
|
||||
+ // Paper end
|
||||
// Spigot start
|
||||
} finally {
|
||||
tileentity.tickTimer.stopTiming();
|
||||
@@ -806,11 +808,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
try {
|
||||
consumer.accept(entity);
|
||||
} catch (Throwable throwable) {
|
||||
- CrashReport crashreport = CrashReport.a(throwable, "Ticking entity");
|
||||
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked");
|
||||
-
|
||||
- entity.appendEntityCrashDetails(crashreportsystemdetails);
|
||||
- throw new ReportedException(crashreport);
|
||||
+ // Paper start - Prevent tile entity and entity crashes
|
||||
+ System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ());
|
||||
+ throwable.printStackTrace();
|
||||
+ entity.dead = true;
|
||||
+ return;
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
index 9ebd91e1309938f81583eb3d4dd97fd39bcc930a..58789a6e285c31947508deae37caefe7e182278c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
@@ -208,7 +208,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
|
||||
return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.getTileType()) + " // " + this.getClass().getCanonicalName();
|
||||
});
|
||||
if (this.world != null) {
|
||||
- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock());
|
||||
+ // Paper start - Prevent TileEntity and Entity crashes
|
||||
+ IBlockData block = this.getBlock();
|
||||
+ if (block != null) {
|
||||
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block);
|
||||
+ }
|
||||
+ // Paper end
|
||||
CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.world.getType(this.position));
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 1 Mar 2016 23:58:50 -0600
|
||||
Subject: [PATCH] Configurable top of nether void damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index d16ae924bcbe31c964f7fb448757c748e5c4418c..4bba6977a0287837b8927718c040ac61463f0469 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -134,4 +134,19 @@ public class PaperWorldConfig {
|
||||
if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf);
|
||||
if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf);
|
||||
}
|
||||
+
|
||||
+ public int netherVoidTopDamageHeight;
|
||||
+ public boolean doNetherTopVoidDamage() { return netherVoidTopDamageHeight > 0; }
|
||||
+ private void netherVoidTopDamageHeight() {
|
||||
+ netherVoidTopDamageHeight = getInt("nether-ceiling-void-damage-height", 0);
|
||||
+ log("Top of the nether void damage height: " + netherVoidTopDamageHeight);
|
||||
+
|
||||
+ if (PaperConfig.version < 18) {
|
||||
+ boolean legacy = getBoolean("nether-ceiling-void-damage", false);
|
||||
+ if (legacy) {
|
||||
+ netherVoidTopDamageHeight = 128;
|
||||
+ set("nether-ceiling-void-damage-height", netherVoidTopDamageHeight);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index dce47ec1fc186d12ffa30bfd3d71870aecb95d40..cf92de7c138ef9cbbc1263bee29b9d0017b45827 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -500,9 +500,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
this.fallDistance *= 0.5F;
|
||||
}
|
||||
|
||||
+ // Paper start - Configurable nether ceiling damage
|
||||
+
|
||||
+ // Extracted to own function
|
||||
+ /*
|
||||
if (this.locY() < -64.0D) {
|
||||
this.an();
|
||||
}
|
||||
+ */
|
||||
+ this.performVoidDamage();
|
||||
+ // Paper end
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
this.setFlag(0, this.fireTicks > 0);
|
||||
@@ -595,6 +602,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
this.setFireTicks(0);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ protected void performVoidDamage() {
|
||||
+ if (this.locY() < -64.0D || (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER
|
||||
+ && world.paperConfig.doNetherTopVoidDamage()
|
||||
+ && this.locY() >= world.paperConfig.netherVoidTopDamageHeight)) {
|
||||
+ this.doVoidDamage();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ protected final void doVoidDamage() { this.an(); } // Paper - OBFHELPER
|
||||
protected void an() {
|
||||
this.die();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
index 37785b27c3d9ffd010f09f53b2ca09941f609872..1f94cc096d95129d85a6278b1e369729df93d27d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
|
||||
@@ -330,9 +330,15 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
this.setDamage(this.getDamage() - 1.0F);
|
||||
}
|
||||
|
||||
+ // Paper start - Configurable nether ceiling damage
|
||||
+ // Extracted to own function
|
||||
+ /*
|
||||
if (this.locY() < -64.0D) {
|
||||
this.an();
|
||||
}
|
||||
+ */
|
||||
+ this.performVoidDamage();
|
||||
+ // Paper end
|
||||
|
||||
// this.doPortalTick(); // CraftBukkit - handled in postTick
|
||||
if (this.world.isClientSide) {
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Wed, 2 Mar 2016 00:03:55 -0600
|
||||
Subject: [PATCH] Check online mode before converting and renaming player data
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java
|
||||
index c3a1b5943b0dad8701d566c45b9b474dac7e5c8a..191c9e9a00b9871038f60d54bc22620322f6bdbd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java
|
||||
@@ -56,7 +56,7 @@ public class WorldNBTStorage {
|
||||
File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat");
|
||||
// Spigot Start
|
||||
boolean usingWrongFile = false;
|
||||
- if ( !file.exists() )
|
||||
+ if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
|
||||
{
|
||||
file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
||||
if ( file.exists() )
|
@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Wed, 2 Mar 2016 00:32:25 -0600
|
||||
Subject: [PATCH] Always tick falling blocks
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 69c5d4e51ebf747d931fadc819973e36f001f5bc..58d22363124a9343188d8c19476e5a92f2f0b80b 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -91,6 +91,7 @@ public class ActivationRange
|
||||
|| entity instanceof EntityFireball
|
||||
|| entity instanceof EntityLightning
|
||||
|| entity instanceof EntityTNTPrimed
|
||||
+ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks
|
||||
|| entity instanceof EntityEnderCrystal
|
||||
|| entity instanceof EntityFireworks
|
||||
|| entity instanceof EntityThrownTrident )
|
@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctorDark <doctordark11@gmail.com>
|
||||
Date: Wed, 16 Mar 2016 02:21:39 -0500
|
||||
Subject: [PATCH] Configurable end credits
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 4bba6977a0287837b8927718c040ac61463f0469..e6e18f309dc09ea9416ea37dcc697ddc2b571a96 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -149,4 +149,10 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public boolean disableEndCredits;
|
||||
+ private void disableEndCredits() {
|
||||
+ disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false);
|
||||
+ log("End credits disabled: " + disableEndCredits);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
index 5ef8b66cf266488df75ce7399596f75273b90761..808bb68b3c5115b1219a65d0dd253bd60d543652 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -191,7 +191,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
private long ca = SystemUtils.getMonotonicMillis();
|
||||
private Entity spectatedEntity;
|
||||
public boolean worldChangeInvuln;
|
||||
- private boolean cd;
|
||||
+ private boolean cd; private void setHasSeenCredits(boolean has) { this.cd = has; } // Paper - OBFHELPER
|
||||
private final RecipeBookServer recipeBook = new RecipeBookServer();
|
||||
private Vec3D cf;
|
||||
private int cg;
|
||||
@@ -896,6 +896,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.decouple();
|
||||
this.getWorldServer().removePlayer(this);
|
||||
if (!this.viewingCredits) {
|
||||
+ if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits
|
||||
this.viewingCredits = true;
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.e, this.cd ? 0.0F : 1.0F));
|
||||
this.cd = true;
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Iceee <andrew@opticgaming.tv>
|
||||
Date: Wed, 2 Mar 2016 01:39:52 -0600
|
||||
Subject: [PATCH] Fix lag from explosions processing dead entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 9c1ad56e4362cd86e7ffe2aef7fd9ec301cf9002..7786a06ba09aacaa70c346e85a9eeed9f2ffec6e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -182,7 +182,7 @@ public class Explosion {
|
||||
int i1 = MathHelper.floor(this.posY + (double) f2 + 1.0D);
|
||||
int j1 = MathHelper.floor(this.posZ - (double) f2 - 1.0D);
|
||||
int k1 = MathHelper.floor(this.posZ + (double) f2 + 1.0D);
|
||||
- List<Entity> list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1));
|
||||
+ List<Entity> list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities
|
||||
Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ);
|
||||
|
||||
for (int l1 = 0; l1 < list.size(); ++l1) {
|
@ -1,69 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sudzzy <originmc@outlook.com>
|
||||
Date: Wed, 2 Mar 2016 14:48:03 -0600
|
||||
Subject: [PATCH] Disable explosion knockback
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 4881b03d470646843bad1bc343eb6a6ab9072d8e..2222c1bb5f8625eee4d88946e4bfdfa2fe598977 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -161,4 +161,9 @@ public class PaperWorldConfig {
|
||||
optimizeExplosions = getBoolean("optimize-explosions", false);
|
||||
log("Optimize explosions: " + optimizeExplosions);
|
||||
}
|
||||
+
|
||||
+ public boolean disableExplosionKnockback;
|
||||
+ private void disableExplosionKnockback(){
|
||||
+ disableExplosionKnockback = getBoolean("disable-explosion-knockback", false);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index 98f5f1dcd0abf9272533bf3801bab316c9f0a12c..3598db4144141a8701a2879be13a81a8ee48018c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -1283,6 +1283,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ boolean knockbackCancelled = world.paperConfig.disableExplosionKnockback && damagesource.isExplosion() && this instanceof EntityHuman; // Paper - Disable explosion knockback
|
||||
if (flag1) {
|
||||
if (flag) {
|
||||
this.world.broadcastEntityEffect(this, (byte) 29);
|
||||
@@ -1301,6 +1302,7 @@ public abstract class EntityLiving extends Entity {
|
||||
b0 = 2;
|
||||
}
|
||||
|
||||
+ if (!knockbackCancelled) // Paper - Disable explosion knockback
|
||||
this.world.broadcastEntityEffect(this, b0);
|
||||
}
|
||||
|
||||
@@ -1324,6 +1326,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback
|
||||
if (this.dl()) {
|
||||
if (!this.f(damagesource)) {
|
||||
SoundEffect soundeffect = this.getSoundDeath();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 6a7af2c0c3c294b10c6ddbf98babb0f30d7d5f56..618cf4e0d71b4b04085807314e79a02785f8a498 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -217,14 +217,14 @@ public class Explosion {
|
||||
double d14 = d13;
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
- d14 = EnchantmentProtection.a((EntityLiving) entity, d13);
|
||||
+ d14 = entity instanceof EntityHuman && world.paperConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a((EntityLiving) entity, d13); // Paper - Disable explosion knockback
|
||||
}
|
||||
|
||||
entity.setMot(entity.getMot().add(d8 * d14, d9 * d14, d10 * d14));
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
|
||||
- if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.abilities.isFlying)) {
|
||||
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.abilities.isFlying) && !world.paperConfig.disableExplosionKnockback) { // Paper - Disable explosion knockback
|
||||
this.n.put(entityhuman, new Vec3D(d8 * d13, d9 * d13, d10 * d13));
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sudzzy <originmc@outlook.com>
|
||||
Date: Wed, 2 Mar 2016 14:52:43 -0600
|
||||
Subject: [PATCH] Disable thunder
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 2222c1bb5f8625eee4d88946e4bfdfa2fe598977..083e421f8496b5336af473b108498ed28b984774 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -166,4 +166,9 @@ public class PaperWorldConfig {
|
||||
private void disableExplosionKnockback(){
|
||||
disableExplosionKnockback = getBoolean("disable-explosion-knockback", false);
|
||||
}
|
||||
+
|
||||
+ public boolean disableThunder;
|
||||
+ private void disableThunder() {
|
||||
+ disableThunder = getBoolean("disable-thunder", false);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index 701b00e65c4d5eb66e974f8d622eecef0f744f82..6e8e9067a43d0fb88683be733fb3d138f35d6cf0 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -586,7 +586,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
gameprofilerfiller.enter("thunder");
|
||||
BlockPosition blockposition;
|
||||
|
||||
- if (flag && this.W() && this.random.nextInt(100000) == 0) {
|
||||
+ if (!this.paperConfig.disableThunder && flag && this.W() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder
|
||||
blockposition = this.a(this.a(j, 0, k, 15));
|
||||
if (this.isRainingAt(blockposition)) {
|
||||
DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition);
|
@ -1,65 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sudzzy <originmc@outlook.com>
|
||||
Date: Wed, 2 Mar 2016 15:03:53 -0600
|
||||
Subject: [PATCH] Configurable mob spawner tick rate
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 2f7a5a4a5a7b29750cfd777e0bc5d19a14e93fa2..4de86b09c6bc3c1974ce61b550ccb73d37f6f170 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -176,4 +176,9 @@ public class PaperWorldConfig {
|
||||
private void disableIceAndSnow(){
|
||||
disableIceAndSnow = getBoolean("disable-ice-and-snow", false);
|
||||
}
|
||||
+
|
||||
+ public int mobSpawnerTickRate;
|
||||
+ private void mobSpawnerTickRate() {
|
||||
+ mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
index 8d8b03074df1635946f81bec0feae18d2f3e20aa..76c98d576d3e567ec4482b30219f5a9107cb9703 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
@@ -41,6 +41,7 @@ public abstract class MobSpawnerAbstract {
|
||||
public int maxNearbyEntities = 6;
|
||||
public int requiredPlayerRange = 16;
|
||||
public int spawnRange = 4;
|
||||
+ private int tickDelay = 0; // Paper
|
||||
|
||||
public MobSpawnerAbstract() {}
|
||||
|
||||
@@ -70,6 +71,10 @@ public abstract class MobSpawnerAbstract {
|
||||
}
|
||||
|
||||
public void c() {
|
||||
+ // Paper start - Configurable mob spawner tick rate
|
||||
+ if (spawnDelay > 0 && --tickDelay > 0) return;
|
||||
+ tickDelay = this.a().paperConfig.mobSpawnerTickRate;
|
||||
+ // Paper end
|
||||
if (!this.h()) {
|
||||
this.f = this.e;
|
||||
} else {
|
||||
@@ -84,18 +89,18 @@ public abstract class MobSpawnerAbstract {
|
||||
world.addParticle(Particles.SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
world.addParticle(Particles.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||
if (this.spawnDelay > 0) {
|
||||
- --this.spawnDelay;
|
||||
+ this.spawnDelay -= tickDelay; // Paper
|
||||
}
|
||||
|
||||
this.f = this.e;
|
||||
this.e = (this.e + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
|
||||
} else {
|
||||
- if (this.spawnDelay == -1) {
|
||||
+ if (this.spawnDelay < -tickDelay) { // Paper
|
||||
this.i();
|
||||
}
|
||||
|
||||
if (this.spawnDelay > 0) {
|
||||
- --this.spawnDelay;
|
||||
+ this.spawnDelay -= tickDelay; // Paper
|
||||
return;
|
||||
}
|
||||
|
@ -1,108 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Wed, 2 Mar 2016 23:13:07 -0600
|
||||
Subject: [PATCH] Send absolute position the first time an entity is seen
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
index 9ad74b380a92e3a563e1a891e81401d8b4707bcf..beb0beb716869978be6bc5a78ce3b6cf785c5aee 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
+import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -52,7 +53,7 @@ public class EntityTrackerEntry {
|
||||
private final Entity tracker;
|
||||
private final int d;
|
||||
private final boolean e;
|
||||
- private final Consumer<Packet<?>> f;
|
||||
+ private final Consumer<Packet<?>> f; private Consumer<Packet<?>> getPacketConsumer() { return f; } // Paper - OBFHELPER
|
||||
private long xLoc;
|
||||
private long yLoc;
|
||||
private long zLoc;
|
||||
@@ -67,8 +68,23 @@ public class EntityTrackerEntry {
|
||||
private boolean r;
|
||||
// CraftBukkit start
|
||||
private final Set<EntityPlayer> trackedPlayers;
|
||||
+ // Paper start
|
||||
+ private java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = null;
|
||||
+
|
||||
+ /**
|
||||
+ * Requested in https://github.com/PaperMC/Paper/issues/1537 to allow intercepting packets
|
||||
+ */
|
||||
+ public void sendPlayerPacket(EntityPlayer player, Packet packet) {
|
||||
+ player.playerConnection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, java.util.Map<EntityPlayer, Boolean> trackedPlayers) {
|
||||
+ this(worldserver, entity, i, flag, consumer, trackedPlayers.keySet());
|
||||
+ trackedPlayerMap = trackedPlayers;
|
||||
+ }
|
||||
|
||||
public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<EntityPlayer> trackedPlayers) {
|
||||
+ // Paper end
|
||||
this.trackedPlayers = trackedPlayers;
|
||||
// CraftBukkit end
|
||||
this.m = Vec3D.ORIGIN;
|
||||
@@ -189,7 +205,25 @@ public class EntityTrackerEntry {
|
||||
}
|
||||
|
||||
if (packet1 != null) {
|
||||
- this.f.accept(packet1);
|
||||
+ // paper start
|
||||
+ if (trackedPlayerMap == null || packet1 instanceof PacketPlayOutEntityTeleport) {
|
||||
+ this.f.accept((packet1));
|
||||
+ } else {
|
||||
+ PacketPlayOutEntityTeleport teleportPacket = null;
|
||||
+
|
||||
+ for (java.util.Map.Entry<EntityPlayer, Boolean> viewer : trackedPlayerMap.entrySet()) {
|
||||
+ if (viewer.getValue()) {
|
||||
+ viewer.setValue(false);
|
||||
+ if (teleportPacket == null) {
|
||||
+ teleportPacket = new PacketPlayOutEntityTeleport(this.tracker);
|
||||
+ }
|
||||
+ sendPlayerPacket(viewer.getKey(), teleportPacket);
|
||||
+ } else {
|
||||
+ sendPlayerPacket(viewer.getKey(), packet1);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
this.c();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
index 62245fa420390dc0a70ba9a95505dc46cd8aa64a..788a45d5426f0752509442aec2d28b1f32f63cb1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -1303,10 +1303,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
private final Entity tracker;
|
||||
private final int trackingDistance;
|
||||
private SectionPosition e;
|
||||
- public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
|
||||
+ // Paper start
|
||||
+ // Replace trackedPlayers Set with a Map. The value is true until the player receives
|
||||
+ // their first update (which is forced to have absolute coordinates), false afterward.
|
||||
+ public java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = new java.util.HashMap<>();
|
||||
+ public Set<EntityPlayer> trackedPlayers = trackedPlayerMap.keySet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
- this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast, trackedPlayers); // CraftBukkit
|
||||
+ this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast, trackedPlayerMap); // CraftBukkit // Paper
|
||||
this.tracker = entity;
|
||||
this.trackingDistance = i;
|
||||
this.e = SectionPosition.a(entity);
|
||||
@@ -1388,7 +1392,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
|
||||
// CraftBukkit end
|
||||
|
||||
- if (flag1 && this.trackedPlayers.add(entityplayer)) {
|
||||
+ if (flag1 && this.trackedPlayerMap.putIfAbsent(entityplayer, true) == null) { // Paper
|
||||
this.trackerEntry.b(entityplayer);
|
||||
}
|
||||
} else if (this.trackedPlayers.remove(entityplayer)) {
|
@ -1,67 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Wed, 2 Mar 2016 23:30:53 -0600
|
||||
Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java
|
||||
index c6914c8d2a3d1057c98537a3538097d3ac6149e0..4098357d60165a4c670a7bc5134abf66178124c6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java
|
||||
@@ -42,6 +42,11 @@ import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import org.bukkit.craftbukkit.potion.CraftPotionUtil;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
// CraftBukkit end
|
||||
+// Paper start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
||||
+// Paper end
|
||||
|
||||
public class TileEntityBeacon extends TileEntity implements ITileInventory, ITickable {
|
||||
|
||||
@@ -268,14 +273,30 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic
|
||||
}
|
||||
|
||||
private void applyEffect(List list, MobEffectList effects, int i, int b0) {
|
||||
+ // Paper - BeaconEffectEvent
|
||||
+ applyEffect(list, effects, i, b0, true);
|
||||
+ }
|
||||
+
|
||||
+ private void applyEffect(List list, MobEffectList effects, int i, int b0, boolean isPrimary) {
|
||||
+ // Paper - BeaconEffectEvent
|
||||
{
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
EntityHuman entityhuman;
|
||||
|
||||
+ // Paper start - BeaconEffectEvent
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ());
|
||||
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffect(effects, i, b0, true, true));
|
||||
+ // Paper end
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
entityhuman = (EntityHuman) iterator.next();
|
||||
- entityhuman.addEffect(new MobEffect(effects, i, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
+
|
||||
+ // Paper start - BeaconEffectEvent
|
||||
+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (Player) entityhuman.getBukkitEntity(), isPrimary);
|
||||
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
||||
+ entityhuman.addEffect(new MobEffect(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,10 +319,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic
|
||||
int i = getLevel();
|
||||
List list = getHumansInRange();
|
||||
|
||||
- applyEffect(list, this.primaryEffect, i, b0);
|
||||
+ applyEffect(list, this.primaryEffect, i, b0, true); // Paper - BeaconEffectEvent
|
||||
|
||||
if (hasSecondaryEffect()) {
|
||||
- applyEffect(list, this.secondaryEffect, i, 0);
|
||||
+ applyEffect(list, this.secondaryEffect, i, 0, false); // Paper - BeaconEffectEvent
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Wed, 2 Mar 2016 23:45:17 -0600
|
||||
Subject: [PATCH] Disable spigot tick limiters
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index 06455fb3916e347c075c6aa84977dca7e25760c2..26d9388badb0328735abf0319a42bd633c90dc4b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -707,9 +707,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
// Spigot start
|
||||
// Iterator iterator = this.tileEntityListTick.iterator();
|
||||
int tilesThisCycle = 0;
|
||||
- for (tileLimiter.initTick();
|
||||
- tilesThisCycle < tileEntityListTick.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue());
|
||||
- tileTickPosition++, tilesThisCycle++) {
|
||||
+ for (tileTickPosition = 0; tileTickPosition < tileEntityListTick.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||
tileTickPosition = (tileTickPosition < tileEntityListTick.size()) ? tileTickPosition : 0;
|
||||
TileEntity tileentity = (TileEntity) this.tileEntityListTick.get(tileTickPosition);
|
||||
// Spigot start
|
@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: vemacs <d@nkmem.es>
|
||||
Date: Thu, 3 Mar 2016 01:19:22 -0600
|
||||
Subject: [PATCH] All chunks are slime spawn chunks toggle
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 70e074cdf2087e638af8e0f3878d0ef8eb7305cc..416a6760883cb40367535c7c5acd779742bb8af5 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -191,4 +191,9 @@ public class PaperWorldConfig {
|
||||
private void disableChestCatDetection() {
|
||||
disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false);
|
||||
}
|
||||
+
|
||||
+ public boolean allChunksAreSlimeChunks;
|
||||
+ private void allChunksAreSlimeChunks() {
|
||||
+ allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
index 292789d76da400d15d0742e2e0979f4ac6ec4b75..01d5b0db9a34d88172e8c7c84c4e1d0b2562217c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
@@ -325,7 +325,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
}
|
||||
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition);
|
||||
- boolean flag = SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, ((GeneratorAccessSeed) generatoraccess).getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot
|
||||
+ boolean flag = generatoraccess.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, ((GeneratorAccessSeed) generatoraccess).getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper
|
||||
|
||||
if (random.nextInt(10) == 0 && flag && blockposition.getY() < 40) {
|
||||
return a(entitytypes, generatoraccess, enummobspawn, blockposition, random);
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Hirschfeld <joe@ibj.io>
|
||||
Date: Thu, 3 Mar 2016 02:33:53 -0600
|
||||
Subject: [PATCH] Ensure inv drag is in bounds
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java
|
||||
index 2410214a300407ef20ea14244db5db2ebede2759..e9733fd9dac89d31dbad391cb22a8c84216045db 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/Container.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/Container.java
|
||||
@@ -239,7 +239,7 @@ public abstract class Container {
|
||||
this.d();
|
||||
}
|
||||
} else if (this.h == 1) {
|
||||
- Slot slot = (Slot) this.slots.get(i);
|
||||
+ Slot slot = i < this.slots.size() ? this.slots.get(i) : null; // Paper - Ensure drag in bounds
|
||||
|
||||
itemstack1 = playerinventory.getCarried();
|
||||
if (slot != null && a(slot, itemstack1, true) && slot.isAllowed(itemstack1) && (this.dragType == 2 || itemstack1.getCount() > this.i.size()) && this.b(slot)) {
|
@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Hirschfeld <joe@ibj.io>
|
||||
Date: Thu, 3 Mar 2016 02:39:54 -0600
|
||||
Subject: [PATCH] Change implementation of (tile)entity removal list
|
||||
|
||||
use sets for faster removal
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index 26d9388badb0328735abf0319a42bd633c90dc4b..33469b719d679c65d4bcb8366008e6e107eb3a0b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -89,7 +89,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
public final List<TileEntity> tileEntityList = Lists.newArrayList();
|
||||
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
|
||||
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
|
||||
- protected final List<TileEntity> tileEntityListUnload = Lists.newArrayList();
|
||||
+ protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
||||
public final Thread serverThread;
|
||||
private final boolean debugWorld;
|
||||
private int d;
|
@ -1,56 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Joseph Hirschfeld <joe@ibj.io>
|
||||
Date: Thu, 3 Mar 2016 02:46:17 -0600
|
||||
Subject: [PATCH] Add configurable portal search radius
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 416a6760883cb40367535c7c5acd779742bb8af5..670efbe53241a0ae32d618c83da601ccc1f26e37 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -196,4 +196,13 @@ public class PaperWorldConfig {
|
||||
private void allChunksAreSlimeChunks() {
|
||||
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
|
||||
}
|
||||
+
|
||||
+ public int portalSearchRadius;
|
||||
+ public int portalCreateRadius;
|
||||
+ public boolean portalSearchVanillaDimensionScaling;
|
||||
+ private void portalSearchRadius() {
|
||||
+ portalSearchRadius = getInt("portal-search-radius", 128);
|
||||
+ portalCreateRadius = getInt("portal-create-radius", 16);
|
||||
+ portalSearchVanillaDimensionScaling = getBoolean("portal-search-vanilla-dimension-scaling", true);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 77cc0aeb979369df2156f8fb916067f608b61ebf..caae8bdae592a1ae4f99861088458d7461f4c97a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2618,7 +2618,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
|
||||
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
||||
// CraftBukkit start
|
||||
- CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
+ // Paper start
|
||||
+ int portalSearchRadius = worldserver.paperConfig.portalSearchRadius;
|
||||
+ if (world.paperConfig.portalSearchVanillaDimensionScaling && flag2) { // == THE_NETHER
|
||||
+ portalSearchRadius = (int) (portalSearchRadius / worldserver.getDimensionManager().getCoordinateScale());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, worldserver.paperConfig.portalCreateRadius); // Paper start - configurable portal radius
|
||||
if (event == null) {
|
||||
return null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java
|
||||
index 7b8e8a7dae47ecc42a57e3f9444caa2ee5b1ef3b..77dfa7eaf178baa55041a829c9dec4851efeedfc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java
|
||||
@@ -31,7 +31,7 @@ public class PortalTravelAgent {
|
||||
|
||||
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, boolean flag) {
|
||||
// CraftBukkit start
|
||||
- return findPortal(blockposition, flag ? 16 : 128); // Search Radius
|
||||
+ return findPortal(blockposition, flag ? world.paperConfig.portalCreateRadius : world.paperConfig.portalSearchRadius); // Paper - search Radius
|
||||
}
|
||||
|
||||
public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, int i) {
|
@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Tue, 8 Mar 2016 18:28:43 -0800
|
||||
Subject: [PATCH] Don't nest if we don't need to when cerealising text
|
||||
components
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
|
||||
index edae451a54bfcd6b54e89c1619fb112a7763eb3b..f6a1c5ac9acb34b1ef2262721adbbb1a5b0feaf7 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java
|
||||
@@ -40,7 +40,14 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
|
||||
// Paper end
|
||||
// Spigot start
|
||||
if (components != null) {
|
||||
- packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components));
|
||||
+ //packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below
|
||||
+ // Paper start - don't nest if we don't need to so that we can preserve formatting
|
||||
+ if (this.components.length == 1) {
|
||||
+ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]));
|
||||
+ } else {
|
||||
+ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(this.components));
|
||||
+ }
|
||||
+ // Paper end
|
||||
} else {
|
||||
packetdataserializer.a(this.a);
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 18 Mar 2016 20:16:03 -0400
|
||||
Subject: [PATCH] Add World Util Methods
|
||||
|
||||
Methods that can be used for other patches to help improve logic.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index eddfbd25953e8ef410f1617a1edecbc7d07696c0..b04a6cd626fceed26aec6121e20fb1b6dd1c716d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -197,7 +197,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
public final Convertable.ConversionSession convertable;
|
||||
public final UUID uuid;
|
||||
|
||||
- public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||
return this.chunkProvider.getChunkAt(x, z, false);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index b0ad55f35285cc1bc339859a8deae65e930082b8..067f5e46ad2f28ab119db77b19c4897bed9b3d80 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -297,11 +297,27 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
+ public final Fluid getFluidIfLoaded(BlockPosition blockposition) {
|
||||
IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
|
||||
return chunk == null ? null : chunk.getFluid(blockposition);
|
||||
}
|
||||
+
|
||||
+ public final boolean isLoadedAndInBounds(BlockPosition blockposition) { // Paper - final for inline
|
||||
+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) { // Overridden in WorldServer for ABI compat which has final
|
||||
+ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(x, z);
|
||||
+ }
|
||||
+ public final Chunk getChunkIfLoaded(BlockPosition blockposition) {
|
||||
+ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+ }
|
||||
+
|
||||
+ // reduces need to do isLoaded before getType
|
||||
+ public final IBlockData getTypeIfLoadedAndInBounds(BlockPosition blockposition) {
|
||||
+ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
index 2bb03f1cb9671a7754a68059219f783d4508eeb9..f16c76df5d7b184d57f4cc397f069eac9cc430cb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
@@ -31,6 +31,7 @@ public class WorldBorder {
|
||||
|
||||
public WorldBorder() {}
|
||||
|
||||
+ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER
|
||||
public boolean a(BlockPosition blockposition) {
|
||||
return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 27 Sep 2015 01:18:02 -0400
|
||||
Subject: [PATCH] handle NaN health/absorb values and repair bad data
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index 082a3efb8c03e6a0a35411107f3cf3776dee14bf..c7b40800343edb2c2a68786afb828c9dc3e3627f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -702,7 +702,13 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
- this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount"));
|
||||
+ // Paper start - jvm keeps optimizing the setter
|
||||
+ float absorptionAmount = nbttagcompound.getFloat("AbsorptionAmount");
|
||||
+ if (Float.isNaN(absorptionAmount)) {
|
||||
+ absorptionAmount = 0;
|
||||
+ }
|
||||
+ this.setAbsorptionHearts(absorptionAmount);
|
||||
+ // Paper end
|
||||
if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) {
|
||||
this.getAttributeMap().a(nbttagcompound.getList("Attributes", 10));
|
||||
}
|
||||
@@ -1151,6 +1157,10 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public void setHealth(float f) {
|
||||
+ // Paper start
|
||||
+ if (Float.isNaN(f)) { f = getMaxHealth(); if (this.valid) {
|
||||
+ System.err.println("[NAN-HEALTH] " + getName() + " had NaN health set");
|
||||
+ } } // Paper end
|
||||
// CraftBukkit start - Handle scaled health
|
||||
if (this instanceof EntityPlayer) {
|
||||
org.bukkit.craftbukkit.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity();
|
||||
@@ -3045,7 +3055,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public void setAbsorptionHearts(float f) {
|
||||
- if (f < 0.0F) {
|
||||
+ if (f < 0.0F || Float.isNaN(f)) { // Paper
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index ed5680e6e0fcfbaf948bdede98d206cff2b26467..ab7e731cb04a75b829f0cd24d7b94f7ddad166e8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1680,6 +1680,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void setRealHealth(double health) {
|
||||
+ if (Double.isNaN(health)) {return;} // Paper
|
||||
this.health = health;
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 22 Mar 2016 00:33:47 -0400
|
||||
Subject: [PATCH] Use a Shared Random for Entities
|
||||
|
||||
Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index b7df4d8eb3ccb9e8dc85898352f41c5c20abcb34..6cbb797cb0de4b26d8ddd7f0bf567f49bd36f9c0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -143,6 +143,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static Random SHARED_RANDOM = new Random() {
|
||||
+ private boolean locked = false;
|
||||
+ @Override
|
||||
+ public synchronized void setSeed(long seed) {
|
||||
+ if (locked) {
|
||||
+ LogManager.getLogger().error("Ignoring setSeed on Entity.SHARED_RANDOM", new Throwable());
|
||||
+ } else {
|
||||
+ super.setSeed(seed);
|
||||
+ locked = true;
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ // Paper end
|
||||
+
|
||||
private CraftEntity bukkitEntity;
|
||||
|
||||
public CraftEntity getBukkitEntity() {
|
||||
@@ -272,7 +287,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
this.x = Vec3D.ORIGIN;
|
||||
this.am = 1.0F;
|
||||
this.an = 1.0F;
|
||||
- this.random = new Random();
|
||||
+ this.random = SHARED_RANDOM; // Paper
|
||||
this.fireTicks = -this.getMaxFireTicks();
|
||||
this.M = new Object2DoubleArrayMap(2);
|
||||
this.justCreated = true;
|
@ -1,206 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 3 Mar 2016 02:07:55 -0600
|
||||
Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for
|
||||
inlining
|
||||
|
||||
Hot methods, so reduce # of instructions for the method.
|
||||
|
||||
Move is valid location test to the BlockPosition class so that it can access local variables.
|
||||
|
||||
Replace all calls to the new place to the unnecessary forward.
|
||||
|
||||
Optimize getType and getBlockData to manually inline and optimize the calls
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/BaseBlockPosition.java b/src/main/java/net/minecraft/core/BaseBlockPosition.java
|
||||
index 25fdd55a7548cfaa45a541ad77f22f33c33e7471..4b56683336fdab06804efdc8ca1f7c130b77291f 100644
|
||||
--- a/src/main/java/net/minecraft/core/BaseBlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/core/BaseBlockPosition.java
|
||||
@@ -22,6 +22,15 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> {
|
||||
private int b;public final void setY(final int y) { this.b = y; } // Paper - OBFHELPER
|
||||
private int e;public final void setZ(final int z) { this.e = z; } // Paper - OBFHELPER
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean isValidLocation() {
|
||||
+ return getX() >= -30000000 && getZ() >= -30000000 && getX() < 30000000 && getZ() < 30000000 && getY() >= 0 && getY() < 256;
|
||||
+ }
|
||||
+ public boolean isInvalidYLocation() {
|
||||
+ return b < 0 || b >= 256;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public BaseBlockPosition(int i, int j, int k) {
|
||||
this.a = i;
|
||||
this.b = j;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index a570998e4ef6c3ff83403881bf1d24c8cbcfcf67..a22be13b097052b2a88707c9436b88c84298e46b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -239,7 +239,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
}
|
||||
|
||||
public static boolean isValidLocation(BlockPosition blockposition) {
|
||||
- return !isOutsideWorld(blockposition) && D(blockposition);
|
||||
+ return blockposition.isValidLocation(); // Paper - use better/optimized check
|
||||
}
|
||||
|
||||
public static boolean l(BlockPosition blockposition) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
index 4b3de29b1a6e9d75b28962073c62bbe8d666165f..fdc491f978560c394eec22116572585f9bbdec9f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java
|
||||
@@ -348,12 +348,27 @@ public class Chunk implements IChunkAccess {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
- @Override
|
||||
+ // Paper start - Optimize getBlockData to reduce instructions
|
||||
+ public final IBlockData getBlockData(BlockPosition pos) { return getBlockData(pos.getX(), pos.getY(), pos.getZ()); } // Paper
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
- int i = blockposition.getX();
|
||||
- int j = blockposition.getY();
|
||||
- int k = blockposition.getZ();
|
||||
+ return this.getBlockData(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ }
|
||||
+
|
||||
+ public IBlockData getType(final int x, final int y, final int z) {
|
||||
+ return getBlockData(x, y, z);
|
||||
+ }
|
||||
+ public final IBlockData getBlockData(final int x, final int y, final int z) {
|
||||
+ // Method body / logic copied from below
|
||||
+ final int i = y >> 4;
|
||||
+ if (y < 0 || i >= this.sections.length || this.sections[i] == null || this.sections[i].nonEmptyBlockCount == 0) {
|
||||
+ return Blocks.AIR.getBlockData();
|
||||
+ }
|
||||
+ // Inlined ChunkSection.getType() and DataPaletteBlock.a(int,int,int)
|
||||
+ return this.sections[i].blockIds.a((y & 15) << 8 | (z & 15) << 4 | x & 15);
|
||||
+ }
|
||||
|
||||
+ public IBlockData getBlockData_unused(int i, int j, int k) {
|
||||
+ // Paper end
|
||||
if (this.world.isDebugWorld()) {
|
||||
IBlockData iblockdata = null;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java
|
||||
index 395d21afaabcbd99f9ce0551d647f5db9507a518..89efd0b68b04457e1cd617dcc8bb1a6ea1c4717c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
public class ChunkEmpty extends Chunk {
|
||||
|
||||
- private static final BiomeBase[] b = (BiomeBase[]) SystemUtils.a((Object) (new BiomeBase[BiomeStorage.a]), (abiomebase) -> {
|
||||
+ private static final BiomeBase[] b = SystemUtils.a((new BiomeBase[BiomeStorage.a]), (abiomebase) -> { // Paper - decompile error
|
||||
Arrays.fill(abiomebase, BiomeRegistry.a);
|
||||
});
|
||||
|
||||
@@ -31,6 +31,11 @@ public class ChunkEmpty extends Chunk {
|
||||
super(world, chunkcoordintpair, new BiomeStorage(world.r().b(IRegistry.ay), ChunkEmpty.b));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override public IBlockData getType(int x, int y, int z) {
|
||||
+ return Blocks.VOID_AIR.getBlockData();
|
||||
+ }
|
||||
+ // Paper end
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java
|
||||
index a4e2eb1a753e8fcb48982d78fe80e505bce5c476..eea4a30428293eaf7afbe303a37adec60b44c2b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java
|
||||
@@ -13,10 +13,10 @@ public class ChunkSection {
|
||||
|
||||
public static final DataPalette<IBlockData> GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData());
|
||||
private final int yPos;
|
||||
- private short nonEmptyBlockCount;
|
||||
+ short nonEmptyBlockCount; // Paper - package-private
|
||||
private short tickingBlockCount;
|
||||
private short e;
|
||||
- private final DataPaletteBlock<IBlockData> blockIds;
|
||||
+ final DataPaletteBlock<IBlockData> blockIds; // Paper - package-private
|
||||
|
||||
public ChunkSection(int i) {
|
||||
this(i, (short) 0, (short) 0, (short) 0);
|
||||
@@ -30,8 +30,8 @@ public class ChunkSection {
|
||||
this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData());
|
||||
}
|
||||
|
||||
- public IBlockData getType(int i, int j, int k) {
|
||||
- return (IBlockData) this.blockIds.a(i, j, k);
|
||||
+ public final IBlockData getType(int i, int j, int k) { // Paper
|
||||
+ return this.blockIds.a(j << 8 | k << 4 | i); // Paper - inline
|
||||
}
|
||||
|
||||
public Fluid b(int i, int j, int k) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java
|
||||
index e397b871b846c3a90bc75d0e1cf0683b6a3d0ca9..8928157b01bb4f0dfe043732777b33708c23cda7 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java
|
||||
@@ -133,7 +133,7 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> {
|
||||
}
|
||||
|
||||
public T a(int i, int j, int k) {
|
||||
- return this.a(b(i, j, k));
|
||||
+ return this.a(j << 8 | k << 4 | i); // Paper - inline
|
||||
}
|
||||
|
||||
protected T a(int i) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java
|
||||
index 2cd04abd72f1135446182ad6294003e526f99a4b..e570dc58efa56bd0aa5ada5575b4054ee38d505e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java
|
||||
@@ -25,6 +25,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
|
||||
public interface IChunkAccess extends IBlockAccess, IStructureAccess {
|
||||
|
||||
+ IBlockData getType(final int x, final int y, final int z); // Paper
|
||||
@Nullable
|
||||
IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
index 7572ca53a5cca8ca5085d18c24048b85dda4daa9..9eeb99a21a6ed7f71ff64cf4cfdff646d31abbcf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
@@ -113,16 +113,18 @@ public class ProtoChunk implements IChunkAccess {
|
||||
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
- int i = blockposition.getY();
|
||||
-
|
||||
- if (World.b(i)) {
|
||||
+ return getType(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ }
|
||||
+ // Paper start
|
||||
+ public IBlockData getType(final int x, final int y, final int z) {
|
||||
+ if (y < 0 || y >= 256) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
} else {
|
||||
- ChunkSection chunksection = this.getSections()[i >> 4];
|
||||
-
|
||||
- return ChunkSection.a(chunksection) ? Blocks.AIR.getBlockData() : chunksection.getType(blockposition.getX() & 15, i & 15, blockposition.getZ() & 15);
|
||||
+ ChunkSection chunksection = this.getSections()[y >> 4];
|
||||
+ return chunksection == Chunk.EMPTY_CHUNK_SECTION || chunksection.c() ? Blocks.AIR.getBlockData() : chunksection.getType(x & 15, y & 15, z & 15);
|
||||
}
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public Fluid getFluid(BlockPosition blockposition) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java
|
||||
index c059d3d055c35b492680556e8605966e2caaf7fd..9351e6ba541d440c485b6e4a3209170c5756e31e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java
|
||||
@@ -42,6 +42,11 @@ public class ProtoChunkExtension extends ProtoChunk {
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
return this.a.getType(blockposition);
|
||||
}
|
||||
+ // Paper start
|
||||
+ public final IBlockData getType(final int x, final int y, final int z) {
|
||||
+ return this.a.getBlockData(x, y, z);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public Fluid getFluid(BlockPosition blockposition) {
|
@ -1,95 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 19:55:45 -0400
|
||||
Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener
|
||||
|
||||
Saves on some object allocation and processing when no plugin listens to this
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 06071e15851d5d27f1c9a0d60a764a6214e0ba0f..33139f9dc6a9c6030f565b01c9b6fd411cafa710 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1292,6 +1292,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
+ worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
|
||||
|
||||
this.methodProfiler.a(() -> {
|
||||
return worldserver + " " + worldserver.getDimensionKey().a();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index a5ee8bf7904444ff6fd82260a66a81c9af479f9e..c5baf9c448761f24c4fd49d7c4bade7dee43edf4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -196,6 +196,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
private int tickPosition;
|
||||
public final Convertable.ConversionSession convertable;
|
||||
public final UUID uuid;
|
||||
+ public boolean hasPhysicsEvent = true; // Paper
|
||||
|
||||
@Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
|
||||
return this.chunkProvider.getChunkAt(x, z, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index a22be13b097052b2a88707c9436b88c84298e46b..9236e480d21340d4295caa16dae34363e182f483 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -458,7 +458,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
// CraftBukkit start
|
||||
iblockdata1.b(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam
|
||||
CraftWorld world = ((WorldServer) this).getWorld();
|
||||
- if (world != null) {
|
||||
+ if (world != null && ((WorldServer)this).hasPhysicsEvent) { // Paper
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@@ -560,7 +560,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
try {
|
||||
// CraftBukkit start
|
||||
CraftWorld world = ((WorldServer) this).getWorld();
|
||||
- if (world != null) {
|
||||
+ if (world != null && ((WorldServer)this).hasPhysicsEvent) { // Paper
|
||||
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()));
|
||||
this.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockPlant.java b/src/main/java/net/minecraft/world/level/block/BlockPlant.java
|
||||
index 33a5c5a4dc1478ab211dbb2e09df87570b06644f..97dfe5c5e3ea1d9691de87ffbf4b1a29a83a65b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockPlant.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockPlant.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.world.level.block;
|
||||
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.EnumDirection;
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
import net.minecraft.world.level.GeneratorAccess;
|
||||
import net.minecraft.world.level.IBlockAccess;
|
||||
import net.minecraft.world.level.IWorldReader;
|
||||
@@ -23,7 +24,7 @@ public class BlockPlant extends Block {
|
||||
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
// CraftBukkit start
|
||||
if (!iblockdata.canPlace(generatoraccess, blockposition)) {
|
||||
- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) {
|
||||
+ if (!(generatoraccess instanceof WorldServer && ((WorldServer) generatoraccess).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { // Paper
|
||||
return Blocks.AIR.getBlockData();
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java b/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java
|
||||
index ca22187625f7ac6c43b663fd4d66cbf0c943c655..1a5d29ecc9edc52bac14ed5d05ef5376fd5b8a9c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.EnumDirection;
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
import net.minecraft.world.entity.EntityLiving;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -83,7 +84,7 @@ public class BlockTallPlant extends BlockPlant {
|
||||
|
||||
protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
// CraftBukkit start
|
||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
|
||||
+ if (((WorldServer)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { // Paper
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 20:32:58 -0400
|
||||
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index c5baf9c448761f24c4fd49d7c4bade7dee43edf4..b40089319329a0843c4d74ebd6189fc4089e319a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1214,7 +1214,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.navigators.remove(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
-
|
||||
+ new com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
|
||||
entity.valid = false; // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1252,6 +1252,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
entity.origin = entity.getBukkitEntity().getLocation();
|
||||
}
|
||||
// Paper end
|
||||
+ new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
|
||||
}
|
||||
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 28 Mar 2016 21:22:26 -0400
|
||||
Subject: [PATCH] EntityPathfindEvent
|
||||
|
||||
Fires when an Entity decides to start moving to a location.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java
|
||||
index 942e03578836524ba746bc37699677eb06cc7803..703d06b2b29f1500301d82df78dc377141085145 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java
|
||||
@@ -75,7 +75,7 @@ public class Navigation extends NavigationAbstract {
|
||||
|
||||
@Override
|
||||
public PathEntity a(Entity entity, int i) {
|
||||
- return this.a(entity.getChunkCoordinates(), i);
|
||||
+ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
|
||||
}
|
||||
|
||||
private int u() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
index 8848a7552a0ef3944560a71f71620c6bd0f08c10..58225877ce4f2533c19d34e143ae374dc289bce5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.core.BaseBlockPosition;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.IPosition;
|
||||
import net.minecraft.network.protocol.game.PacketDebug;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityInsentient;
|
||||
@@ -28,7 +29,7 @@ import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
public abstract class NavigationAbstract {
|
||||
|
||||
- protected final EntityInsentient a;
|
||||
+ protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
|
||||
protected final World b;
|
||||
@Nullable
|
||||
protected PathEntity c;
|
||||
@@ -115,16 +116,26 @@ public abstract class NavigationAbstract {
|
||||
|
||||
@Nullable
|
||||
public PathEntity a(BlockPosition blockposition, int i) {
|
||||
- return this.a(ImmutableSet.of(blockposition), 8, false, i);
|
||||
+ // Paper start - add target parameter
|
||||
+ return this.a(blockposition, null, i);
|
||||
+ }
|
||||
+ @Nullable public PathEntity a(BlockPosition blockposition, Entity target, int i) {
|
||||
+ return this.a(ImmutableSet.of(blockposition), target, 8, false, i);
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PathEntity a(Entity entity, int i) {
|
||||
- return this.a(ImmutableSet.of(entity.getChunkCoordinates()), 16, true, i);
|
||||
+ return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper
|
||||
}
|
||||
|
||||
@Nullable
|
||||
+ // Paper start - Add target
|
||||
protected PathEntity a(Set<BlockPosition> set, int i, boolean flag, int j) {
|
||||
+ return this.a(set, null, i, flag, j);
|
||||
+ }
|
||||
+ @Nullable protected PathEntity a(Set<BlockPosition> set, Entity target, int i, boolean flag, int j) {
|
||||
+ // Paper end
|
||||
if (set.isEmpty()) {
|
||||
return null;
|
||||
} else if (this.a.locY() < 0.0D) {
|
||||
@@ -134,6 +145,23 @@ public abstract class NavigationAbstract {
|
||||
} else if (this.c != null && !this.c.c() && set.contains(this.p)) {
|
||||
return this.c;
|
||||
} else {
|
||||
+ // Paper start - Pathfind event
|
||||
+ boolean copiedSet = false;
|
||||
+ for (BlockPosition possibleTarget : set) {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
|
||||
+ MCUtil.toLocation(getEntity().world, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||
+ if (!copiedSet) {
|
||||
+ copiedSet = true;
|
||||
+ set = new java.util.HashSet<>(set);
|
||||
+ }
|
||||
+ // note: since we copy the set this remove call is safe, since we're iterating over the old copy
|
||||
+ set.remove(possibleTarget);
|
||||
+ if (set.isEmpty()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.b.getMethodProfiler().enter("pathfind");
|
||||
float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
|
||||
BlockPosition blockposition = flag ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java
|
||||
index 2e1efe7a048f64d494260d10a4ae5dba86af5e6c..f5664b8c0762f775f3cd106d156eb74b48bcedc2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java
|
||||
@@ -37,7 +37,7 @@ public class NavigationFlying extends NavigationAbstract {
|
||||
|
||||
@Override
|
||||
public PathEntity a(Entity entity, int i) {
|
||||
- return this.a(entity.getChunkCoordinates(), i);
|
||||
+ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
|
||||
}
|
||||
|
||||
@Override
|
@ -1,68 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 31 Mar 2016 19:17:58 -0400
|
||||
Subject: [PATCH] Do not load chunks for Pathfinding
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
index 58225877ce4f2533c19d34e143ae374dc289bce5..d71a6e5991629ce59c8529d7cc8064960e385236 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
@@ -48,7 +48,7 @@ public abstract class NavigationAbstract {
|
||||
private BlockPosition p;
|
||||
private int q;
|
||||
private float r;
|
||||
- private final Pathfinder s;
|
||||
+ private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER
|
||||
private boolean t;
|
||||
|
||||
public NavigationAbstract(EntityInsentient entityinsentient, World world) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java
|
||||
index 39cd22a820fdc4c75aefb625b45b0c8c6ce1f199..5784be69098805e4d550a0923ac8daa5aada73f9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java
|
||||
@@ -20,7 +20,7 @@ public class Pathfinder {
|
||||
|
||||
private final PathPoint[] a = new PathPoint[32];
|
||||
private final int b;
|
||||
- private final PathfinderAbstract c;
|
||||
+ private final PathfinderAbstract c; public PathfinderAbstract getPathfinder() { return this.c; } // Paper - OBFHELPER
|
||||
private final Path d = new Path();
|
||||
|
||||
public Pathfinder(PathfinderAbstract pathfinderabstract, int i) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java
|
||||
index ed9c1dfbc84b9573784e6531186b3cd9513ddf75..d14f2800237c2a80912bf6f2d418a9ba9031070d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java
|
||||
@@ -479,7 +479,12 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
for (int j1 = -1; j1 <= 1; ++j1) {
|
||||
if (l != 0 || j1 != 0) {
|
||||
blockposition_mutableblockposition.d(i + l, j + i1, k + j1);
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition);
|
||||
+ // Paper start
|
||||
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition_mutableblockposition);
|
||||
+ if (iblockdata == null) {
|
||||
+ pathtype = PathType.BLOCKED;
|
||||
+ } else {
|
||||
+ // Paper end
|
||||
|
||||
if (iblockdata.a(Blocks.CACTUS)) {
|
||||
return PathType.DANGER_CACTUS;
|
||||
@@ -496,6 +501,7 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
if (iblockaccess.getFluid(blockposition_mutableblockposition).a((Tag) TagsFluid.WATER)) {
|
||||
return PathType.WATER_BORDER;
|
||||
}
|
||||
+ } // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -505,7 +511,8 @@ public class PathfinderNormal extends PathfinderAbstract {
|
||||
}
|
||||
|
||||
protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
|
||||
+ if (iblockdata == null) return PathType.BLOCKED; // Paper
|
||||
Block block = iblockdata.getBlock();
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
@ -1,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 2 Apr 2016 05:09:16 -0400
|
||||
Subject: [PATCH] Add PlayerUseUnknownEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java
|
||||
index 9f3f8568ef9484ba226deaa6429f819c325b7a26..ce63f3e5ac4d1a4311c0ebeb7574d999d45987d9 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java
|
||||
@@ -11,7 +11,7 @@ import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {
|
||||
|
||||
- private int a;
|
||||
+ private int a; public int getEntityId() { return this.a; } // Paper - add accessor
|
||||
private PacketPlayInUseEntity.EnumEntityUseAction action;
|
||||
private Vec3D c;
|
||||
private EnumHand d;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
index af0a7dc9464e1acf1451f45464bab8546207950e..d3938e1fbab0a01ae5045858b1f421e041b768e2 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -2200,6 +2200,16 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Paper start - fire event
|
||||
+ else {
|
||||
+ this.server.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerUseUnknownEntityEvent(
|
||||
+ this.getPlayer(),
|
||||
+ packetplayinuseentity.getEntityId(),
|
||||
+ packetplayinuseentity.b() == PacketPlayInUseEntity.EnumEntityUseAction.ATTACK,
|
||||
+ packetplayinuseentity.c() == EnumHand.MAIN_HAND ? EquipmentSlot.HAND : EquipmentSlot.OFF_HAND
|
||||
+ ));
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Sat, 2 Apr 2016 20:37:03 -0400
|
||||
Subject: [PATCH] Fix reducedDebugInfo not initialized on client
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index cfd0af520dd3dcf364a3ffd03a74e3b9ee6045af..152aa38788a21638aab7cfe2dc187671f1143bde 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -246,6 +246,7 @@ public abstract class PlayerList {
|
||||
playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
|
||||
playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b()));
|
||||
playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry()));
|
||||
+ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver1.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client
|
||||
this.d(entityplayer);
|
||||
entityplayer.getStatisticManager().c();
|
||||
entityplayer.getRecipeBook().a(entityplayer);
|
@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 3 Apr 2016 16:28:17 -0400
|
||||
Subject: [PATCH] Configurable Grass Spread Tick Rate
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 74ba5dbb83c13ce1721619b755036a7864a1fb90..db2dddd12f54e6d15916c4cee623676541de37fb 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -248,4 +248,10 @@ public class PaperWorldConfig {
|
||||
}
|
||||
fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1);
|
||||
}
|
||||
+
|
||||
+ public int grassUpdateRate = 1;
|
||||
+ private void grassUpdateRate() {
|
||||
+ grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
|
||||
+ log("Grass Spread Tick Rate: " + grassUpdateRate);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
|
||||
index a98392f06e66959ec1b75df8d2ecf3b5267980af..712596420af83e6e1b9d147ae2fd8d8a1f36e1b9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.world.level.block;
|
||||
import java.util.Random;
|
||||
import net.minecraft.core.BlockPosition;
|
||||
import net.minecraft.core.EnumDirection;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.WorldServer;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagsFluid;
|
||||
@@ -41,6 +42,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow {
|
||||
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
+ if (this instanceof BlockGrass && worldserver.paperConfig.grassUpdateRate != 1 && (worldserver.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + blockposition.hashCode()) % worldserver.paperConfig.grassUpdateRate != 0)) { return; } // Paper
|
||||
if (!b(iblockdata, (IWorldReader) worldserver, blockposition)) {
|
||||
// CraftBukkit start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {
|
@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 3 Apr 2016 17:48:50 -0400
|
||||
Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index 70db5312ac556ea53247efdbc7759910ba0c9a95..7611481db980a230d42b3cec1d81fae2622ca634 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -518,6 +518,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
public void applyPhysics(BlockPosition blockposition, Block block) {
|
||||
+ if (captureBlockStates) { return; } // Paper - Cancel all physics during placement
|
||||
this.a(blockposition.west(), block, blockposition);
|
||||
this.a(blockposition.east(), block, blockposition);
|
||||
this.a(blockposition.down(), block, blockposition);
|
@ -1,84 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 5 Apr 2016 21:38:58 -0400
|
||||
Subject: [PATCH] Optimize DataBits
|
||||
|
||||
Remove Debug checks as these are super hot and causing noticeable hits
|
||||
|
||||
Before: http://i.imgur.com/nQsMzAE.png
|
||||
After: http://i.imgur.com/nJ46crB.png
|
||||
|
||||
Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/DataBits.java b/src/main/java/net/minecraft/util/DataBits.java
|
||||
index 0c0576c8730069fb5364d8383dec8ab7e698658d..c4f3b680512fb15cea01ad12d0a00c6e60bf34b7 100644
|
||||
--- a/src/main/java/net/minecraft/util/DataBits.java
|
||||
+++ b/src/main/java/net/minecraft/util/DataBits.java
|
||||
@@ -13,8 +13,8 @@ public class DataBits {
|
||||
private final long d;
|
||||
private final int e;
|
||||
private final int f;
|
||||
- private final int g;
|
||||
- private final int h;
|
||||
+ private final int g;private final long g_unsigned; // Paper - referenced in b(int) with 2 Integer.toUnsignedLong calls
|
||||
+ private final int h;private final long h_unsigned; // Paper
|
||||
private final int i;
|
||||
|
||||
public DataBits(int i, int j) {
|
||||
@@ -29,8 +29,8 @@ public class DataBits {
|
||||
this.f = (char) (64 / i);
|
||||
int k = 3 * (this.f - 1);
|
||||
|
||||
- this.g = DataBits.a[k + 0];
|
||||
- this.h = DataBits.a[k + 1];
|
||||
+ this.g = DataBits.a[k + 0]; this.g_unsigned = Integer.toUnsignedLong(this.g); // Paper
|
||||
+ this.h = DataBits.a[k + 1]; this.h_unsigned = Integer.toUnsignedLong(this.h); // Paper
|
||||
this.i = DataBits.a[k + 2];
|
||||
int l = (j + this.f - 1) / this.f;
|
||||
|
||||
@@ -47,15 +47,15 @@ public class DataBits {
|
||||
}
|
||||
|
||||
private int b(int i) {
|
||||
- long j = Integer.toUnsignedLong(this.g);
|
||||
- long k = Integer.toUnsignedLong(this.h);
|
||||
+ //long j = Integer.toUnsignedLong(this.g); // Paper
|
||||
+ //long k = Integer.toUnsignedLong(this.h); // Paper
|
||||
|
||||
- return (int) ((long) i * j + k >> 32 >> this.i);
|
||||
+ return (int) ((long) i * this.g_unsigned + this.h_unsigned >> 32 >> this.i); // Paper
|
||||
}
|
||||
|
||||
- public int a(int i, int j) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
|
||||
- Validate.inclusiveBetween(0L, this.d, (long) j);
|
||||
+ public final int a(int i, int j) { // Paper - make final for inline
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
|
||||
+ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
|
||||
int k = this.b(i);
|
||||
long l = this.b[k];
|
||||
int i1 = (i - k * this.f) * this.c;
|
||||
@@ -65,9 +65,9 @@ public class DataBits {
|
||||
return j1;
|
||||
}
|
||||
|
||||
- public void b(int i, int j) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
|
||||
- Validate.inclusiveBetween(0L, this.d, (long) j);
|
||||
+ public final void b(int i, int j) { // Paper - make final for inline
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
|
||||
+ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper
|
||||
int k = this.b(i);
|
||||
long l = this.b[k];
|
||||
int i1 = (i - k * this.f) * this.c;
|
||||
@@ -75,8 +75,8 @@ public class DataBits {
|
||||
this.b[k] = l & ~(this.d << i1) | ((long) j & this.d) << i1;
|
||||
}
|
||||
|
||||
- public int a(int i) {
|
||||
- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i);
|
||||
+ public final int a(int i) { // Paper - make final for inline
|
||||
+ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper
|
||||
int j = this.b(i);
|
||||
long k = this.b[j];
|
||||
int l = (i - j * this.f) * this.c;
|
@ -1,90 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 13 Apr 2016 00:25:28 -0400
|
||||
Subject: [PATCH] Remove unused World Tile Entity List
|
||||
|
||||
Massive hit to performance and it is completely unnecessary.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index 24a45e5ac9b17feb528e9a047d1ad1761569ebfa..75424a5dd6db57dded3b6d895e6b5b102e91c77e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1721,7 +1721,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
}
|
||||
|
||||
bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size()));
|
||||
- bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityList.size()));
|
||||
+ bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityListTick.size())); // Paper - remove unused list
|
||||
bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a()));
|
||||
bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a()));
|
||||
bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n");
|
||||
@@ -1860,7 +1860,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
private void a(Writer writer) throws IOException {
|
||||
CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer);
|
||||
- Iterator iterator = this.tileEntityList.iterator();
|
||||
+ Iterator iterator = this.tileEntityListTick.iterator(); // Paper - remove unused list
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
TileEntity tileentity = (TileEntity) iterator.next();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index 8da8141c2320c0c1a9b95826a9be2dbe22e11c14..cad86b0273c05767f78bcb3bdfaa9ea01e26af4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -91,7 +91,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
public static final ResourceKey<World> THE_NETHER = ResourceKey.a(IRegistry.L, new MinecraftKey("the_nether"));
|
||||
public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.L, new MinecraftKey("the_end"));
|
||||
private static final EnumDirection[] a = EnumDirection.values();
|
||||
- public final List<TileEntity> tileEntityList = Lists.newArrayList();
|
||||
+ //public final List<TileEntity> tileEntityList = Lists.newArrayList(); // Paper - remove unused list
|
||||
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
|
||||
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
|
||||
protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
|
||||
@@ -683,9 +683,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
}, tileentity::getPosition});
|
||||
}
|
||||
|
||||
- boolean flag = this.tileEntityList.add(tileentity);
|
||||
+ boolean flag = true; // Paper - remove unused list
|
||||
|
||||
- if (flag && tileentity instanceof ITickable) {
|
||||
+ if (flag && tileentity instanceof ITickable && !this.tileEntityListTick.contains(tileentity)) { // Paper
|
||||
this.tileEntityListTick.add(tileentity);
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
timings.tileEntityTick.startTiming(); // Spigot
|
||||
if (!this.tileEntityListUnload.isEmpty()) {
|
||||
this.tileEntityListTick.removeAll(this.tileEntityListUnload);
|
||||
- this.tileEntityList.removeAll(this.tileEntityListUnload);
|
||||
+ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
|
||||
this.tileEntityListUnload.clear();
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
tilesThisCycle--;
|
||||
this.tileEntityListTick.remove(tileTickPosition--);
|
||||
// Spigot end
|
||||
- this.tileEntityList.remove(tileentity);
|
||||
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
if (this.isLoaded(tileentity.getPosition())) {
|
||||
this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition());
|
||||
}
|
||||
@@ -811,7 +811,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
||||
// CraftBukkit start
|
||||
// From above, don't screw this up - SPIGOT-1746
|
||||
- if (!this.tileEntityList.contains(tileentity1)) {
|
||||
+ if (true) { // Paper - remove unused list
|
||||
this.a(tileentity1);
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -957,7 +957,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
} else {
|
||||
if (tileentity != null) {
|
||||
this.tileEntityListPending.remove(tileentity);
|
||||
- this.tileEntityList.remove(tileentity);
|
||||
+ //this.tileEntityList.remove(tileentity); // Paper - remove unused list
|
||||
this.tileEntityListTick.remove(tileentity);
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 13 Apr 2016 00:30:10 -0400
|
||||
Subject: [PATCH] Don't tick Skulls - unused code
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
|
||||
index 87a5f352c8a6336c65008d6e21a771fd6332773c..22217f24b4a87f10b6d5a3e37d23a1164af84ace 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java
|
||||
@@ -33,7 +33,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
// Spigot end
|
||||
|
||||
-public class TileEntitySkull extends TileEntity implements ITickable {
|
||||
+public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable
|
||||
|
||||
@Nullable
|
||||
private static UserCache userCache;
|
||||
@@ -136,7 +136,7 @@ public class TileEntitySkull extends TileEntity implements ITickable {
|
||||
|
||||
}
|
||||
|
||||
- @Override
|
||||
+ // Paper - remove override
|
||||
public void tick() {
|
||||
IBlockData iblockdata = this.getBlock();
|
||||
|
@ -1,131 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 13 Apr 2016 02:10:49 -0400
|
||||
Subject: [PATCH] Configurable Player Collision
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 439dcc6effdc91830d2b7ede9063982998b37120..504efea7b6f50a0d17f4f353781953dfb18bdeca 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -232,4 +232,9 @@ public class PaperConfig {
|
||||
private static void regionFileCacheSize() {
|
||||
regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4);
|
||||
}
|
||||
+
|
||||
+ public static boolean enablePlayerCollisions = true;
|
||||
+ private static void enablePlayerCollisions() {
|
||||
+ enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java
|
||||
index bc40f2cbe1645fd60c4cee106b90f17cd043d32d..c1bb5c325286119891e8d68ce8f7328c99edb486 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java
|
||||
@@ -112,7 +112,7 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut
|
||||
packetdataserializer.a(this.b);
|
||||
packetdataserializer.writeByte(this.j);
|
||||
packetdataserializer.a(this.e);
|
||||
- packetdataserializer.a(this.f);
|
||||
+ packetdataserializer.a(!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions ? "never" : this.f); // Paper
|
||||
packetdataserializer.a((Enum) this.g);
|
||||
packetdataserializer.a(this.c);
|
||||
packetdataserializer.a(this.d);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index b141c744b8ffbc37b09cb4347c4051a77bb7049e..8df60cedc1198916dfce8fcea7ca4a49f98429ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -151,6 +151,7 @@ import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.scores.PersistentScoreboard;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
+import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -551,6 +552,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
||||
}
|
||||
|
||||
+ // Paper start - Handle collideRule team for player collision toggle
|
||||
+ final Scoreboard scoreboard = this.getScoreboard();
|
||||
+ final java.util.Collection<String> toRemove = scoreboard.getTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(ScoreboardTeam::getName).collect(java.util.stream.Collectors.toList());
|
||||
+ for (String teamName : toRemove) {
|
||||
+ scoreboard.removeTeam(scoreboard.getTeam(teamName)); // Clean up after ourselves
|
||||
+ }
|
||||
+
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) {
|
||||
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + java.util.concurrent.ThreadLocalRandom.current().nextInt(), 16);
|
||||
+ ScoreboardTeam collideTeam = scoreboard.createTeam(this.getPlayerList().collideRuleTeamName);
|
||||
+ collideTeam.setCanSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||
this.serverConnection.acceptConnections();
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 9d327f1255dd9d6b11840f7bb8ffc302bc33dbcf..49f1aed92fd5fa46b74a979f317a2eb0672991e9 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -86,6 +86,7 @@ import net.minecraft.world.level.storage.SavedFile;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
import net.minecraft.world.level.storage.WorldNBTStorage;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
+import net.minecraft.world.scores.Scoreboard;
|
||||
import net.minecraft.world.scores.ScoreboardObjective;
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
@@ -145,6 +146,7 @@ public abstract class PlayerList {
|
||||
// CraftBukkit start
|
||||
private CraftServer cserver;
|
||||
private final Map<String,EntityPlayer> playersByName = new java.util.HashMap<>();
|
||||
+ public @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule
|
||||
|
||||
public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) {
|
||||
this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
|
||||
@@ -376,6 +378,13 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
entityplayer.syncInventory();
|
||||
+ // Paper start - Add to collideRule team if needed
|
||||
+ final Scoreboard scoreboard = this.getServer().getWorldServer(World.OVERWORLD).getScoreboard();
|
||||
+ final ScoreboardTeam collideRuleTeam = scoreboard.getTeam(collideRuleTeamName);
|
||||
+ if (this.collideRuleTeamName != null && collideRuleTeam != null && entityplayer.getScoreboardTeam() == null) {
|
||||
+ scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeam);
|
||||
+ }
|
||||
+ // Paper end
|
||||
// CraftBukkit - Moved from above, added world
|
||||
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
|
||||
}
|
||||
@@ -496,6 +505,16 @@ public abstract class PlayerList {
|
||||
entityplayer.playerTick(); // SPIGOT-924
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start - Remove from collideRule team if needed
|
||||
+ if (this.collideRuleTeamName != null) {
|
||||
+ final Scoreboard scoreBoard = this.server.getWorldServer(World.OVERWORLD).getScoreboard();
|
||||
+ final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName);
|
||||
+ if (entityplayer.getScoreboardTeam() == team && team != null) {
|
||||
+ scoreBoard.removePlayerFromTeam(entityplayer.getName(), team);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
this.savePlayerFile(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -1144,6 +1163,13 @@ public abstract class PlayerList {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start - Remove collideRule team if it exists
|
||||
+ if (this.collideRuleTeamName != null) {
|
||||
+ final Scoreboard scoreboard = this.getServer().getWorldServer(World.OVERWORLD).getScoreboard();
|
||||
+ final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName);
|
||||
+ if (team != null) scoreboard.removeTeam(team);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
@ -1,57 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 13 Apr 2016 20:21:38 -0700
|
||||
Subject: [PATCH] Add handshake event to allow plugins to handle client
|
||||
handshaking logic themselves
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
index 9b24afa4f4fe41d2261b16aaecec2144ac7d049f..1164782be686c91379494b236ebded817a002a6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -29,7 +29,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
// CraftBukkit end
|
||||
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer b;
|
||||
- private final NetworkManager c;
|
||||
+ private final NetworkManager c; final NetworkManager getNetworkManager() { return this.c; } // Paper - OBFHELPER
|
||||
|
||||
public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.b = minecraftserver;
|
||||
@@ -88,8 +88,35 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
this.c.close(chatmessage);
|
||||
} else {
|
||||
this.c.setPacketListener(new LoginListener(this.b, this.c));
|
||||
+ // Paper start - handshake event
|
||||
+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee;
|
||||
+ boolean handledByEvent = false;
|
||||
+ // Try and handle the handshake through the event
|
||||
+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me?
|
||||
+ java.net.SocketAddress socketAddress = this.getNetworkManager().socketAddress;
|
||||
+ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress();
|
||||
+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packethandshakinginsetprotocol.hostname, hostnameOfRemote, !proxyLogicEnabled);
|
||||
+ if (event.callEvent()) {
|
||||
+ // If we've failed somehow, let the client know so and go no further.
|
||||
+ if (event.isFailed()) {
|
||||
+ chatmessage = new ChatMessage(event.getFailMessage());
|
||||
+ this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.getNetworkManager().close(chatmessage);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getServerHostname() != null) packethandshakinginsetprotocol.hostname = event.getServerHostname();
|
||||
+ if (event.getSocketAddressHostname() != null) this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
|
||||
+ this.getNetworkManager().spoofedUUID = event.getUniqueId();
|
||||
+ this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
||||
+ handledByEvent = true; // Hooray, we did it!
|
||||
+ }
|
||||
+ }
|
||||
+ // Don't try and handle default logic if it's been handled by the event.
|
||||
+ if (!handledByEvent && proxyLogicEnabled) {
|
||||
+ // Paper end
|
||||
// Spigot Start
|
||||
- if (org.spigotmc.SpigotConfig.bungee) {
|
||||
+ //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||
String[] split = packethandshakinginsetprotocol.hostname.split("\00");
|
||||
if ( ( split.length == 3 || split.length == 4 ) && ( HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||||
packethandshakinginsetprotocol.hostname = split[0];
|
@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 16 Apr 2016 00:39:33 -0400
|
||||
Subject: [PATCH] Configurable RCON IP address
|
||||
|
||||
For servers with multiple IP's, ability to bind to a specific interface.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index 0ecff9f5e2ba444b196d80da341ff851dd5ce26f..b7cf02301c02ed0a6b696384e656426762ae2105 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -67,6 +67,8 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
|
||||
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
|
||||
public final GeneratorSettings generatorSettings;
|
||||
|
||||
+ public final String rconIp; // Paper - Add rcon ip
|
||||
+
|
||||
// CraftBukkit start
|
||||
public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom, OptionSet optionset) {
|
||||
super(properties, optionset);
|
||||
@@ -118,6 +120,10 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr
|
||||
this.textFilteringConfig = this.getString("text-filtering-config", "");
|
||||
this.playerIdleTimeout = this.b("player-idle-timeout", 0);
|
||||
this.whiteList = this.b("white-list", false);
|
||||
+ // Paper start - Configurable rcon ip
|
||||
+ final String rconIp = this.getSettingIfExists("rcon.ip");
|
||||
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
|
||||
+ // Paper end
|
||||
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/PropertyManager.java b/src/main/java/net/minecraft/server/dedicated/PropertyManager.java
|
||||
index cb85d8bc1b81f9e5fa95c4dfeffbe689667f56a2..03dd6dc3a1aa8d1be6990c750f96e8a280bc1f25 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/PropertyManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/PropertyManager.java
|
||||
@@ -129,8 +129,8 @@ public abstract class PropertyManager<T extends PropertyManager<T>> {
|
||||
};
|
||||
}
|
||||
|
||||
- @Nullable
|
||||
- private String c(String s) {
|
||||
+ @Nullable String getSettingIfExists(final String path) { return this.c(path); } // Paper - OBFHELPER
|
||||
+ @Nullable private String c(String s) { // Paper - OBFHELPER
|
||||
return (String) getOverride(s, this.properties.getProperty(s)); // CraftBukkit
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java b/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java
|
||||
index 797a450a08da1b799e32fae2a71a7a50bb90d127..3b3e21d1d86629d6c5e06108e53d1c5e807074d8 100644
|
||||
--- a/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java
|
||||
@@ -62,7 +62,7 @@ public class RemoteControlListener extends RemoteConnectionThread {
|
||||
@Nullable
|
||||
public static RemoteControlListener a(IMinecraftServer iminecraftserver) {
|
||||
DedicatedServerProperties dedicatedserverproperties = iminecraftserver.getDedicatedServerProperties();
|
||||
- String s = iminecraftserver.h_();
|
||||
+ String s = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
|
||||
|
||||
if (s.isEmpty()) {
|
||||
s = "0.0.0.0";
|
@ -1,82 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 17 Apr 2016 17:27:09 -0400
|
||||
Subject: [PATCH] Prevent Fire from loading chunks & wrongly spread
|
||||
|
||||
This causes the nether to spam unload/reload chunks, plus overall
|
||||
bad behavior.
|
||||
|
||||
This also stops fire from spreading to illegal locations.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
||||
index ee5400fd3e493e1f0518a9e47ddbc997e7a0fb92..c22fad0038fdb0769e23db782e3341206fbd80f9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
||||
@@ -135,7 +135,7 @@ public class BlockFire extends BlockFireAbstract {
|
||||
BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.h.get(enumdirection);
|
||||
|
||||
if (blockstateboolean != null) {
|
||||
- iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.e(iblockaccess.getType(blockposition.shift(enumdirection))));
|
||||
+ iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.e(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))); // Paper - prevent chunk loads
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,6 +215,7 @@ public class BlockFire extends BlockFireAbstract {
|
||||
}
|
||||
|
||||
blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, l, j1, i1);
|
||||
+ if (blockposition_mutableblockposition.isInvalidYLocation() || !worldserver.isLoaded(blockposition_mutableblockposition)) continue; // Paper
|
||||
int l1 = this.a((IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition);
|
||||
|
||||
if (l1 > 0) {
|
||||
@@ -260,10 +261,16 @@ public class BlockFire extends BlockFireAbstract {
|
||||
}
|
||||
|
||||
private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition
|
||||
- int k = this.getBurnChance(world.getType(blockposition));
|
||||
+ // Paper start
|
||||
+ final IBlockData iblockdata = world.getTypeIfLoaded(blockposition);
|
||||
+ if (iblockdata == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int k = this.getBurnChance(iblockdata);
|
||||
+ // Paper end
|
||||
|
||||
if (random.nextInt(i) < k) {
|
||||
- IBlockData iblockdata = world.getType(blockposition);
|
||||
+ //IBlockData iblockdata = world.getType(blockposition); // Paper
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -309,7 +316,7 @@ public class BlockFire extends BlockFireAbstract {
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EnumDirection enumdirection = aenumdirection[j];
|
||||
|
||||
- if (this.e(iblockaccess.getType(blockposition.shift(enumdirection)))) {
|
||||
+ if (this.e(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))) { // Paper - prevent chunk loads
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -327,7 +334,12 @@ public class BlockFire extends BlockFireAbstract {
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
EnumDirection enumdirection = aenumdirection[k];
|
||||
- IBlockData iblockdata = iworldreader.getType(blockposition.shift(enumdirection));
|
||||
+ // Paper start
|
||||
+ IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition.shift(enumdirection));
|
||||
+ if (iblockdata == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
i = Math.max(this.getFlameChance(iblockdata), i);
|
||||
}
|
||||
@@ -338,7 +350,7 @@ public class BlockFire extends BlockFireAbstract {
|
||||
|
||||
@Override
|
||||
protected boolean e(IBlockData iblockdata) {
|
||||
- return this.getFlameChance(iblockdata) > 0;
|
||||
+ return iblockdata != null && this.getFlameChance(iblockdata) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now
|
||||
}
|
||||
|
||||
@Override
|
@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Fri, 22 Apr 2016 01:43:11 -0500
|
||||
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
|
||||
|
||||
Don't even get me started
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index acbd10432b09172f7541b2f4081d1aa9812194ac..ecb07130be80b484e0f2241a368db967775148e8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -1130,10 +1130,16 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {
|
||||
+ // Paper start - Forward
|
||||
+ heal(f, regainReason, false);
|
||||
+ }
|
||||
+
|
||||
+ public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason, boolean isFastRegen) {
|
||||
+ // Paper end
|
||||
float f1 = this.getHealth();
|
||||
|
||||
if (f1 > 0.0F) {
|
||||
- EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
|
||||
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason, isFastRegen); // Paper
|
||||
// Suppress during worldgen
|
||||
if (this.valid) {
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodMetaData.java b/src/main/java/net/minecraft/world/food/FoodMetaData.java
|
||||
index 7ed321acba6d46159f7d67b8d10a0a3e06ac88a9..e455b25b0809af15f6fde957121d0110da7eb08f 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodMetaData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodMetaData.java
|
||||
@@ -87,7 +87,7 @@ public class FoodMetaData {
|
||||
if (this.foodTickTimer >= this.saturatedRegenRate) { // CraftBukkit
|
||||
float f = Math.min(this.saturationLevel, 6.0F);
|
||||
|
||||
- entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
|
||||
+ entityhuman.heal(f / 6.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED, true); // CraftBukkit - added RegainReason // Paper - This is fast regen
|
||||
// this.a(f); CraftBukkit - EntityExhaustionEvent
|
||||
entityhuman.applyExhaustion(f, org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.REGEN); // CraftBukkit - EntityExhaustionEvent
|
||||
this.foodTickTimer = 0;
|
@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Thu, 21 Apr 2016 23:51:55 -0700
|
||||
Subject: [PATCH] Add ability to configure frosted_ice properties
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 1942f5224aaebb18adb591d6f70a419cfc1a7bdd..5baccb8d50c135ab20c38ffd0690f585514ce5af 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -259,4 +259,14 @@ public class PaperWorldConfig {
|
||||
private void useVanillaScoreboardColoring() {
|
||||
useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false);
|
||||
}
|
||||
+
|
||||
+ public boolean frostedIceEnabled = true;
|
||||
+ public int frostedIceDelayMin = 20;
|
||||
+ public int frostedIceDelayMax = 40;
|
||||
+ private void frostedIce() {
|
||||
+ this.frostedIceEnabled = this.getBoolean("frosted-ice.enabled", this.frostedIceEnabled);
|
||||
+ this.frostedIceDelayMin = this.getInt("frosted-ice.delay.min", this.frostedIceDelayMin);
|
||||
+ this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax);
|
||||
+ log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java
|
||||
index 7239a30bd4a5dc4ed09802eea8f7126485ebb635..e32e94868386ff06ff29254e6cc3bee9b446a293 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java
|
||||
@@ -30,6 +30,7 @@ public class BlockIceFrost extends BlockIce {
|
||||
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
+ if (!worldserver.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
|
||||
if ((random.nextInt(3) == 0 || this.a(worldserver, blockposition, 4)) && worldserver.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) worldserver, blockposition) && this.e(iblockdata, (World) worldserver, blockposition)) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
||||
EnumDirection[] aenumdirection = EnumDirection.values();
|
||||
@@ -42,12 +43,12 @@ public class BlockIceFrost extends BlockIce {
|
||||
IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition);
|
||||
|
||||
if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) {
|
||||
- worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, 20, 40));
|
||||
+ worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
- worldserver.getBlockTickList().a(blockposition, this, MathHelper.nextInt(random, 20, 40));
|
||||
+ worldserver.getBlockTickList().a(blockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 28 Apr 2016 00:57:27 -0400
|
||||
Subject: [PATCH] remove null possibility for getServer singleton
|
||||
|
||||
to stop IDE complaining about potential NPE
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 026ddfba26439a00685f3962084aa6194086c9b7..f990f242a8d812a93b454b065a17fd4e8170355a 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -180,6 +180,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot
|
||||
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
|
||||
|
||||
+ private static MinecraftServer SERVER; // Paper
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final File b = new File("usercache.json");
|
||||
public static final WorldSettings c = new WorldSettings("Demo World", EnumGamemode.SURVIVAL, false, EnumDifficulty.NORMAL, false, new GameRules(), DataPackConfiguration.a);
|
||||
@@ -286,6 +287,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
||||
public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
super("Server");
|
||||
+ SERVER = this; // Paper - better singleton
|
||||
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ai);
|
||||
this.methodProfiler = GameProfilerDisabled.a;
|
||||
this.serverPing = new ServerPing();
|
||||
@@ -2163,7 +2165,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
|
||||
@Deprecated
|
||||
public static MinecraftServer getServer() {
|
||||
- return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
||||
+ return SERVER; // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -1,144 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 29 Apr 2016 20:02:00 -0400
|
||||
Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes
|
||||
|
||||
Maps used a modified version of rendering to support plugin controlled
|
||||
imaging on maps. The Craft Map Renderer is much slower than Vanilla,
|
||||
causing maps in item frames to cause a noticeable hit on server performance.
|
||||
|
||||
This updates the map system to not use the Craft system if we detect that no
|
||||
custom renderers are in use, defaulting to the much simpler Vanilla system.
|
||||
|
||||
Additionally, numerous issues to player position tracking on maps has been fixed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index 2412c2fa22abe171254f7fe49d319bcd6cc533ff..c4bbc4e97ee1871ed6e4364c1fe9204b0dd2fdae 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -1170,6 +1170,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
{
|
||||
if ( iter.next().trackee == entity )
|
||||
{
|
||||
+ map.decorations.remove(entity.getDisplayName().getString()); // Paper
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
index f42e16589476c1bd10b13214dda5ac7bb3e52131..e3e3426a00128b56d523bb43a59b814b915ad0ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
@@ -86,6 +86,7 @@ import net.minecraft.world.item.ItemElytra;
|
||||
import net.minecraft.world.item.ItemProjectileWeapon;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ItemSword;
|
||||
+import net.minecraft.world.item.ItemWorldMap;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.IRecipe;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentManager;
|
||||
@@ -104,6 +105,7 @@ import net.minecraft.world.level.block.entity.TileEntitySign;
|
||||
import net.minecraft.world.level.block.entity.TileEntityStructure;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
|
||||
+import net.minecraft.world.level.saveddata.maps.WorldMap;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
@@ -689,6 +691,12 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
return null;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Paper start - remove player from map on drop
|
||||
+ if (itemstack.getItem() == Items.FILLED_MAP) {
|
||||
+ WorldMap worldmap = ItemWorldMap.getSavedMap(itemstack, this.world);
|
||||
+ worldmap.updateSeenPlayers(this, itemstack);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
return entityitem;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
|
||||
index 3f057f0bd23bc1c693c8f04ee8acd6626c620008..d470af1814af332595c1c0beb1cdc552e186a6bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java
|
||||
@@ -57,6 +57,7 @@ public class WorldMap extends PersistentBase {
|
||||
private final Map<String, MapIconBanner> m = Maps.newHashMap();
|
||||
public final Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
|
||||
private final Map<String, WorldMapFrame> n = Maps.newHashMap();
|
||||
+ private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper
|
||||
|
||||
// CraftBukkit start
|
||||
public final CraftMapView mapView;
|
||||
@@ -69,6 +70,7 @@ public class WorldMap extends PersistentBase {
|
||||
// CraftBukkit start
|
||||
mapView = new CraftMapView(this);
|
||||
server = (CraftServer) org.bukkit.Bukkit.getServer();
|
||||
+ vanillaRender.buffer = colors; // Paper
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -136,6 +138,7 @@ public class WorldMap extends PersistentBase {
|
||||
this.m.put(mapiconbanner.f(), mapiconbanner);
|
||||
this.a(mapiconbanner.c(), (GeneratorAccess) null, mapiconbanner.f(), (double) mapiconbanner.a().getX(), (double) mapiconbanner.a().getZ(), 180.0D, mapiconbanner.d());
|
||||
}
|
||||
+ this.vanillaRender.buffer = colors; // Paper
|
||||
|
||||
NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10);
|
||||
|
||||
@@ -216,6 +219,7 @@ public class WorldMap extends PersistentBase {
|
||||
this.b();
|
||||
}
|
||||
|
||||
+ public void updateSeenPlayers(EntityHuman entityhuman, ItemStack itemstack) { this.a(entityhuman, itemstack); } // Paper - OBFHELPER
|
||||
public void a(EntityHuman entityhuman, ItemStack itemstack) {
|
||||
if (!this.humans.containsKey(entityhuman)) {
|
||||
WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman);
|
||||
@@ -451,6 +455,21 @@ public class WorldMap extends PersistentBase {
|
||||
|
||||
public class WorldMapHumanTracker {
|
||||
|
||||
+ // Paper start
|
||||
+ private void addSeenPlayers(java.util.Collection<MapIcon> icons) {
|
||||
+ org.bukkit.entity.Player player = (org.bukkit.entity.Player) trackee.getBukkitEntity();
|
||||
+ WorldMap.this.decorations.forEach((name, mapIcon) -> {
|
||||
+ // If this cursor is for a player check visibility with vanish system
|
||||
+ org.bukkit.entity.Player other = org.bukkit.Bukkit.getPlayerExact(name); // Spigot
|
||||
+ if (other == null || player.canSee(other)) {
|
||||
+ icons.add(mapIcon);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ private boolean shouldUseVanillaMap() {
|
||||
+ return mapView.getRenderers().size() == 1 && mapView.getRenderers().get(0).getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class;
|
||||
+ }
|
||||
+ // Paper end
|
||||
public final EntityHuman trackee;
|
||||
private boolean d = true;
|
||||
private int e;
|
||||
@@ -467,9 +486,12 @@ public class WorldMap extends PersistentBase {
|
||||
@Nullable
|
||||
public Packet<?> a(ItemStack itemstack) {
|
||||
// CraftBukkit start
|
||||
- org.bukkit.craftbukkit.map.RenderData render = WorldMap.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.trackee.getBukkitEntity()); // CraftBukkit
|
||||
+ if (!this.d && this.i % 5 != 0) { this.i++; return null; } // Paper - this won't end up sending, so don't render it!
|
||||
+ boolean vanillaMaps = shouldUseVanillaMap(); // Paper
|
||||
+ org.bukkit.craftbukkit.map.RenderData render = !vanillaMaps ? WorldMap.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.trackee.getBukkitEntity()) : WorldMap.this.vanillaRender; // CraftBukkit // Paper
|
||||
|
||||
java.util.Collection<MapIcon> icons = new java.util.ArrayList<MapIcon>();
|
||||
+ if (vanillaMaps) addSeenPlayers(icons); // Paper
|
||||
|
||||
for ( org.bukkit.map.MapCursor cursor : render.cursors) {
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
|
||||
index 256a131781721c86dd6cdbc329335964570cbe8c..5768cd512ec166f1e8d1f4a28792015347297c3f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
|
||||
@@ -5,7 +5,7 @@ import org.bukkit.map.MapCursor;
|
||||
|
||||
public class RenderData {
|
||||
|
||||
- public final byte[] buffer;
|
||||
+ public byte[] buffer; // Paper
|
||||
public final ArrayList<MapCursor> cursors;
|
||||
|
||||
public RenderData() {
|
@ -1,117 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 16 May 2016 20:47:41 -0400
|
||||
Subject: [PATCH] Optimize UserCache / Thread Safe
|
||||
|
||||
Because Techable keeps complaining about how this isn't thread safe,
|
||||
easier to do this than replace the entire thing.
|
||||
|
||||
Additionally, move Saving of the User cache to be done async, incase
|
||||
the user never changed the default setting for Spigot's save on stop only.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f990f242a8d812a93b454b065a17fd4e8170355a..283c1111d99b6ae09b6db0c0079eeb0f1cbb7b2b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -907,7 +907,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
|
||||
} catch (java.lang.InterruptedException ignored) {} // Paper
|
||||
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
|
||||
LOGGER.info("Saving usercache.json");
|
||||
- this.getUserCache().b();
|
||||
+ this.getUserCache().b(false); // Paper
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index faf4d00bf288359db806913c4d2964324e8706b7..8ae72e8c8325d9b03803f29fcdd83a0ce8d34450 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -251,7 +251,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
}
|
||||
|
||||
if (this.convertNames()) {
|
||||
- this.getUserCache().b();
|
||||
+ this.getUserCache().b(false); // Paper
|
||||
}
|
||||
|
||||
if (!NameReferencingFileConverter.e(this)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java
|
||||
index 5694ba68a142d735a7c61563ee22cd54da9b4cc9..39d1c379b781c08bfdd720cd6810a9c0bb9f0d09 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/UserCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
|
||||
@@ -36,6 +36,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
+import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -108,7 +109,7 @@ public class UserCache {
|
||||
return UserCache.b;
|
||||
}
|
||||
|
||||
- public void a(GameProfile gameprofile) {
|
||||
+ public synchronized void a(GameProfile gameprofile) { // Paper - synchronize
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
calendar.setTime(new Date());
|
||||
@@ -117,7 +118,7 @@ public class UserCache {
|
||||
UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date);
|
||||
|
||||
this.a(usercache_usercacheentry);
|
||||
- if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.b(); // Spigot - skip saving if disabled
|
||||
+ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.b(true); // Spigot - skip saving if disabled // Paper - async
|
||||
}
|
||||
|
||||
private long d() {
|
||||
@@ -125,7 +126,7 @@ public class UserCache {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public GameProfile getProfile(String s) {
|
||||
+ public synchronized GameProfile getProfile(String s) { // Paper - synchronize
|
||||
String s1 = s.toLowerCase(Locale.ROOT);
|
||||
UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1);
|
||||
boolean flag = false;
|
||||
@@ -151,7 +152,7 @@ public class UserCache {
|
||||
}
|
||||
|
||||
if (flag && !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { // Spigot - skip saving if disabled
|
||||
- this.b();
|
||||
+ this.b(true); // Paper
|
||||
}
|
||||
|
||||
return gameprofile;
|
||||
@@ -233,7 +234,7 @@ public class UserCache {
|
||||
return arraylist;
|
||||
}
|
||||
|
||||
- public void b() {
|
||||
+ public void b(boolean asyncSave) { // Paper
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
DateFormat dateformat = e();
|
||||
|
||||
@@ -241,6 +242,7 @@ public class UserCache {
|
||||
jsonarray.add(a(usercache_usercacheentry, dateformat));
|
||||
});
|
||||
String s = this.f.toJson(jsonarray);
|
||||
+ Runnable save = () -> { // Paper
|
||||
|
||||
try {
|
||||
BufferedWriter bufferedwriter = Files.newWriter(this.g, StandardCharsets.UTF_8);
|
||||
@@ -268,6 +270,14 @@ public class UserCache {
|
||||
} catch (IOException ioexception) {
|
||||
;
|
||||
}
|
||||
+ // Paper start
|
||||
+ };
|
||||
+ if (asyncSave) {
|
||||
+ MCUtil.scheduleAsyncTask(save);
|
||||
+ } else {
|
||||
+ save.run();
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
}
|
||||
|
@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 16 May 2016 23:19:16 -0400
|
||||
Subject: [PATCH] Avoid blocking on Network Manager creation
|
||||
|
||||
Per Paper issue 294
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerConnection.java b/src/main/java/net/minecraft/server/network/ServerConnection.java
|
||||
index f66a5ba901601c1d359a287861a2edd8e3a106a7..d992cb5cd827e0fe655809e1088939cdad9c2301 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerConnection.java
|
||||
@@ -52,6 +52,15 @@ public class ServerConnection {
|
||||
public volatile boolean c;
|
||||
private final List<ChannelFuture> listeningChannels = Collections.synchronizedList(Lists.newArrayList());
|
||||
private final List<NetworkManager> connectedChannels = Collections.synchronizedList(Lists.newArrayList());
|
||||
+ // Paper start - prevent blocking on adding a new network manager while the server is ticking
|
||||
+ private final java.util.Queue<NetworkManager> pending = new java.util.concurrent.ConcurrentLinkedQueue<>();
|
||||
+ private void addPending() {
|
||||
+ NetworkManager manager = null;
|
||||
+ while ((manager = pending.poll()) != null) {
|
||||
+ connectedChannels.add(manager);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
public ServerConnection(MinecraftServer minecraftserver) {
|
||||
this.e = minecraftserver;
|
||||
@@ -87,7 +96,8 @@ public class ServerConnection {
|
||||
int j = ServerConnection.this.e.k();
|
||||
Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);
|
||||
|
||||
- ServerConnection.this.connectedChannels.add((NetworkManager) object); // CraftBukkit - decompile error
|
||||
+ //ServerConnection.this.connectedChannels.add((NetworkManager) object); // CraftBukkit - decompile error
|
||||
+ pending.add((NetworkManager) object); // Paper
|
||||
channel.pipeline().addLast("packet_handler", (ChannelHandler) object);
|
||||
((NetworkManager) object).setPacketListener(new HandshakeListener(ServerConnection.this.e, (NetworkManager) object));
|
||||
}
|
||||
@@ -126,6 +136,7 @@ public class ServerConnection {
|
||||
|
||||
synchronized (this.connectedChannels) {
|
||||
// Spigot Start
|
||||
+ this.addPending(); // Paper
|
||||
// This prevents players from 'gaming' the server, and strategically relogging to increase their position in the tick order
|
||||
if ( org.spigotmc.SpigotConfig.playerShuffle > 0 && MinecraftServer.currentTick % org.spigotmc.SpigotConfig.playerShuffle == 0 )
|
||||
{
|
@ -1,122 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Sun, 22 May 2016 20:20:55 -0500
|
||||
Subject: [PATCH] Optional TNT doesn't move in water
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index eb04fdb172a50ec1f5b7fe78fa0e7655246abd60..6eca3f300020006f02dd36253b522db442e3cc33 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -2,7 +2,6 @@ package com.destroystokyo.paper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
-import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
|
||||
@@ -291,4 +290,14 @@ public class PaperWorldConfig {
|
||||
);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public boolean preventTntFromMovingInWater;
|
||||
+ private void preventTntFromMovingInWater() {
|
||||
+ if (PaperConfig.version < 13) {
|
||||
+ boolean oldVal = getBoolean("enable-old-tnt-cannon-behaviors", false);
|
||||
+ set("prevent-tnt-from-moving-in-water", oldVal);
|
||||
+ }
|
||||
+ preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
|
||||
+ log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
index beb0beb716869978be6bc5a78ce3b6cf785c5aee..e3cdea3c85d762af6984f3dbe544fdfe101f6ff6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -67,7 +67,7 @@ public class EntityTrackerEntry {
|
||||
private boolean q;
|
||||
private boolean r;
|
||||
// CraftBukkit start
|
||||
- private final Set<EntityPlayer> trackedPlayers;
|
||||
+ final Set<EntityPlayer> trackedPlayers; // Paper - private -> package
|
||||
// Paper start
|
||||
private java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = null;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 092ee75f9527af25a48ab052659e3304986b50e0..d314cdd9341e6aa5748a5b1afdd9569bec956c74 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2771,6 +2771,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
|
||||
public boolean bV() {
|
||||
+ // Paper start
|
||||
+ return this.pushedByWater();
|
||||
+ }
|
||||
+ public boolean pushedByWater() {
|
||||
+ // Paper end
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
index 535e7d7297d81026b8586d5049b72fa65519b464..63b35feac07f01b200dd68c4836ceb419e951660 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
@@ -4,10 +4,14 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.core.particles.Particles;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityTeleport;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityVelocity;
|
||||
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.network.syncher.DataWatcher;
|
||||
import net.minecraft.network.syncher.DataWatcherObject;
|
||||
import net.minecraft.network.syncher.DataWatcherRegistry;
|
||||
+import net.minecraft.server.level.PlayerChunkMap;
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityLiving;
|
||||
import net.minecraft.world.entity.EntityPose;
|
||||
@@ -96,7 +100,27 @@ public class EntityTNTPrimed extends Entity {
|
||||
this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
-
|
||||
+ // Paper start - Optional prevent TNT from moving in water
|
||||
+ if (!this.dead && this.inWater && this.world.paperConfig.preventTntFromMovingInWater) {
|
||||
+ /*
|
||||
+ * Author: Jedediah Smith <jedediah@silencegreys.com>
|
||||
+ */
|
||||
+ // Send position and velocity updates to nearby players on every tick while the TNT is in water.
|
||||
+ // This does pretty well at keeping their clients in sync with the server.
|
||||
+ PlayerChunkMap.EntityTracker ete = ((WorldServer)this.world).getChunkProvider().playerChunkMap.trackedEntities.get(this.getId());
|
||||
+ if (ete != null) {
|
||||
+ PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this);
|
||||
+ PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this);
|
||||
+
|
||||
+ ete.trackedPlayers.stream()
|
||||
+ .filter(viewer -> (viewer.locX() - this.locX()) * (viewer.locY() - this.locY()) * (viewer.locZ() - this.locZ()) < 16 * 16)
|
||||
+ .forEach(viewer -> {
|
||||
+ viewer.playerConnection.sendPacket(velocityPacket);
|
||||
+ viewer.playerConnection.sendPacket(positionPacket);
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
@@ -165,4 +189,11 @@ public class EntityTNTPrimed extends Entity {
|
||||
public Packet<?> P() {
|
||||
return new PacketPlayOutSpawnEntity(this);
|
||||
}
|
||||
+
|
||||
+ // Paper start - Optional prevent TNT from moving in water
|
||||
+ @Override
|
||||
+ public boolean pushedByWater() {
|
||||
+ return !world.paperConfig.preventTntFromMovingInWater && super.pushedByWater();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Panzer <postremus1996@googlemail.com>
|
||||
Date: Mon, 23 May 2016 12:12:37 +0200
|
||||
Subject: [PATCH] Faster redstone torch rapid clock removal
|
||||
|
||||
Only resize the the redstone torch list once, since resizing arrays / lists is costly
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index cad86b0273c05767f78bcb3bdfaa9ea01e26af4e..d8ab2e22a5c0144decb5c657a123cc61722fcbf5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -44,6 +44,7 @@ import net.minecraft.world.level.biome.BiomeBase;
|
||||
import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.BlockFireAbstract;
|
||||
+import net.minecraft.world.level.block.BlockRedstoneTorch;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.ITickable;
|
||||
import net.minecraft.world.level.block.entity.TileEntity;
|
||||
@@ -142,6 +143,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
private org.spigotmc.TickLimiter tileLimiter;
|
||||
private int tileTickPosition;
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
+ public java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
|
||||
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java b/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java
|
||||
index 8142c0be2978d8975612488b17da9c2e25f3b5dd..6771c16b4228c1495950484422b73928f6184929 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java
|
||||
@@ -22,7 +22,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
public static final BlockStateBoolean LIT = BlockProperties.r;
|
||||
- private static final Map<IBlockAccess, List<BlockRedstoneTorch.RedstoneUpdateInfo>> b = new WeakHashMap();
|
||||
+ // Paper - Move the mapped list to World
|
||||
|
||||
protected BlockRedstoneTorch(BlockBase.Info blockbase_info) {
|
||||
super(blockbase_info, ParticleParamRedstone.a);
|
||||
@@ -69,11 +69,15 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
@Override
|
||||
public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
boolean flag = this.a((World) worldserver, blockposition, iblockdata);
|
||||
- List list = (List) BlockRedstoneTorch.b.get(worldserver);
|
||||
-
|
||||
- while (list != null && !list.isEmpty() && worldserver.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) {
|
||||
- list.remove(0);
|
||||
+ // Paper start
|
||||
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos = worldserver.redstoneUpdateInfos;
|
||||
+ if (redstoneUpdateInfos != null) {
|
||||
+ BlockRedstoneTorch.RedstoneUpdateInfo curr;
|
||||
+ while ((curr = redstoneUpdateInfos.peek()) != null && worldserver.getTime() - curr.getTime() > 60L) {
|
||||
+ redstoneUpdateInfos.poll();
|
||||
+ }
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.plugin.PluginManager manager = worldserver.getServer().getPluginManager();
|
||||
@@ -138,9 +142,12 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
}
|
||||
|
||||
private static boolean a(World world, BlockPosition blockposition, boolean flag) {
|
||||
- List<BlockRedstoneTorch.RedstoneUpdateInfo> list = (List) BlockRedstoneTorch.b.computeIfAbsent(world, (iblockaccess) -> {
|
||||
- return Lists.newArrayList();
|
||||
- });
|
||||
+ // Paper start
|
||||
+ java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> list = world.redstoneUpdateInfos;
|
||||
+ if (list == null) {
|
||||
+ list = world.redstoneUpdateInfos = new java.util.ArrayDeque<>();
|
||||
+ }
|
||||
+
|
||||
|
||||
if (flag) {
|
||||
list.add(new BlockRedstoneTorch.RedstoneUpdateInfo(blockposition.immutableCopy(), world.getTime()));
|
||||
@@ -148,9 +155,9 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
|
||||
int i = 0;
|
||||
|
||||
- for (int j = 0; j < list.size(); ++j) {
|
||||
- BlockRedstoneTorch.RedstoneUpdateInfo blockredstonetorch_redstoneupdateinfo = (BlockRedstoneTorch.RedstoneUpdateInfo) list.get(j);
|
||||
-
|
||||
+ for (java.util.Iterator<BlockRedstoneTorch.RedstoneUpdateInfo> iterator = list.iterator(); iterator.hasNext();) {
|
||||
+ BlockRedstoneTorch.RedstoneUpdateInfo blockredstonetorch_redstoneupdateinfo = iterator.next();
|
||||
+ // Paper end
|
||||
if (blockredstonetorch_redstoneupdateinfo.a.equals(blockposition)) {
|
||||
++i;
|
||||
if (i >= 8) {
|
||||
@@ -165,7 +172,7 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
public static class RedstoneUpdateInfo {
|
||||
|
||||
private final BlockPosition a;
|
||||
- private final long b;
|
||||
+ private final long b; final long getTime() { return this.b; } // Paper - OBFHELPER
|
||||
|
||||
public RedstoneUpdateInfo(BlockPosition blockposition, long i) {
|
||||
this.a = blockposition;
|
@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 31 May 2016 22:53:50 -0400
|
||||
Subject: [PATCH] Only send Dragon/Wither Death sounds to same world
|
||||
|
||||
Also fix view distance lookup
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
index 6c58cf9d39cc0f0eb0dc7ddb126b8a3cf6a08fe7..74802de01dba30e38e09f6fc1f61e7bb64cf5f09 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
@@ -619,8 +619,9 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
if (this.deathAnimationTicks == 1 && !this.isSilent()) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.b(1028, this.getChunkCoordinates(), 0);
|
||||
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
- for (net.minecraft.server.level.EntityPlayer player : this.world.getMinecraftServer().getPlayerList().players) {
|
||||
+ //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ for (net.minecraft.server.level.EntityPlayer player : (List<net.minecraft.server.level.EntityPlayer>) ((WorldServer)world).getPlayers()) {
|
||||
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
index f74949c855aea32ceb16d8cb07f266d50045b57e..145767e8b0fc4105a0afa47af17dcdbb75e952bc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -258,8 +258,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
if (!this.isSilent()) {
|
||||
// CraftBukkit start - Use relative location for far away sounds
|
||||
// this.world.b(1023, new BlockPosition(this), 0);
|
||||
- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>)this.world.getPlayers()) {
|
||||
+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch
|
||||
double deltaX = this.locX() - player.locX();
|
||||
double deltaZ = this.locZ() - player.locZ();
|
||||
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
@ -1,59 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 17 Jun 2016 20:50:11 -0400
|
||||
Subject: [PATCH] Fix Old Sign Conversion
|
||||
|
||||
1) Sign loading code was trying to parse the JSON before the check for oldSign.
|
||||
That code could then skip the old sign converting code if it triggers a JSON parse exception.
|
||||
2) New Mojang Schematic system has Tile Entities in the new converted format, but missing the Bukkit.isConverted flag
|
||||
This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
index 58789a6e285c31947508deae37caefe7e182278c..9b44ca96669ce423e5649f11743226dfdd9ce746 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
@@ -34,6 +34,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { /
|
||||
public CraftPersistentDataContainer persistentDataContainer;
|
||||
// CraftBukkit end
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
+ public boolean isLoadingStructure = false; // Paper
|
||||
private final TileEntityTypes<?> tileType; public TileEntityTypes getTileEntityType() { return tileType; } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
protected World world;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
index 29db550d91cf9e5a23052772df6e482a5e2b0b90..ec550aaa4e7943af4ecdd2275f1f32c21edf770a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
@@ -78,13 +78,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener { //
|
||||
}
|
||||
|
||||
try {
|
||||
- IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s);
|
||||
+ //IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error
|
||||
|
||||
- if (oldSign) {
|
||||
+ if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
|
||||
lines[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - after old sign
|
||||
|
||||
if (this.world instanceof WorldServer) {
|
||||
try {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
|
||||
index a2bc771df054923a9a96c0024a426ef707624359..9b82ff37faaafc3a799413f6949fb88a993aa9a0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
|
||||
@@ -278,9 +278,11 @@ public class DefinedStructure {
|
||||
definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong());
|
||||
}
|
||||
|
||||
+ tileentity.isLoadingStructure = true; // Paper
|
||||
tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c);
|
||||
tileentity.a(definedstructureinfo.c());
|
||||
tileentity.a(definedstructureinfo.d());
|
||||
+ tileentity.isLoadingStructure = false; // Paper
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Sat, 16 Jul 2016 19:11:17 -0500
|
||||
Subject: [PATCH] Don't lookup game profiles that have no UUID and no name
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java
|
||||
index 39d1c379b781c08bfdd720cd6810a9c0bb9f0d09..4ad084e7cea3b341ca0dbaa6e853cfc685a555ff 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/UserCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/UserCache.java
|
||||
@@ -92,7 +92,7 @@ public class UserCache {
|
||||
gameprofilerepository.findProfilesByNames(new String[]{s}, Agent.MINECRAFT, profilelookupcallback);
|
||||
GameProfile gameprofile = (GameProfile) atomicreference.get();
|
||||
|
||||
- if (!c() && gameprofile == null) {
|
||||
+ if (!c() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(s)) { // Paper - Don't lookup a profile with a blank name
|
||||
UUID uuid = EntityHuman.a(new GameProfile((UUID) null, s));
|
||||
|
||||
gameprofile = new GameProfile(uuid, s);
|
@ -1,84 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alfie Cleveland <alfeh@me.com>
|
||||
Date: Fri, 19 Aug 2016 01:52:56 +0100
|
||||
Subject: [PATCH] Optimise BlockState's hashCode/equals
|
||||
|
||||
These are singleton "single instance" objects. We can rely on
|
||||
object identity checks safely.
|
||||
|
||||
Use a simpler optimized hashcode
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java
|
||||
index 0701c1a178852345b6bf01bce8b1d0559c535d45..f2f94950681b198ae7a4c31a044fd62e98e448ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java
|
||||
@@ -30,8 +30,7 @@ public class BlockStateBoolean extends IBlockState<Boolean> {
|
||||
return obool.toString();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public boolean equals(Object object) {
|
||||
+ public boolean equals_unused(Object object) { // Paper
|
||||
if (this == object) {
|
||||
return true;
|
||||
} else if (object instanceof BlockStateBoolean && super.equals(object)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java
|
||||
index de85894beae7ee7d276cf2af3daa77377ce131c3..3079cd13ea1465f4221fde4fec7df639f7c1eb49 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java
|
||||
@@ -50,8 +50,7 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends IBlockState<T>
|
||||
return ((INamable) t0).getName();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public boolean equals(Object object) {
|
||||
+ public boolean equals_unused(Object object) { // Paper
|
||||
if (this == object) {
|
||||
return true;
|
||||
} else if (object instanceof BlockStateEnum && super.equals(object)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java
|
||||
index 518c2ebe4cdfe4704bbec2abe81522cbca38da55..190978c889222185b47065e9e5f96a82e59c7b4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java
|
||||
@@ -38,8 +38,7 @@ public class BlockStateInteger extends IBlockState<Integer> {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public boolean equals(Object object) {
|
||||
+ public boolean equals_unused(Object object) { // Paper
|
||||
if (this == object) {
|
||||
return true;
|
||||
} else if (object instanceof BlockStateInteger && super.equals(object)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java
|
||||
index e3969bad5be64bb41e2973751605d6820c16f021..759d6a4adaa511488ace5e2650eb685cbb6c4c16 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java
|
||||
@@ -60,23 +60,17 @@ public abstract class IBlockState<T extends Comparable<T>> {
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
- if (this == object) {
|
||||
- return true;
|
||||
- } else if (!(object instanceof IBlockState)) {
|
||||
- return false;
|
||||
- } else {
|
||||
- IBlockState<?> iblockstate = (IBlockState) object;
|
||||
-
|
||||
- return this.a.equals(iblockstate.a) && this.b.equals(iblockstate.b);
|
||||
- }
|
||||
+ return this == object; // Paper - only one instance per configuration
|
||||
}
|
||||
|
||||
+ private static final java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1); // Paper - only one instance per configuration
|
||||
+ private final int hashCode = 92821 * hashId.getAndIncrement(); // Paper - only one instance per configuration
|
||||
public final int hashCode() {
|
||||
if (this.c == null) {
|
||||
this.c = this.b();
|
||||
}
|
||||
|
||||
- return this.c;
|
||||
+ return this.hashCode; // Paper - only one instance per configuration
|
||||
}
|
||||
|
||||
public int b() {
|
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 21 Sep 2016 22:54:28 -0400
|
||||
Subject: [PATCH] Chunk registration fixes
|
||||
|
||||
World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated
|
||||
|
||||
Keep them consistent
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
index e008ef98d6902f5e1000da99870b12ae9d61bddb..6137a88e1dc8d19a4e35ad97500dabeddba008a8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
|
||||
@@ -847,7 +847,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
if (entity.cl()) {
|
||||
this.getMethodProfiler().enter("chunkCheck");
|
||||
int i = MathHelper.floor(entity.locX() / 16.0D);
|
||||
- int j = MathHelper.floor(entity.locY() / 16.0D);
|
||||
+ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
|
||||
int k = MathHelper.floor(entity.locZ() / 16.0D);
|
||||
|
||||
if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) {
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 21 Sep 2016 23:48:39 -0400
|
||||
Subject: [PATCH] Auto fix bad Y levels on player login
|
||||
|
||||
Bring down to a saner Y level if super high, as this can cause the server to crash
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
index 3f1f8f7fe9452f66b18a08ef480d50ef78ad3351..3fca9c3566b5d9a1fafeb0700942d7658cd5a279 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -340,6 +340,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
@Override
|
||||
public void loadData(NBTTagCompound nbttagcompound) {
|
||||
super.loadData(nbttagcompound);
|
||||
+ if (this.locY() > 300) this.setPositionRaw(locX(), 257, locZ()); // Paper - bring down to a saner Y level if out of world
|
||||
if (nbttagcompound.hasKeyOfType("playerGameType", 99)) {
|
||||
if (this.getMinecraftServer().getForceGamemode()) {
|
||||
this.playerInteractManager.a(this.getMinecraftServer().getGamemode(), EnumGamemode.NOT_SET);
|
@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaBlend <whizkid3000@hotmail.com>
|
||||
Date: Sun, 16 Oct 2016 23:19:30 -0700
|
||||
Subject: [PATCH] Add EntityZapEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java
|
||||
index cc31c8f31a385f3a8bfe334e75c3553689397750..d6e1697f64e60f2a567288c604a1690159955f37 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java
|
||||
@@ -255,6 +255,11 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
|
||||
}
|
||||
|
||||
entitypigzombie.setPersistent();
|
||||
+ // Paper start
|
||||
+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
// CraftBukkit start
|
||||
if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
index 651ee45431c22b944fac640f936608ae587c055d..6df58fe8084d866de1697ef3fdbfe6648fe42b5f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
@@ -787,6 +787,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
EntityVillager.LOGGER.info("Villager {} was struck by lightning {}.", this, entitylightning);
|
||||
EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a((World) worldserver);
|
||||
|
||||
+ // Paper start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch);
|
||||
entitywitch.prepare(worldserver, worldserver.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitywitch.setNoAI(this.isNoAI());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 8a7511fc1876dc6761826dd2636bce19d177d2e8..aa484fb733e87c17cc77e56b36f6e1126e8ca4cf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1098,6 +1098,14 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static com.destroystokyo.paper.event.entity.EntityZapEvent callEntityZapEvent (Entity entity, Entity lightning, Entity changedEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.EntityZapEvent event = new com.destroystokyo.paper.event.entity.EntityZapEvent(entity.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), changedEntity.getBukkitEntity());
|
||||
+ entity.getBukkitEntity().getServer().getPluginManager().callEvent(event);
|
||||
+ return event;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static HorseJumpEvent callHorseJumpEvent(Entity horse, float power) {
|
||||
HorseJumpEvent event = new HorseJumpEvent((AbstractHorse) horse.getBukkitEntity(), power);
|
||||
horse.getBukkitEntity().getServer().getPluginManager().callEvent(event);
|
@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Sat, 12 Nov 2016 23:25:22 -0600
|
||||
Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 622affa0dc3cc1eadaed400511f2ca2cde3fca2a..e83216be5a00d5b927d8c2fc364551bd3077c974 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -2,6 +2,7 @@ package com.destroystokyo.paper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.spigotmc.SpigotWorldConfig;
|
||||
|
||||
@@ -305,4 +306,12 @@ public class PaperWorldConfig {
|
||||
private void removeCorruptTEs() {
|
||||
removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false);
|
||||
}
|
||||
+
|
||||
+ public boolean filterNBTFromSpawnEgg = true;
|
||||
+ private void fitlerNBTFromSpawnEgg() {
|
||||
+ filterNBTFromSpawnEgg = getBoolean("filter-nbt-data-from-spawn-eggs-and-related", true);
|
||||
+ if (!filterNBTFromSpawnEgg) {
|
||||
+ Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
index 3f10e41b18e09186635fd6f7c653b04db7b39d8e..411e3915c0aa00249aacb6658ed04309665d2fb4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
@@ -272,6 +272,13 @@ public class EntityFallingBlock extends Entity {
|
||||
@Override
|
||||
protected void loadData(NBTTagCompound nbttagcompound) {
|
||||
this.block = GameProfileSerializer.c(nbttagcompound.getCompound("BlockState"));
|
||||
+ // Paper start - Block FallingBlocks with Command Blocks
|
||||
+ // Check mappings on update - dc = "repeating_command_block" - dd = "chain_command_block"
|
||||
+ final Block b = this.block.getBlock();
|
||||
+ if (this.world.paperConfig.filterNBTFromSpawnEgg && (b == Blocks.COMMAND_BLOCK || b == Blocks.REPEATING_COMMAND_BLOCK || b == Blocks.CHAIN_COMMAND_BLOCK)) {
|
||||
+ this.block = Blocks.STONE.getBlockData();
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.ticksLived = nbttagcompound.getInt("Time");
|
||||
if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) {
|
||||
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");
|
@ -1,68 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: vemacs <d@nkmem.es>
|
||||
Date: Wed, 23 Nov 2016 08:31:45 -0500
|
||||
Subject: [PATCH] Cache user authenticator threads
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
index 3fca9c3566b5d9a1fafeb0700942d7658cd5a279..e6dacf68cd678d64547dcdc23b1175a4cfd279d1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -4,7 +4,9 @@ import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.datafixers.util.Either;
|
||||
import com.mojang.serialization.DataResult;
|
||||
+import java.util.ArrayDeque; // Paper
|
||||
import java.util.Collection;
|
||||
+import java.util.Deque; // Paper
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -172,7 +174,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public PlayerConnection playerConnection;
|
||||
public final MinecraftServer server;
|
||||
public final PlayerInteractManager playerInteractManager;
|
||||
- public final List<Integer> removeQueue = Lists.newLinkedList();
|
||||
+ public final Deque<Integer> removeQueue = new ArrayDeque<>(); // Paper
|
||||
private final AdvancementDataPlayer advancementDataPlayer;
|
||||
private final ServerStatisticManager serverStatisticManager;
|
||||
private float lastHealthScored = Float.MIN_VALUE;
|
||||
@@ -550,13 +552,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
while (!this.removeQueue.isEmpty()) {
|
||||
int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE);
|
||||
int[] aint = new int[i];
|
||||
- Iterator<Integer> iterator = this.removeQueue.iterator();
|
||||
+ //Iterator<Integer> iterator = this.removeQueue.iterator(); // Paper
|
||||
int j = 0;
|
||||
|
||||
- while (iterator.hasNext() && j < i) {
|
||||
+ // Paper start
|
||||
+ /* while (iterator.hasNext() && j < i) {
|
||||
aint[j++] = (Integer) iterator.next();
|
||||
iterator.remove();
|
||||
+ } */
|
||||
+
|
||||
+ Integer integer;
|
||||
+ while (j < i && (integer = this.removeQueue.poll()) != null) {
|
||||
+ aint[j++] = integer.intValue();
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint));
|
||||
}
|
||||
@@ -1561,7 +1570,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
// this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit
|
||||
- this.removeQueue.addAll(entityplayer.removeQueue);
|
||||
+ // Paper start - Optimize remove queue - vanilla copies player objects, but CB doesn't. This method currently only
|
||||
+ // Applies to the same player, so we need to not duplicate our removal queue. The rest of this method does "resetting"
|
||||
+ // type logic so it does need to be called, maybe? This is silly.
|
||||
+ // this.removeQueue.addAll(entityplayer.removeQueue);
|
||||
+ if (this.removeQueue != entityplayer.removeQueue) {
|
||||
+ this.removeQueue.addAll(entityplayer.removeQueue);
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.cd = entityplayer.cd;
|
||||
this.ci = entityplayer.ci;
|
||||
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
|
@ -1,67 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alfie Cleveland <alfeh@me.com>
|
||||
Date: Fri, 25 Nov 2016 13:22:40 +0000
|
||||
Subject: [PATCH] Optimise removeQueue
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 49a0aefc7f9544b36175fdf3161b255e878952a6..c45647f2d05ed6b170aad10c0a3fb94570d2dd90 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -116,6 +116,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start - Cache authenticator threads
|
||||
+ private static final AtomicInteger threadId = new AtomicInteger(0);
|
||||
+ private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(
|
||||
+ r -> new Thread(r, "User Authenticator #" + threadId.incrementAndGet())
|
||||
+ );
|
||||
+ // Paper end
|
||||
// Spigot start
|
||||
public void initUUID()
|
||||
{
|
||||
@@ -195,8 +201,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.e));
|
||||
} else {
|
||||
// Spigot start
|
||||
- new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
|
||||
-
|
||||
+ // Paper start - Cache authenticator threads
|
||||
+ authenticatorPool.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -207,7 +213,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex);
|
||||
}
|
||||
}
|
||||
- }.start();
|
||||
+ });
|
||||
+ // Paper end
|
||||
// Spigot end
|
||||
}
|
||||
|
||||
@@ -236,7 +243,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
throw new IllegalStateException("Protocol error", cryptographyexception);
|
||||
}
|
||||
|
||||
- Thread thread = new Thread("User Authenticator #" + LoginListener.b.incrementAndGet()) {
|
||||
+ // Paper start - Cache authenticator threads
|
||||
+ authenticatorPool.execute(new Runnable() {
|
||||
public void run() {
|
||||
GameProfile gameprofile = LoginListener.this.i;
|
||||
|
||||
@@ -281,10 +289,8 @@ public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
return LoginListener.this.server.W() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null;
|
||||
}
|
||||
- };
|
||||
-
|
||||
- thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LoginListener.LOGGER));
|
||||
- thread.start();
|
||||
+ });
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
// Spigot start
|
@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaBlend <whizkid3000@hotmail.com>
|
||||
Date: Thu, 8 Sep 2016 08:48:33 -0700
|
||||
Subject: [PATCH] Add source to PlayerExpChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
index a52cd6d0318e0fee28fc5d252a4b596b92860320..a17812943b5402684c68ddeac5408dc939e42cf6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -203,7 +203,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
}
|
||||
|
||||
if (this.value > 0) {
|
||||
- entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
||||
+ entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this).getAmount()); // CraftBukkit - this.value -> event.getAmount() // Paper - supply experience orb object
|
||||
}
|
||||
|
||||
this.die();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index aa484fb733e87c17cc77e56b36f6e1126e8ca4cf..6bee8bcd653737748c442b03a8ce3bedc57dff20 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -121,6 +121,7 @@ import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.Vehicle;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Villager.Profession;
|
||||
+import org.bukkit.entity.ExperienceOrb; // Paper
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Result;
|
||||
@@ -1057,6 +1058,17 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
+ // Paper start - Add orb
|
||||
+ public static PlayerExpChangeEvent callPlayerExpChangeEvent(EntityHuman entity, EntityExperienceOrb entityOrb) {
|
||||
+ Player player = (Player) entity.getBukkitEntity();
|
||||
+ ExperienceOrb source = (ExperienceOrb) entityOrb.getBukkitEntity();
|
||||
+ int expAmount = source.getExperience();
|
||||
+ PlayerExpChangeEvent event = new PlayerExpChangeEvent(player, source, expAmount);
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ return event;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static boolean handleBlockGrowEvent(World world, BlockPosition pos, IBlockData block) {
|
||||
return handleBlockGrowEvent(world, pos, block, 3);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Fri, 16 Dec 2016 16:03:19 -0600
|
||||
Subject: [PATCH] Don't let fishinghooks use portals
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
index bcc411107d531529dbce9d1d43896a3c70e63012..57e7b9c7f7f43666d442648120cda3b4b3e5bfb2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
@@ -240,6 +240,11 @@ public class EntityFishingHook extends IProjectile {
|
||||
|
||||
this.setMot(this.getMot().a(0.92D));
|
||||
this.af();
|
||||
+ // Paper start - These shouldn't be going through portals
|
||||
+ if (this.inPortal) {
|
||||
+ this.die();
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
|
@ -1,109 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Fri, 16 Dec 2016 21:25:39 -0600
|
||||
Subject: [PATCH] Add ProjectileCollideEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
index 7868259a94766a6100d7b278c4296dde0a7f9397..c325c9fe680d9033b20909bcd6100ecc4b0195f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
@@ -198,6 +198,17 @@ public abstract class EntityArrow extends IProjectile {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ // TODO: flag - noclip - call cancelled?
|
||||
+ if (object instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)object);
|
||||
+ if (event.isCancelled()) {
|
||||
+ object = null;
|
||||
+ movingobjectpositionentity = null;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
if (object != null && !flag) {
|
||||
this.preOnHit((MovingObjectPosition) object); // CraftBukkit - projectile hit event
|
||||
this.impulse = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
index 2ceae34365c437f2a15ae8587fa9517ea47ad6f2..9660dc2263c48a5818b767843658eeb9ee1748ea 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.world.entity.EntityLiving;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
+import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
@@ -72,7 +73,16 @@ public abstract class EntityFireball extends IProjectile {
|
||||
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a);
|
||||
|
||||
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
|
||||
+ if (event.isCancelled()) {
|
||||
+ movingobjectposition = null;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
|
||||
this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
|
||||
// CraftBukkit start - Fire ProjectileHitEvent
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
index 149588433cd0ea0f71b45267e39b28697ccfd2c0..8bc65e9c0fa5e134a8eb4e03f0da5b2ccd06cd7c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.level.block.entity.TileEntityEndGateway;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
+import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
public abstract class EntityProjectile extends IProjectile {
|
||||
@@ -57,7 +58,17 @@ public abstract class EntityProjectile extends IProjectile {
|
||||
}
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && !flag) {
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
|
||||
+ if (event.isCancelled()) {
|
||||
+ movingobjectposition = null;
|
||||
+ }
|
||||
+ }
|
||||
+ if (movingobjectposition != null) {
|
||||
+ // Paper end
|
||||
this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
+ } // Paper
|
||||
}
|
||||
|
||||
this.checkBlockCollisions();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 6bee8bcd653737748c442b03a8ce3bedc57dff20..d07c146119980358aeaf8f9dc5f419fd1385ced5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1202,6 +1202,16 @@ public class CraftEventFactory {
|
||||
return CraftItemStack.asNMSCopy(bitem);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, MovingObjectPositionEntity position) {
|
||||
+ Projectile projectile = (Projectile) entity.getBukkitEntity();
|
||||
+ org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ return event;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) {
|
||||
Projectile bukkitEntity = (Projectile) entity.getBukkitEntity();
|
||||
ProjectileLaunchEvent event = new ProjectileLaunchEvent(bukkitEntity);
|
@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 19 Dec 2016 23:07:42 -0500
|
||||
Subject: [PATCH] Prevent Pathfinding out of World Border
|
||||
|
||||
This prevents Entities from trying to run outside of the World Border
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
index d71a6e5991629ce59c8529d7cc8064960e385236..d134333c736dc1ee1c722d680d7a9c22c1b265bd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java
|
||||
@@ -148,7 +148,7 @@ public abstract class NavigationAbstract {
|
||||
// Paper start - Pathfind event
|
||||
boolean copiedSet = false;
|
||||
for (BlockPosition possibleTarget : set) {
|
||||
- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
|
||||
+ if (!getEntity().getWorld().getWorldBorder().isInBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), // Paper - don't path out of world border
|
||||
MCUtil.toLocation(getEntity().world, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||
if (!copiedSet) {
|
||||
copiedSet = true;
|
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 2 Dec 2016 00:11:43 -0500
|
||||
Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
|
||||
|
||||
Reduce method invocations for World.isLoaded(BlockPosition)Z
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index d8ab2e22a5c0144decb5c657a123cc61722fcbf5..bd08ff18d8d7dbe63ed33c1efb6099b58aa02caa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -305,6 +305,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
return chunk == null ? null : chunk.getFluid(blockposition);
|
||||
}
|
||||
|
||||
+ public final boolean isLoaded(BlockPosition blockposition) {
|
||||
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; // Paper
|
||||
+ }
|
||||
+
|
||||
public final boolean isLoadedAndInBounds(BlockPosition blockposition) { // Paper - final for inline
|
||||
return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 20 Dec 2016 15:15:11 -0500
|
||||
Subject: [PATCH] Bound Treasure Maps to World Border
|
||||
|
||||
Make it so a Treasure Map does not target a structure outside of the
|
||||
World Border, where players are not even able to reach.
|
||||
|
||||
This also would help the case where a players close to the border, and one
|
||||
that is outside happens to be closer, but unreachable, yet another reachable
|
||||
one is in border that would of been missed.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
index f16c76df5d7b184d57f4cc397f069eac9cc430cb..50e2085766caabec1125ca24a2117549efd1a354 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
@@ -36,6 +36,18 @@ public class WorldBorder {
|
||||
return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private final BlockPosition.MutableBlockPosition mutPos = new BlockPosition.MutableBlockPosition();
|
||||
+ public boolean isBlockInBounds(int chunkX, int chunkZ) {
|
||||
+ this.mutPos.setValues(chunkX, 64, chunkZ);
|
||||
+ return this.isInBounds(this.mutPos);
|
||||
+ }
|
||||
+ public boolean isChunkInBounds(int chunkX, int chunkZ) {
|
||||
+ this.mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
|
||||
+ return this.isInBounds(this.mutPos);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) {
|
||||
return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java
|
||||
index 6724927be178cb9a358a9276d01894a63154b7b3..ea7e3e15fa778c573d24f956f72f60579ea0b1a1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java
|
||||
@@ -175,6 +175,7 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration>
|
||||
int i2 = l + k * k1;
|
||||
int j2 = i1 + k * l1;
|
||||
ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2);
|
||||
+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper
|
||||
IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS);
|
||||
StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess);
|
||||
|
@ -1,81 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Wed, 21 Dec 2016 11:47:25 -0600
|
||||
Subject: [PATCH] Add API methods to control if armour stands can move
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
index 0631cd531647239858b2a7298f58cc770720f69a..6ee5e1b0bb34ba490a130fbcbdb7a2706c5ecf86 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -38,6 +38,7 @@ import net.minecraft.world.entity.ai.control.ControllerLook;
|
||||
import net.minecraft.world.entity.ai.control.ControllerMove;
|
||||
import net.minecraft.world.entity.ai.control.EntityAIBodyControl;
|
||||
import net.minecraft.world.entity.ai.goal.PathfinderGoal;
|
||||
+import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat;
|
||||
import net.minecraft.world.entity.ai.goal.PathfinderGoalSelector;
|
||||
import net.minecraft.world.entity.ai.navigation.Navigation;
|
||||
import net.minecraft.world.entity.ai.navigation.NavigationAbstract;
|
||||
@@ -45,6 +46,8 @@ import net.minecraft.world.entity.ai.sensing.EntitySenses;
|
||||
import net.minecraft.world.entity.decoration.EntityHanging;
|
||||
import net.minecraft.world.entity.decoration.EntityLeash;
|
||||
import net.minecraft.world.entity.item.EntityItem;
|
||||
+import net.minecraft.world.entity.monster.EntityBlaze;
|
||||
+import net.minecraft.world.entity.monster.EntityEnderman;
|
||||
import net.minecraft.world.entity.monster.IMonster;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.entity.vehicle.EntityBoat;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
index 72e53968c5fb03301ddec7a0cf937ac2f8cf0901..2ef991aa7f739d3577fbbf4386064557e8f7c904 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.world.entity.EntitySize;
|
||||
import net.minecraft.world.entity.EntityTypes;
|
||||
import net.minecraft.world.entity.EnumItemSlot;
|
||||
import net.minecraft.world.entity.EnumMainHand;
|
||||
+import net.minecraft.world.entity.EnumMoveType;
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.entity.projectile.EntityArrow;
|
||||
import net.minecraft.world.entity.vehicle.EntityMinecartAbstract;
|
||||
@@ -79,6 +80,7 @@ public class EntityArmorStand extends EntityLiving {
|
||||
public Vector3f rightArmPose;
|
||||
public Vector3f leftLegPose;
|
||||
public Vector3f rightLegPose;
|
||||
+ public boolean canMove = true; // Paper
|
||||
|
||||
public EntityArmorStand(EntityTypes<? extends EntityArmorStand> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -862,4 +864,13 @@ public class EntityArmorStand extends EntityLiving {
|
||||
private EntitySize s(boolean flag) {
|
||||
return flag ? EntityArmorStand.bp : (this.isBaby() ? EntityArmorStand.bq : this.getEntityType().l());
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void move(EnumMoveType moveType, Vec3D vec3d) {
|
||||
+ if (this.canMove) {
|
||||
+ super.move(moveType, vec3d);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
index 86c8662b3864b264e26f8c63474fdd39bd6c873c..6f922e4cbb095439fcd76ee0d0c08bc4160b8107 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java
|
||||
@@ -229,4 +229,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand {
|
||||
public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) {
|
||||
return (getHandle().disabledSlots & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).getSlotFlag() + lockType.ordinal() * 8)) != 0;
|
||||
}
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean canMove() {
|
||||
+ return getHandle().canMove;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanMove(boolean move) {
|
||||
+ getHandle().canMove = move;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Alfie Cleveland <alfeh@me.com>
|
||||
Date: Tue, 27 Dec 2016 01:57:57 +0000
|
||||
Subject: [PATCH] Properly fix item duplication bug
|
||||
|
||||
Credit to prplz for figuring out the real issue
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
index e6dacf68cd678d64547dcdc23b1175a4cfd279d1..5b2ae94ed7d499e401a058691eb6ed413b626150 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -2069,8 +2069,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean isFrozen() {
|
||||
- return super.isFrozen() || !getBukkitEntity().isOnline();
|
||||
+ protected boolean isFrozen() {
|
||||
+ return super.isFrozen() || (this.playerConnection != null && this.playerConnection.isDisconnected()); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
index 15daf87d6a6d80b5ebce5360e6999fd604c66cb5..d507d050f9a1ebd65383adb2b21699a01d9b0385 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -2820,7 +2820,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
}
|
||||
|
||||
public final boolean isDisconnected() {
|
||||
- return !this.player.joining && !this.networkManager.isConnected();
|
||||
+ return (!this.player.joining && !this.networkManager.isConnected()) || this.processedDisconnect; // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -1,48 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 27 Dec 2016 15:02:42 -0500
|
||||
Subject: [PATCH] String based Action Bar API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java
|
||||
index c8bb06a31242089ad950713bd5f94abbfe12adc8..68ce7605bd63ea280b96db8230463d2afb0a6cb1 100644
|
||||
--- a/src/main/java/net/minecraft/SystemUtils.java
|
||||
+++ b/src/main/java/net/minecraft/SystemUtils.java
|
||||
@@ -58,7 +58,7 @@ public class SystemUtils {
|
||||
private static final ExecutorService e = a("Main");
|
||||
private static final ExecutorService f = n();
|
||||
public static LongSupplier a = System::nanoTime;
|
||||
- public static final UUID b = new UUID(0L, 0L);
|
||||
+ public static final UUID b = new UUID(0L, 0L); public static final UUID getNullUUID() {return b;} // Paper OBFHELPER
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public static <K, V> Collector<Entry<? extends K, ? extends V>, ?, Map<K, V>> a() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 6d7f1dee9ae2fb0b9620d85969de86eee09020cc..c3058d6fca2fd58aea5001e4310592aa8bd20640 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -244,6 +244,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
// Paper start
|
||||
+ @Override
|
||||
+ public void sendActionBar(BaseComponent[] message) {
|
||||
+ if (getHandle().playerConnection == null) return;
|
||||
+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.ACTIONBAR, message, -1, -1, -1));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendActionBar(String message) {
|
||||
+ if (getHandle().playerConnection == null || message == null || message.isEmpty()) return;
|
||||
+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.ACTIONBAR, CraftChatMessage.fromStringOrNull(message)));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void sendActionBar(char alternateChar, String message) {
|
||||
+ if (message == null || message.isEmpty()) return;
|
||||
+ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message));
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) {
|
||||
if (header != null) {
|
@ -1,124 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 28 Dec 2016 07:18:33 +0100
|
||||
Subject: [PATCH] Firework API's
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java
|
||||
index bf4826e90976fed2ae95e84cadc7f29433af1ddf..d5508deff819309034554abc7b36aac40fa33503 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java
|
||||
@@ -153,6 +153,7 @@ public class NBTTagCompound implements NBTBase {
|
||||
return GameProfileSerializer.a(this.get(s));
|
||||
}
|
||||
|
||||
+ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER
|
||||
public boolean b(String s) {
|
||||
NBTBase nbtbase = this.get(s);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
index 2df84b56ef35a18648e74a134ac7ab97c518e481..9cc59439ae2c4e758c44b2a92b78bc328efdfa1b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java
|
||||
@@ -38,7 +38,8 @@ public class EntityFireworks extends IProjectile {
|
||||
public static final DataWatcherObject<Boolean> SHOT_AT_ANGLE = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i);
|
||||
private int ticksFlown;
|
||||
public int expectedLifespan;
|
||||
- private EntityLiving ridingEntity;
|
||||
+ public EntityLiving ridingEntity; // Paper - public
|
||||
+ public java.util.UUID spawningEntity; // Paper
|
||||
|
||||
public EntityFireworks(EntityTypes<? extends EntityFireworks> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -285,6 +286,11 @@ public class EntityFireworks extends IProjectile {
|
||||
}
|
||||
|
||||
nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.SHOT_AT_ANGLE));
|
||||
+ // Paper start
|
||||
+ if (this.spawningEntity != null) {
|
||||
+ nbttagcompound.setUUID("SpawningEntity", this.spawningEntity);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -301,7 +307,11 @@ public class EntityFireworks extends IProjectile {
|
||||
if (nbttagcompound.hasKey("ShotAtAngle")) {
|
||||
this.datawatcher.set(EntityFireworks.SHOT_AT_ANGLE, nbttagcompound.getBoolean("ShotAtAngle"));
|
||||
}
|
||||
-
|
||||
+ // Paper start
|
||||
+ if (nbttagcompound.hasUUID("SpawningEntity")) {
|
||||
+ this.spawningEntity = nbttagcompound.getUUID("SpawningEntity");
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemCrossbow.java b/src/main/java/net/minecraft/world/item/ItemCrossbow.java
|
||||
index d52f3cb5d76bde1cf29c654dade6d8379b44c2e5..ec6c0836f02e7ac5b72fd224a3022a844dce55cb 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemCrossbow.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemCrossbow.java
|
||||
@@ -205,6 +205,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable
|
||||
|
||||
if (flag1) {
|
||||
object = new EntityFireworks(world, itemstack1, entityliving, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true);
|
||||
+ ((EntityFireworks) object).spawningEntity = entityliving.getUniqueID(); // Paper
|
||||
} else {
|
||||
object = a(world, entityliving, itemstack, itemstack1);
|
||||
if (flag || f3 != 0.0F) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
||||
index 9153945c2e245b9a2a098bdf58b0dcab052084ff..a2950faa48021782f10db0673d12d178443f7ccc 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java
|
||||
@@ -27,6 +27,7 @@ public class ItemFireworks extends Item {
|
||||
Vec3D vec3d = itemactioncontext.getPos();
|
||||
EnumDirection enumdirection = itemactioncontext.getClickedFace();
|
||||
EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack);
|
||||
+ entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
|
||||
|
||||
world.addEntity(entityfireworks);
|
||||
itemstack.subtract(1);
|
||||
@@ -41,7 +42,11 @@ public class ItemFireworks extends Item {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
|
||||
if (!world.isClientSide) {
|
||||
- world.addEntity(new EntityFireworks(world, itemstack, entityhuman));
|
||||
+ // Paper start
|
||||
+ final EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman);
|
||||
+ entityfireworks.spawningEntity = entityhuman.getUniqueID();
|
||||
+ world.addEntity(entityfireworks);
|
||||
+ // Paper end
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
itemstack.subtract(1);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
index 33162fd419ab9a7b650ca9d4270a0c03f06f19f6..73c2da316e41329114fcb3d30cb009d9cc7de7b9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import java.util.Random;
|
||||
+import net.minecraft.world.entity.EntityLiving;
|
||||
import net.minecraft.world.entity.projectile.EntityFireworks;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
@@ -78,4 +79,17 @@ public class CraftFirework extends CraftProjectile implements Firework {
|
||||
public void setShotAtAngle(boolean shotAtAngle) {
|
||||
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public java.util.UUID getSpawningEntity() {
|
||||
+ return getHandle().spawningEntity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public org.bukkit.entity.LivingEntity getBoostedEntity() {
|
||||
+ EntityLiving boostedEntity = getHandle().ridingEntity;
|
||||
+ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 7 Jan 2017 15:24:46 -0500
|
||||
Subject: [PATCH] Provide E/TE/Chunk count stat methods
|
||||
|
||||
Provides counts without the ineffeciency of using .getEntities().size()
|
||||
which creates copy of the collections.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 5c488c8a40c648c5c432d38d95d3e00fde2cdb75..642efd930dc6cfad1d9436df97f151ea69b24b0c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -282,6 +282,48 @@ public class CraftWorld implements World {
|
||||
private int waterAmbientSpawn = -1;
|
||||
private int ambientSpawn = -1;
|
||||
|
||||
+ // Paper start - Provide fast information methods
|
||||
+ public int getEntityCount() {
|
||||
+ int ret = 0;
|
||||
+ for (net.minecraft.world.entity.Entity entity : world.entitiesById.values()) {
|
||||
+ if (entity.isChunkLoaded()) {
|
||||
+ ++ret;
|
||||
+ }
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+ public int getTileEntityCount() {
|
||||
+ // We don't use the full world tile entity list, so we must iterate chunks
|
||||
+ Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks;
|
||||
+ int size = 0;
|
||||
+ for (PlayerChunk playerchunk : chunks.values()) {
|
||||
+ net.minecraft.world.level.chunk.Chunk chunk = playerchunk.getChunk();
|
||||
+ if (chunk == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ size += chunk.tileEntities.size();
|
||||
+ }
|
||||
+ return size;
|
||||
+ }
|
||||
+ public int getTickableTileEntityCount() {
|
||||
+ return world.tileEntityListTick.size();
|
||||
+ }
|
||||
+ public int getChunkCount() {
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ for (PlayerChunk chunkHolder : world.getChunkProvider().playerChunkMap.visibleChunks.values()) {
|
||||
+ if (chunkHolder.getChunk() != null) {
|
||||
+ ++ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+ public int getPlayerCount() {
|
||||
+ return world.players.size();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
private static final Random rand = new Random();
|
||||
|
||||
public CraftWorld(WorldServer world, ChunkGenerator gen, Environment env) {
|
@ -1,315 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 19 Dec 2017 16:31:46 -0500
|
||||
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
|
||||
|
||||
Adds lots of information about why this orb exists.
|
||||
|
||||
Replaces isFromBottle() with logic that persists entity reloads too.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
|
||||
index 164fd6b867bc68f6aba3fa2c17371e87495baea3..74b4b127f39a0ad06e8f9add6861763724ab70ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java
|
||||
@@ -409,7 +409,7 @@ public class PlayerInteractManager {
|
||||
|
||||
// Drop event experience
|
||||
if (flag && event != null) {
|
||||
- iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop());
|
||||
+ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop(), this.player); // Paper
|
||||
}
|
||||
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
index a17812943b5402684c68ddeac5408dc939e42cf6..f4da22b33c704e675510b4b1a3aa7c180088be29 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -31,9 +31,59 @@ public class EntityExperienceOrb extends Entity {
|
||||
public int value;
|
||||
private EntityHuman targetPlayer;
|
||||
private int targetTime;
|
||||
+ // Paper start
|
||||
+ public java.util.UUID sourceEntityId;
|
||||
+ public java.util.UUID triggerEntityId;
|
||||
+ public org.bukkit.entity.ExperienceOrb.SpawnReason spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
||||
+
|
||||
+ private void loadPaperNBT(NBTTagCompound nbttagcompound) {
|
||||
+ if (!nbttagcompound.hasKeyOfType("Paper.ExpData", 10)) { // 10 = compound
|
||||
+ return;
|
||||
+ }
|
||||
+ NBTTagCompound comp = nbttagcompound.getCompound("Paper.ExpData");
|
||||
+ if (comp.hasUUID("source")) {
|
||||
+ this.sourceEntityId = comp.getUUID("source");
|
||||
+ }
|
||||
+ if (comp.hasUUID("trigger")) {
|
||||
+ this.triggerEntityId = comp.getUUID("trigger");
|
||||
+ }
|
||||
+ if (comp.hasKey("reason")) {
|
||||
+ String reason = comp.getString("reason");
|
||||
+ try {
|
||||
+ this.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
|
||||
+ } catch (Exception e) {
|
||||
+ this.world.getServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ private void savePaperNBT(NBTTagCompound nbttagcompound) {
|
||||
+ NBTTagCompound comp = new NBTTagCompound();
|
||||
+ if (this.sourceEntityId != null) {
|
||||
+ comp.setUUID("source", this.sourceEntityId);
|
||||
+ }
|
||||
+ if (this.triggerEntityId != null) {
|
||||
+ comp.setUUID("trigger", triggerEntityId);
|
||||
+ }
|
||||
+ if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
|
||||
+ comp.setString("reason", this.spawnReason.name());
|
||||
+ }
|
||||
+ nbttagcompound.set("Paper.ExpData", comp);
|
||||
+ }
|
||||
|
||||
public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) {
|
||||
+ this(world, d0, d1, d2, i, null, null);
|
||||
+ }
|
||||
+
|
||||
+ public EntityExperienceOrb(World world, double d0, double d1, double d2, int i, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId) {
|
||||
+ this(world, d0, d1, d2, i, reason, triggerId, null);
|
||||
+ }
|
||||
+
|
||||
+ public EntityExperienceOrb(World world, double d0, double d1, double d2, int i, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId, Entity sourceId) {
|
||||
this(EntityTypes.EXPERIENCE_ORB, world);
|
||||
+ this.sourceEntityId = sourceId != null ? sourceId.getUniqueID() : null;
|
||||
+ this.triggerEntityId = triggerId != null ? triggerId.getUniqueID() : null;
|
||||
+ this.spawnReason = reason != null ? reason : org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
||||
+ // Paper end
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.yaw = (float) (this.random.nextDouble() * 360.0D);
|
||||
this.setMot((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D);
|
||||
@@ -168,6 +218,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
nbttagcompound.setShort("Health", (short) this.e);
|
||||
nbttagcompound.setShort("Age", (short) this.c);
|
||||
nbttagcompound.setShort("Value", (short) this.value);
|
||||
+ this.savePaperNBT(nbttagcompound); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,6 +226,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
this.e = nbttagcompound.getShort("Health");
|
||||
this.c = nbttagcompound.getShort("Age");
|
||||
this.value = nbttagcompound.getShort("Value");
|
||||
+ this.loadPaperNBT(nbttagcompound); // Paper
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index dc715a0275b148c3c66610d6fb873626180c82d5..b66b340fdef9423ad8dce290065e028a0c135ea8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -1594,7 +1594,8 @@ public abstract class EntityLiving extends Entity {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
i -= j;
|
||||
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j));
|
||||
+ EntityLiving attacker = killer != null ? killer : lastDamager; // Paper
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, this instanceof EntityPlayer ? org.bukkit.entity.ExperienceOrb.SpawnReason.PLAYER_DEATH : org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, attacker, this)); // Paper
|
||||
}
|
||||
this.expToDrop = 0;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java b/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
index 8d0c7469999bb6d75debf427ff4d7fa5d2d5c505..28dd42921961c6a47f2d85a5f93b8298f2c228d3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
@@ -262,7 +262,7 @@ public abstract class EntityAnimal extends EntityAgeable {
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
// CraftBukkit start - use event experience
|
||||
if (experience > 0) {
|
||||
- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience));
|
||||
+ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java
|
||||
index 7941a083353bb1d9ba81c41d7a566b72bdc955d9..459b7727e946679989477f4a7e99c5ca47ac0b30 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java
|
||||
@@ -1306,7 +1306,7 @@ public class EntityFox extends EntityAnimal {
|
||||
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
// CraftBukkit start - use event experience
|
||||
if (experience > 0) {
|
||||
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience));
|
||||
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java
|
||||
index 5d08b83e2832cad2c8726ae817e003d970bc52a0..bf224c97854daa379c61affff6a0ac9524c2c35d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java
|
||||
@@ -561,7 +561,7 @@ public class EntityTurtle extends EntityAnimal {
|
||||
Random random = this.animal.getRandom();
|
||||
|
||||
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), random.nextInt(7) + 1));
|
||||
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), random.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper;
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
index 74802de01dba30e38e09f6fc1f61e7bb64cf5f09..97ef4c65c8cc569a99d9697f56bd44d32b151328 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
@@ -661,7 +661,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
i -= j;
|
||||
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j));
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.killer, this)); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
index 3604fffb9ba13a019e98e0a1a0ef7ba81c8dc329..adce6f17a5dd33004f8a67cd55d195de029e0263 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
@@ -600,7 +600,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
}
|
||||
|
||||
if (merchantrecipe.isRewardExp()) {
|
||||
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i));
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
index 46da22aeef6132a96e413301935c4fef7a96e0ee..4f81a97b1451fec0bb5fd1479acad97846c40c7c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
@@ -189,7 +189,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
|
||||
if (merchantrecipe.isRewardExp()) {
|
||||
int i = 3 + this.random.nextInt(4);
|
||||
|
||||
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i));
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
index 57e7b9c7f7f43666d442648120cda3b4b3e5bfb2..d40b056b2ff14033113bd7108a3295f8783b8bdf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java
|
||||
@@ -503,7 +503,7 @@ public class EntityFishingHook extends IProjectile {
|
||||
this.world.addEntity(entityitem);
|
||||
// CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
|
||||
if (playerFishEvent.getExpToDrop() > 0) {
|
||||
- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop()));
|
||||
+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper
|
||||
}
|
||||
// CraftBukkit end
|
||||
if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java b/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
index 87fe16c81b57ba07399f5566ab8bd77d71db36a1..e07353a6b34196e3d275ba482fbef7e4d209c31d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
@@ -54,7 +54,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
i -= j;
|
||||
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j));
|
||||
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, getShooter(), this)); // Paper
|
||||
}
|
||||
|
||||
this.die();
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java
|
||||
index cba1de50f3035ae1b9366f474745d50a1f8fc014..fad7355a549aef811bca43be198af3d1c0a53980 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java
|
||||
@@ -94,7 +94,7 @@ public class ContainerGrindstone extends Container {
|
||||
int k = EntityExperienceOrb.getOrbValue(j);
|
||||
|
||||
j -= k;
|
||||
- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k));
|
||||
+ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper
|
||||
}
|
||||
|
||||
world.triggerEffect(1042, blockposition, 0);
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java b/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java
|
||||
index 48324295913dd9a9bd31332b5b811a729b621dfb..a114e576e5d80c25cc7f2b17f0dc3ad706a1b877 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.world.level.block.entity.TileEntityFurnace;
|
||||
|
||||
public class SlotFurnaceResult extends Slot {
|
||||
|
||||
- private final EntityHuman a;
|
||||
+ private final EntityHuman a; public final EntityHuman getPlayer() { return this.a; } // Paper OBFHELPER
|
||||
private int b;
|
||||
|
||||
public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index d285c4e3d9f938973bf7fb904680044b414e6236..615a4418fd276cd3e0b3686d962ebaf13ef5d4be 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -267,13 +267,13 @@ public class Block extends BlockBase implements IMaterial {
|
||||
}
|
||||
}
|
||||
|
||||
- public void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i) {
|
||||
+ public void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i, net.minecraft.server.level.EntityPlayer player) { // Paper
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) {
|
||||
while (i > 0) {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
i -= j;
|
||||
- worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j));
|
||||
+ worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java
|
||||
index 9744d51a52c5eb99c4cf9e36d9380c49674dd136..deaa4c136c23dc6c258cc1ce68523b3c007c80f9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java
|
||||
@@ -603,7 +603,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
int k = EntityExperienceOrb.getOrbValue(j);
|
||||
|
||||
j -= k;
|
||||
- world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k));
|
||||
+ world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index ccd110c4bfaa263e04154dcc2a5bdbff1f3a7ec2..2513e9a5b66598337f5d380a036ee10fdbab38c3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1835,7 +1835,7 @@ public class CraftWorld implements World {
|
||||
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
||||
entity = new EntityTNTPrimed(world, x, y, z, null);
|
||||
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
|
||||
- entity = new EntityExperienceOrb(world, x, y, z, 0);
|
||||
+ entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
|
||||
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
|
||||
entity = EntityTypes.LIGHTNING_BOLT.a(world);
|
||||
} else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
index da14f59aec2b6854c3a47fb531aadc9ddb74954c..c6880830720baa2723ab003e51be1b48574d7319 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
@@ -20,6 +20,18 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
|
||||
getHandle().value = value;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public java.util.UUID getTriggerEntityId() {
|
||||
+ return getHandle().triggerEntityId;
|
||||
+ }
|
||||
+ public java.util.UUID getSourceEntityId() {
|
||||
+ return getHandle().sourceEntityId;
|
||||
+ }
|
||||
+ public SpawnReason getSpawnReason() {
|
||||
+ return getHandle().spawnReason;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public EntityExperienceOrb getHandle() {
|
||||
return (EntityExperienceOrb) entity;
|
@ -1,47 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Brokkonaut <hannos17@gmx.de>
|
||||
Date: Tue, 7 Feb 2017 16:55:35 -0600
|
||||
Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
index e8150c456efe72a561d6a6a7647eca05fbc8bd94..56f83a930c3dad1a1de366bff530131d92b4893c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -121,7 +121,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
private final PlayerMap playerMap;
|
||||
public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities;
|
||||
private final Long2ByteMap z;
|
||||
- private final Queue<Runnable> A;
|
||||
+ private final Queue<Runnable> A; private final Queue<Runnable> getUnloadQueueTasks() { return this.A; } // Paper - OBFHELPER
|
||||
private int viewDistance;
|
||||
|
||||
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
|
||||
@@ -179,7 +179,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
this.playerMap = new PlayerMap();
|
||||
this.trackedEntities = new Int2ObjectOpenHashMap();
|
||||
this.z = new Long2ByteOpenHashMap();
|
||||
- this.A = Queues.newConcurrentLinkedQueue();
|
||||
+ this.A = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size()
|
||||
this.definedStructureManager = definedstructuremanager;
|
||||
this.w = convertable_conversionsession.a(worldserver.getDimensionKey());
|
||||
this.world = worldserver;
|
||||
@@ -437,7 +437,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
// Spigot start
|
||||
org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant;
|
||||
activityAccountant.startActivity(0.5);
|
||||
- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR);
|
||||
+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive
|
||||
// Spigot end
|
||||
while (longiterator.hasNext()) { // Spigot
|
||||
long j = longiterator.nextLong();
|
||||
@@ -459,7 +459,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
||||
Runnable runnable;
|
||||
|
||||
- while ((booleansupplier.getAsBoolean() || this.A.size() > 2000) && (runnable = (Runnable) this.A.poll()) != null) {
|
||||
+ int queueTarget = Math.min(this.getUnloadQueueTasks().size() - 100, (int) (this.getUnloadQueueTasks().size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Target this queue as well
|
||||
+ while ((booleansupplier.getAsBoolean() || this.getUnloadQueueTasks().size() > queueTarget) && (runnable = (Runnable)this.getUnloadQueueTasks().poll()) != null) { // Paper - Target this queue as well
|
||||
runnable.run();
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Sat, 18 Feb 2017 19:29:58 -0600
|
||||
Subject: [PATCH] Do not let armorstands drown
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index 2eee92f74a7c82ec7df05db6df79743b4345cc86..3d6b8fd09c07e78c0d786dff9658eb0089f853cf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -338,6 +338,7 @@ public abstract class EntityLiving extends Entity {
|
||||
super.a(d0, flag, iblockdata, blockposition);
|
||||
}
|
||||
|
||||
+ public boolean canBreatheUnderwater() { return this.cM(); } // Paper - OBFHELPER
|
||||
public boolean cM() {
|
||||
return this.getMonsterType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
@@ -381,7 +382,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
if (this.isAlive()) {
|
||||
if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) {
|
||||
- if (!this.cM() && !MobEffectUtil.c(this) && !flag1) {
|
||||
+ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden
|
||||
this.setAirTicks(this.l(this.getAirTicks()));
|
||||
if (this.getAirTicks() == -20) {
|
||||
this.setAirTicks(0);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
index 2ef991aa7f739d3577fbbf4386064557e8f7c904..57e0ea95df34fab22d6c5868ab839d56a3fa85fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
@@ -872,5 +872,10 @@ public class EntityArmorStand extends EntityLiving {
|
||||
super.move(moveType, vec3d);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization
|
||||
+ return true;
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Tue, 16 May 2017 21:29:08 -0500
|
||||
Subject: [PATCH] Add option to make parrots stay on shoulders despite movement
|
||||
|
||||
Makes parrots not fall off whenever the player changes height, or touches water, or gets hit by a passing leaf.
|
||||
Instead, switches the behavior so that players have to sneak to make the birds leave.
|
||||
|
||||
I suspect Mojang may switch to this behavior before full release.
|
||||
|
||||
To be converted into a Paper-API event at some point in the future?
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index c611b5a63498f5ad1f50a75ccd5d7299e27df7e3..9d1cddc6038f0fd0286e4a32013ae98ff0b00dd1 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -330,4 +330,10 @@ public class PaperWorldConfig {
|
||||
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
|
||||
log( "Max Entity Collisions: " + maxCollisionsPerEntity );
|
||||
}
|
||||
+
|
||||
+ public boolean parrotsHangOnBetter;
|
||||
+ private void parrotsHangOnBetter() {
|
||||
+ parrotsHangOnBetter = getBoolean("parrots-are-unaffected-by-player-movement", false);
|
||||
+ log("Parrots are unaffected by player movement: " + parrotsHangOnBetter);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
index d507d050f9a1ebd65383adb2b21699a01d9b0385..8c39dc4f05becea92f3ec86c4103be4e34f2b835 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -2053,6 +2053,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
switch (packetplayinentityaction.c()) {
|
||||
case PRESS_SHIFT_KEY:
|
||||
this.player.setSneaking(true);
|
||||
+
|
||||
+ // Paper start - Hang on!
|
||||
+ if (this.player.world.paperConfig.parrotsHangOnBetter) {
|
||||
+ this.player.releaseShoulderEntities();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
break;
|
||||
case RELEASE_SHIFT_KEY:
|
||||
this.player.setSneaking(false);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
index e3e3426a00128b56d523bb43a59b814b915ad0ff..ba26fc2405e17d582da971d03147fb1865e9b546 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java
|
||||
@@ -532,7 +532,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.j(this.getShoulderEntityLeft());
|
||||
this.j(this.getShoulderEntityRight());
|
||||
if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) {
|
||||
- this.releaseShoulderEntities();
|
||||
+ if (!this.world.paperConfig.parrotsHangOnBetter) this.releaseShoulderEntities(); // Paper - Hang on!
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 5 May 2017 03:57:17 -0500
|
||||
Subject: [PATCH] Item#canEntityPickup
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
index 6ee5e1b0bb34ba490a130fbcbdb7a2706c5ecf86..c22b5f8fcdd4aa7dac242f634ef73edcd8745fc6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -607,6 +607,11 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
EntityItem entityitem = (EntityItem) iterator.next();
|
||||
|
||||
if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p() && this.i(entityitem.getItemStack())) {
|
||||
+ // Paper Start
|
||||
+ if (!entityitem.canMobPickup) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper End
|
||||
this.b(entityitem);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
|
||||
index 38b91b450c6bdc25efaed495ce26d909a52531bf..c486c07a358c0b444e1a1372b6d0fa2901840eac 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
|
||||
@@ -47,6 +47,7 @@ public class EntityItem extends Entity {
|
||||
private UUID owner;
|
||||
public final float b;
|
||||
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
||||
+ public boolean canMobPickup = true; // Paper
|
||||
|
||||
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
index f333dd2726f554a3137a3a78d162905f4ed1435e..5988cdd18b7e4bfca0075fd2356cfe9c4e673954 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
||||
@@ -49,6 +49,16 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
item.age = value;
|
||||
}
|
||||
|
||||
+ // Paper Start
|
||||
+ public boolean canMobPickup() {
|
||||
+ return item.canMobPickup;
|
||||
+ }
|
||||
+
|
||||
+ public void setCanMobPickup(boolean canMobPickup) {
|
||||
+ item.canMobPickup = canMobPickup;
|
||||
+ }
|
||||
+ // Paper End
|
||||
+
|
||||
@Override
|
||||
public void setOwner(UUID uuid) {
|
||||
item.setOwner(uuid);
|
@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Sun, 2 Jul 2017 21:35:56 -0500
|
||||
Subject: [PATCH] Block player logins during server shutdown
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
index 9f87503c58f64bbfa829faa58600d7d9e64aecf1..651b84b3bba316407a217c941be4c20074c5bb90 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/LoginListener.java
|
||||
@@ -68,6 +68,12 @@ public class LoginListener implements PacketLoginInListener {
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
+ // Paper start - Do not allow logins while the server is shutting down
|
||||
+ if (!MinecraftServer.getServer().isRunning()) {
|
||||
+ this.disconnect(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(org.spigotmc.SpigotConfig.restartMessage)[0]);
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) {
|
||||
this.c();
|
||||
} else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) {
|
@ -1,65 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 18 Jun 2017 18:17:05 -0500
|
||||
Subject: [PATCH] Entity#fromMobSpawner()
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index dcaf5c107bb77b63333f924a33961f9e5cad7082..43039c14e087259e3ce4b5091b887759b66fe52d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -268,6 +268,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
||||
public final boolean defaultActivationState;
|
||||
public long activatedTick = Integer.MIN_VALUE;
|
||||
+ public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
|
||||
protected int numCollisions = 0; // Paper
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
@@ -1666,6 +1667,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
nbttagcompound.setUUID("Paper.OriginWorld", origin.getWorld().getUID());
|
||||
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
|
||||
}
|
||||
+ // Save entity's from mob spawner status
|
||||
+ if (spawnedViaMobSpawner) {
|
||||
+ nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
|
||||
+ }
|
||||
// Paper end
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
@@ -1798,6 +1803,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
||||
}
|
||||
origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
||||
}
|
||||
+
|
||||
+ spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
||||
// Paper end
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
index 76c98d576d3e567ec4482b30219f5a9107cb9703..43fcc001bb9815b352cb74af10290b2a4ccaa540 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
@@ -160,6 +160,7 @@ public abstract class MobSpawnerAbstract {
|
||||
}
|
||||
// Spigot End
|
||||
}
|
||||
+ entity.spawnedViaMobSpawner = true; // Paper
|
||||
// Spigot Start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
|
||||
Entity vehicle = entity.getVehicle();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index a58626b1a0160983a738a45c8a1d411eb347e6a2..4c2a35fb33da19a15a220dc5e0c9fa3233d657fb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1100,5 +1100,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
Location origin = getHandle().origin;
|
||||
return origin == null ? null : origin.clone();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean fromMobSpawner() {
|
||||
+ return getHandle().spawnedViaMobSpawner;
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 May 2016 23:59:38 -0400
|
||||
Subject: [PATCH] Implement getI18NDisplayName
|
||||
|
||||
Gets the Display name as seen in the Client.
|
||||
Currently the server only supports the English language. To override this,
|
||||
You must replace the language file embedded in the server jar.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/locale/LocaleLanguage.java b/src/main/java/net/minecraft/locale/LocaleLanguage.java
|
||||
index 9b8d5e7e4c86a699e26b1b4d0b82e88887a44054..5218214225b50ac4059ab704086a457318e93e00 100644
|
||||
--- a/src/main/java/net/minecraft/locale/LocaleLanguage.java
|
||||
+++ b/src/main/java/net/minecraft/locale/LocaleLanguage.java
|
||||
@@ -30,7 +30,7 @@ public abstract class LocaleLanguage {
|
||||
|
||||
private static LocaleLanguage c() {
|
||||
Builder<String, String> builder = ImmutableMap.builder();
|
||||
- BiConsumer biconsumer = builder::put;
|
||||
+ BiConsumer<String, String> biconsumer = builder::put; // Paper - decompile fix
|
||||
|
||||
try {
|
||||
InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
|
||||
@@ -87,10 +87,12 @@ public abstract class LocaleLanguage {
|
||||
|
||||
}
|
||||
|
||||
+ public static LocaleLanguage getInstance() { return a(); } // Paper - OBFHELPER
|
||||
public static LocaleLanguage a() {
|
||||
return LocaleLanguage.d;
|
||||
}
|
||||
|
||||
+ public String translateKey(String key) { return a(key); } // Paper - OBFHELPER
|
||||
public abstract String a(String s);
|
||||
|
||||
public abstract boolean b(String s);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
index 8206e85cefb0b02b1ac9b370808c06019211cdb1..910c6109783dfef86e127a0a5b7d7d3865150d89 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
||||
@@ -352,5 +352,18 @@ public final class CraftItemFactory implements ItemFactory {
|
||||
public ItemStack ensureServerConversions(ItemStack item) {
|
||||
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public String getI18NDisplayName(ItemStack item) {
|
||||
+ net.minecraft.world.item.ItemStack nms = null;
|
||||
+ if (item instanceof CraftItemStack) {
|
||||
+ nms = ((CraftItemStack) item).handle;
|
||||
+ }
|
||||
+ if (nms == null) {
|
||||
+ nms = CraftItemStack.asNMSCopy(item);
|
||||
+ }
|
||||
+
|
||||
+ return nms != null ? net.minecraft.locale.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null;
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 31 Jul 2017 01:54:40 -0500
|
||||
Subject: [PATCH] Ocelot despawns should honor nametags and leash
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java b/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
index b0296cef410aa5af42dcf89217dd8853f3800663..f3e9c73f28584bcccd6f82d8974eabe4b4a892fa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
@@ -128,7 +128,7 @@ public class EntityOcelot extends EntityAnimal {
|
||||
|
||||
@Override
|
||||
public boolean isTypeNotPersistent(double d0) {
|
||||
- return !this.isTrusting() /*&& this.ticksLived > 2400*/; // CraftBukkit
|
||||
+ return !this.isTrusting() && !this.hasCustomName() && !this.isLeashed() /*&& this.ticksLived > 2400*/; // CraftBukkit // Paper - honor name and leash
|
||||
}
|
||||
|
||||
public static AttributeProvider.Builder eK() {
|
@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 31 Jul 2017 01:45:19 -0500
|
||||
Subject: [PATCH] Reset spawner timer when spawner event is cancelled
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
index 43fcc001bb9815b352cb74af10290b2a4ccaa540..883c724fbb86a84ee903b5e7127f14726fe4cf24 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
||||
@@ -161,6 +161,7 @@ public abstract class MobSpawnerAbstract {
|
||||
// Spigot End
|
||||
}
|
||||
entity.spawnedViaMobSpawner = true; // Paper
|
||||
+ flag = true; // Paper
|
||||
// Spigot Start
|
||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
|
||||
Entity vehicle = entity.getVehicle();
|
||||
@@ -184,7 +185,7 @@ public abstract class MobSpawnerAbstract {
|
||||
((EntityInsentient) entity).doSpawnEffect();
|
||||
}
|
||||
|
||||
- flag = true;
|
||||
+ /*flag = true;*/ // Paper - moved up above cancellable event
|
||||
}
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: mezz <tehgeek@gmail.com>
|
||||
Date: Wed, 9 Aug 2017 17:51:22 -0500
|
||||
Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
|
||||
index bd08ff18d8d7dbe63ed33c1efb6099b58aa02caa..8d4a28f98bd9c8a2dd1262f0f640909a456897fa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/World.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/World.java
|
||||
@@ -726,7 +726,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
gameprofilerfiller.enter("blockEntities");
|
||||
timings.tileEntityTick.startTiming(); // Spigot
|
||||
if (!this.tileEntityListUnload.isEmpty()) {
|
||||
- this.tileEntityListTick.removeAll(this.tileEntityListUnload);
|
||||
+ // Paper start - Use alternate implementation with faster contains
|
||||
+ java.util.Set<TileEntity> toRemove = java.util.Collections.newSetFromMap(new java.util.IdentityHashMap<>());
|
||||
+ toRemove.addAll(tileEntityListUnload);
|
||||
+ this.tileEntityListTick.removeAll(toRemove);
|
||||
+ // Paper end
|
||||
//this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - remove unused list
|
||||
this.tileEntityListUnload.clear();
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Mon, 31 Jul 2017 01:49:48 -0500
|
||||
Subject: [PATCH] LivingEntity#setKiller
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
index 3d6b8fd09c07e78c0d786dff9658eb0089f853cf..851aed157a233ab690a57e5736fa01beaff45b5c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -180,7 +180,7 @@ public abstract class EntityLiving extends Entity {
|
||||
public float aE;
|
||||
@Nullable
|
||||
public EntityHuman killer;
|
||||
- protected int lastDamageByPlayerTime;
|
||||
+ public int lastDamageByPlayerTime; // Paper - protected -> public
|
||||
protected boolean killed;
|
||||
protected int ticksFarFromPlayer;
|
||||
protected float aJ;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index c654026587bc9bf77b39f59a0c89991ac581da1e..c43c300963bae9bca6ab9c9389dd53e42318715c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -8,6 +8,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
import net.minecraft.world.EnumHand;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
@@ -344,6 +345,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void setKiller(Player killer) {
|
||||
+ EntityPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
|
||||
+ getHandle().killer = entityPlayer;
|
||||
+ getHandle().lastDamager = entityPlayer;
|
||||
+ getHandle().lastDamageByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean addPotionEffect(PotionEffect effect) {
|
||||
return addPotionEffect(effect, false);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user