Yatopia/patches/server/0060-tic-tacs-unblocking.patch

408 lines
22 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gegy <gegy1000@gmail.com>
Date: Tue, 9 Feb 2021 13:23:12 -0500
Subject: [PATCH] tic-tacs: unblocking
Code originally licenced under LGPLv3 for the tic-tacs project: https://github.com/Gegy/tic-tacs
diff --git a/src/main/java/net/gegy1000/tictacs/NonBlockingWorldAccess.java b/src/main/java/net/gegy1000/tictacs/NonBlockingWorldAccess.java
new file mode 100644
index 0000000000000000000000000000000000000000..0d99f3b4930045632d88fa4acb3b8159ee9cf9f3
--- /dev/null
+++ b/src/main/java/net/gegy1000/tictacs/NonBlockingWorldAccess.java
@@ -0,0 +1,29 @@
+package net.gegy1000.tictacs;
+
+import net.minecraft.world.level.block.state.IBlockData;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.material.Fluid;
+import net.minecraft.world.level.material.FluidTypes;
+import net.minecraft.core.BlockPosition;
+import net.minecraft.world.level.IWorldReader;
+import net.minecraft.world.level.material.FluidTypes;
+
+public interface NonBlockingWorldAccess extends IWorldReader {
+
+ public static final IBlockData DEFAULT_BLOCK_STATE = Blocks.AIR.getBlockData();
+ public static final Fluid DEFAULT_FLUID_STATE = FluidTypes.EMPTY.getFluidData();
+
+ default IBlockData getBlockStateIfLoaded(BlockPosition pos) {
+ if (this.isLoaded(pos)) {
+ return this.getType(pos);
+ }
+ return DEFAULT_BLOCK_STATE;
+ }
+
+ default Fluid getFluidStateIfLoaded(BlockPosition pos) {
+ if (this.isLoaded(pos)) {
+ return this.getFluid(pos);
+ }
+ return DEFAULT_FLUID_STATE;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 742d802d63963778454e41e5b19a3d889c544efc..13264b642a065dbbf908cef0a0f086ee666b24c7 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
2021-06-03 04:37:38 +02:00
@@ -654,6 +654,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void playerTick() {
+ if (!this.world.isLoaded(this.getChunkCoordinates())) return; // Yatopia - tic-tac unblocking
+
try {
if (valid && !this.isSpectator() || this.world.isLoaded(this.getChunkCoordinates())) { // Paper - don't tick dead players that are not in the world currently (pending respawn)
super.tick();
diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index 13b00ae4e2a9fd2714b9bfd6ca9015f27b492399..9e9ecd78a0c1803449d44df680fd19c0f6bc1154 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
2021-06-03 04:37:38 +02:00
@@ -169,8 +169,9 @@ import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.event.world.TimeSkipEvent;
// CraftBukkit end
import it.unimi.dsi.fastutil.ints.IntArrayList; // Tuinity
+import net.gegy1000.tictacs.NonBlockingWorldAccess; // Yatopia
-public class WorldServer extends World implements GeneratorAccessSeed {
+public class WorldServer extends World implements GeneratorAccessSeed, NonBlockingWorldAccess { // Yatopia
public static final BlockPosition a = new BlockPosition(100, 50, 0);
private static final Logger LOGGER = LogManager.getLogger();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b742f457d72eee4f00f5df7a2b5b3cfdeb917a86..c4d3f716dda0e33b444de6caa6f336d8d33daf5b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
Upstream (#490) * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 151457628 Fix Counter#decrement recursive call (#5665) 21ac7dc98 [Auto] Updated Upstream (CraftBukkit) 18ad2c9dd Add environment variable (PAPER_DISABLE_SERVER_GUI) to disable server gui 6ecbe5776 Rename leftover resource->datapack (#5662) ec90a7859 I give up on trying to teach people to avoid the incorrect ways. dc7b7a160 Fix missing username console death message (#5654) (#5658) c639a52a6 Add basic Datapack API (#5653) (#5653) 99c1d9da6 Updated Upstream (CraftBukkit) (#5652) 2d50c17e2 [CI-SKIP] Add PR rebasing steps (#5634) 2c5f8085e Remove boat interaction event (Fixes #5539) 96ee1fb8f fix WorldSaveEvent not firing with /save-all (#5650) e90e7829e remove unneeded patch (#5641) d875bacc2 Activate warning by default when people are doing silly things (#5642) cb896d471 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643) ecbf5a38e Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)" 20fc4ab70 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636) 20d8812ea Fix CraftPotionBrewer cache (#5632) cd6ae8816 Add a "Should Burn in Sunlight" API for Phantoms and Skeletons (#5608) 25edfe58b Remove unneeded component conversion for kick msg (#5626) cec386f66 Call PortalCreateEvent when players enter the end (#5618) 453c7f05c Add ItemStack#displayName to get the formatted display name of an ItemStack (#5628) 4efe8b498 Update Java version warning (#5621) e0a021ccc Add ItemStack#getTranslationKey() (#5616) 53d71b717 Add setPotionUseTimeLeft to Witch (#5597) 239935d18 Add Inventory#close (#5610) 29bf6cd41 Updated Upstream (CraftBukkit) ad45f316c Add raw address to AsyncPlayerPreLoginEvent (#5614) 28865335a [Auto] Updated Upstream (CraftBukkit) 750049fa2 Fix incorrect colors in some log messages (#5609) c5fa3f0d4 Add Adventure message to PlayerAdvancementDoneEvent (#5030) 69c09cdb0 Updated Upstream (CraftBukkit) (#5607) Tuinity Changes: 1222573 Fix incorrect status dataconverter for pre 1.13 chunks Airplane Changes: 3dce697 Fix gradle stuff 209bce3 Patches Purpur Changes: 72708f4 Option to disable dragon egg teleporting 5f87a45 Updated Upstream (Paper) 7bfc70d swap heavy logic to end bb9d72d Fix #338 - Phantoms always burning bug 8fa99b3 Configurable critical damage multiplier (#339) dc4a1cb Updated Upstream (Paper & Tuinity) c166841 Configurable powered rail boost modifier (closes #329) (#333) ab9b8ca Updated Upstream (Paper & Airplane) 44e72f7 Let parrots breed using any tempting item 09d98d3 this part is important, too :3 2015fe5 Breedable parrots 552d783 Iron golem poppy calms anger 1fa06a1 Optimize collisions (#328) 1112240 Extend Halloween Optimization (#321) 03f1aec Config for health to impact Creeper explosion radius (#304) 8f7bce4 Add config for hidden from entity selector patch 21906a2 Hide hidden players from entity selector 445496d [ci-skip] fix this too, now.. jfc 3ba8c81 Ya'll didn't see nothing.. 2d4611b Updated Upstream (Paper) beed258 Better offline mode warning (#330) c1efe3c It's meant to be double :facepalm: 3f9958b Implement the Mob Blindness mod 6e98c88 Add missing repo to settings.gradle.kts da5185b Update Gradle to 7.0.1 fbd28d8 Updated Upstream (Paper & Tuinity) cb42dec Updated Upstream (Paper) e883991 Fix compatibility with MyPet Origami Changes: 4c0616d Update Paper * Updated Upstream and Sidestream(s) (Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 45e19ffb0 [Auto] Updated Upstream (CraftBukkit) * Updated Upstream and Sidestream(s) (Paper/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants * Updated Upstream and Sidestream(s) (Paper/Purpur/Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants Paper Changes: 322886c86 Avoid NPE due to PlayerBedFailEnterEvent d3c9a195c removed duplicate ProjectileHitEvent for fireball (#5671) * Updated Upstream and Sidestream(s) (Paper/Airplane/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 2c6b1f048 Revert "Remove itneract event from boat" (Fixes #5677) aae1c54a9 Add command line option to load extra plugin jars not in the plugins folder Airplane Changes: 4a22184 Updated Upstream (Tuinity) Empirecraft Changes: d0aaf527 Updated Paper * Updated Upstream and Sidestream(s) (Airplane/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Airplane Changes: 046ae54 Improve hopper performance via bitset Purpur Changes: c333d3d Add config for the unverified username message (#348) 703b5da Fix invulnerable-while-accepting-resource-pack not being used * Updated Upstream and Sidestream(s) (Paper/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 6c183f1ae [Auto] Updated Upstream (CraftBukkit) Purpur Changes: e0991e0 allow using legacy section symbol in unverified username message 6bd246b Updated Upstream (Paper) * Updated Upstream and Sidestream(s) (Airplane) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Airplane Changes: 5fab6a2 Improvements to fluid & profiler patches * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 41e6073ce [Auto] Updated Upstream (CraftBukkit) 6f93dc95d Add cause to Weather/ThunderChangeEvents (#4832) 507cf19b3 [CI-SKIP] [Auto] Rebuild Patches afe0785bf Added PlayerPurchaseEvent for standalone Merchant GUIs (#5583) 615df3d8a Fix entity motion tag from mob spawners (#5718) 2d34898b5 Add methods for getting default item attributes (#5593) d9766433e Add EntityInsideBlockEvent (#5596) 47d48790d Change return type of ItemStack#editMeta to allow checking for successful vs non-successful edits 7aabe7d56 [CI-SKIP] fix minecart vs minecraft typos (#5713) f775e87b4 [CI-SKIP] ci: update setup-java action (#5710) c58b3b277 ci: replace Java 11 with Java 16 in GH Actions build flow (#5709) 4b72327a6 ItemStack#editMeta 68984b664 Add Unix domain socket support (#5611) 68c67e680 Add Mob#lookAt API (#5633) 4bacecd16 [Auto] Updated Upstream (Bukkit/CraftBukkit) 1f28e6eeb Fix default ChatRenderer when no plugins are installed (#5702) ecb0d32ca Enhance (Async)ChatEvent with per-viewer rendering API (#5684) f3e541ca1 Actually list all missing hard depends (#5701) 11f83fe8e [CI-SKIP] [Auto] Rebuild Patches a36e5d65f MC-148809: Fix incorrect structure block data length 3dcbdc73b Fix force upgrade patch (#5699) dab6ec6cd List all missing hard depends not just first (#5673) aed5031e3 Fix/Optimize world and light datafixes (#5693) 719040d92 [Auto] Updated Upstream (CraftBukkit) Tuinity Changes: f0e91a4 Updated Upstream (Paper) f88659c Fix and optimise world force upgrading Airplane Changes: 636dbff [ci skip] Cleanup mcdev import files c579320 [ci skip] Remove icons 7ada9a4 [skip ci] Need to specify 1.16.5 in the README of course 813df1a Update README daf3f0b Optimize air case for raytracing 1c252a5 Update Tuinity URL 50babee Updated Upstream (Tuinity) 85e0c63 Revert "Allow plugins to stupidly replace server internals" db3fe2c Remove auto import 6b32e01 Allow plugins to stupidly replace server internals f849f00 Flare Update ac10e43 Flare Update 7f3b091 Move check 040fa19 Better checking for useless move packets Purpur Changes: adb0cafe Updated Upstream (Paper) f9ccf6dd Updated Upstream (Paper & Airplane) 1343a050 Updated Upstream (Paper, Tuinity, & Airplane) af2dd61a Updated Upstream (Paper, Tuinity, & Airplane) 1808888a Expand gamemode extra perms some more Empirecraft Changes: 9e2881e6 Don't dismount on teleports... 7ed16bf3 Updated Paper c3d0a1b2 Re-add missing line in Vehicle teleporting patch * drop Improved-oversized-chunk-data-packet-handling.patch
2021-05-27 04:01:31 +02:00
@@ -141,9 +141,12 @@ import org.bukkit.event.entity.EntityPoseChangeEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.plugin.PluginManager;
// CraftBukkit end
+import net.gegy1000.tictacs.NonBlockingWorldAccess; // Yatopia
public abstract class Entity implements INamableTileEntity, ICommandListener, net.minecraft.server.KeyedObject { // Paper
+ public boolean updateNeeded; // Yatopia
+ private boolean chunkPosUpdateRequested; // Yatopia
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
Upstream (#490) * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Origami) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 151457628 Fix Counter#decrement recursive call (#5665) 21ac7dc98 [Auto] Updated Upstream (CraftBukkit) 18ad2c9dd Add environment variable (PAPER_DISABLE_SERVER_GUI) to disable server gui 6ecbe5776 Rename leftover resource->datapack (#5662) ec90a7859 I give up on trying to teach people to avoid the incorrect ways. dc7b7a160 Fix missing username console death message (#5654) (#5658) c639a52a6 Add basic Datapack API (#5653) (#5653) 99c1d9da6 Updated Upstream (CraftBukkit) (#5652) 2d50c17e2 [CI-SKIP] Add PR rebasing steps (#5634) 2c5f8085e Remove boat interaction event (Fixes #5539) 96ee1fb8f fix WorldSaveEvent not firing with /save-all (#5650) e90e7829e remove unneeded patch (#5641) d875bacc2 Activate warning by default when people are doing silly things (#5642) cb896d471 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643) ecbf5a38e Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)" 20fc4ab70 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636) 20d8812ea Fix CraftPotionBrewer cache (#5632) cd6ae8816 Add a "Should Burn in Sunlight" API for Phantoms and Skeletons (#5608) 25edfe58b Remove unneeded component conversion for kick msg (#5626) cec386f66 Call PortalCreateEvent when players enter the end (#5618) 453c7f05c Add ItemStack#displayName to get the formatted display name of an ItemStack (#5628) 4efe8b498 Update Java version warning (#5621) e0a021ccc Add ItemStack#getTranslationKey() (#5616) 53d71b717 Add setPotionUseTimeLeft to Witch (#5597) 239935d18 Add Inventory#close (#5610) 29bf6cd41 Updated Upstream (CraftBukkit) ad45f316c Add raw address to AsyncPlayerPreLoginEvent (#5614) 28865335a [Auto] Updated Upstream (CraftBukkit) 750049fa2 Fix incorrect colors in some log messages (#5609) c5fa3f0d4 Add Adventure message to PlayerAdvancementDoneEvent (#5030) 69c09cdb0 Updated Upstream (CraftBukkit) (#5607) Tuinity Changes: 1222573 Fix incorrect status dataconverter for pre 1.13 chunks Airplane Changes: 3dce697 Fix gradle stuff 209bce3 Patches Purpur Changes: 72708f4 Option to disable dragon egg teleporting 5f87a45 Updated Upstream (Paper) 7bfc70d swap heavy logic to end bb9d72d Fix #338 - Phantoms always burning bug 8fa99b3 Configurable critical damage multiplier (#339) dc4a1cb Updated Upstream (Paper & Tuinity) c166841 Configurable powered rail boost modifier (closes #329) (#333) ab9b8ca Updated Upstream (Paper & Airplane) 44e72f7 Let parrots breed using any tempting item 09d98d3 this part is important, too :3 2015fe5 Breedable parrots 552d783 Iron golem poppy calms anger 1fa06a1 Optimize collisions (#328) 1112240 Extend Halloween Optimization (#321) 03f1aec Config for health to impact Creeper explosion radius (#304) 8f7bce4 Add config for hidden from entity selector patch 21906a2 Hide hidden players from entity selector 445496d [ci-skip] fix this too, now.. jfc 3ba8c81 Ya'll didn't see nothing.. 2d4611b Updated Upstream (Paper) beed258 Better offline mode warning (#330) c1efe3c It's meant to be double :facepalm: 3f9958b Implement the Mob Blindness mod 6e98c88 Add missing repo to settings.gradle.kts da5185b Update Gradle to 7.0.1 fbd28d8 Updated Upstream (Paper & Tuinity) cb42dec Updated Upstream (Paper) e883991 Fix compatibility with MyPet Origami Changes: 4c0616d Update Paper * Updated Upstream and Sidestream(s) (Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 45e19ffb0 [Auto] Updated Upstream (CraftBukkit) * Updated Upstream and Sidestream(s) (Paper/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants * Updated Upstream and Sidestream(s) (Paper/Purpur/Paper) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants Paper Changes: 322886c86 Avoid NPE due to PlayerBedFailEnterEvent d3c9a195c removed duplicate ProjectileHitEvent for fireball (#5671) * Updated Upstream and Sidestream(s) (Paper/Airplane/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 2c6b1f048 Revert "Remove itneract event from boat" (Fixes #5677) aae1c54a9 Add command line option to load extra plugin jars not in the plugins folder Airplane Changes: 4a22184 Updated Upstream (Tuinity) Empirecraft Changes: d0aaf527 Updated Paper * Updated Upstream and Sidestream(s) (Airplane/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Airplane Changes: 046ae54 Improve hopper performance via bitset Purpur Changes: c333d3d Add config for the unverified username message (#348) 703b5da Fix invulnerable-while-accepting-resource-pack not being used * Updated Upstream and Sidestream(s) (Paper/Purpur) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 6c183f1ae [Auto] Updated Upstream (CraftBukkit) Purpur Changes: e0991e0 allow using legacy section symbol in unverified username message 6bd246b Updated Upstream (Paper) * Updated Upstream and Sidestream(s) (Airplane) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Airplane Changes: 5fab6a2 Improvements to fluid & profiler patches * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 41e6073ce [Auto] Updated Upstream (CraftBukkit) 6f93dc95d Add cause to Weather/ThunderChangeEvents (#4832) 507cf19b3 [CI-SKIP] [Auto] Rebuild Patches afe0785bf Added PlayerPurchaseEvent for standalone Merchant GUIs (#5583) 615df3d8a Fix entity motion tag from mob spawners (#5718) 2d34898b5 Add methods for getting default item attributes (#5593) d9766433e Add EntityInsideBlockEvent (#5596) 47d48790d Change return type of ItemStack#editMeta to allow checking for successful vs non-successful edits 7aabe7d56 [CI-SKIP] fix minecart vs minecraft typos (#5713) f775e87b4 [CI-SKIP] ci: update setup-java action (#5710) c58b3b277 ci: replace Java 11 with Java 16 in GH Actions build flow (#5709) 4b72327a6 ItemStack#editMeta 68984b664 Add Unix domain socket support (#5611) 68c67e680 Add Mob#lookAt API (#5633) 4bacecd16 [Auto] Updated Upstream (Bukkit/CraftBukkit) 1f28e6eeb Fix default ChatRenderer when no plugins are installed (#5702) ecb0d32ca Enhance (Async)ChatEvent with per-viewer rendering API (#5684) f3e541ca1 Actually list all missing hard depends (#5701) 11f83fe8e [CI-SKIP] [Auto] Rebuild Patches a36e5d65f MC-148809: Fix incorrect structure block data length 3dcbdc73b Fix force upgrade patch (#5699) dab6ec6cd List all missing hard depends not just first (#5673) aed5031e3 Fix/Optimize world and light datafixes (#5693) 719040d92 [Auto] Updated Upstream (CraftBukkit) Tuinity Changes: f0e91a4 Updated Upstream (Paper) f88659c Fix and optimise world force upgrading Airplane Changes: 636dbff [ci skip] Cleanup mcdev import files c579320 [ci skip] Remove icons 7ada9a4 [skip ci] Need to specify 1.16.5 in the README of course 813df1a Update README daf3f0b Optimize air case for raytracing 1c252a5 Update Tuinity URL 50babee Updated Upstream (Tuinity) 85e0c63 Revert "Allow plugins to stupidly replace server internals" db3fe2c Remove auto import 6b32e01 Allow plugins to stupidly replace server internals f849f00 Flare Update ac10e43 Flare Update 7f3b091 Move check 040fa19 Better checking for useless move packets Purpur Changes: adb0cafe Updated Upstream (Paper) f9ccf6dd Updated Upstream (Paper & Airplane) 1343a050 Updated Upstream (Paper, Tuinity, & Airplane) af2dd61a Updated Upstream (Paper, Tuinity, & Airplane) 1808888a Expand gamemode extra perms some more Empirecraft Changes: 9e2881e6 Don't dismount on teleports... 7ed16bf3 Updated Paper c3d0a1b2 Re-add missing line in Vehicle teleporting patch * drop Improved-oversized-chunk-data-packet-handling.patch
2021-05-27 04:01:31 +02:00
public boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation
@@ -827,6 +830,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
// Tuinity end - detailed watchdog information
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
+ // Yatopia start - tic-tacs unblocking
+ BlockPosition pos = this.getChunkCoordinates();
+ if (!this.world.isLoaded(pos)) {
+ return;
+ }
+ // Yatopia end
// Tuinity start - detailed watchdog information
com.tuinity.tuinity.util.TickThread.ensureTickThread("Cannot move an entity off-main");
synchronized (this.posLock) {
@@ -877,7 +886,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
this.v = vec3d.y != vec3d1.y;
this.onGround = this.v && vec3d.y < 0.0D;
BlockPosition blockposition = this.ap();
- IBlockData iblockdata = this.world.getType(blockposition);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(blockposition); // Yatopia
this.a(vec3d1.y, this.onGround, iblockdata, blockposition);
Vec3D vec3d2 = this.getMot();
@@ -991,9 +1000,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
int k = MathHelper.floor(this.loc.z);
BlockPosition blockposition = new BlockPosition(i, j, k);
- if (this.world.getType(blockposition).isAir()) {
+ if (this.world.getBlockStateIfLoaded(blockposition).isAir()) { // Yatopia
BlockPosition blockposition1 = blockposition.down();
- IBlockData iblockdata = this.world.getType(blockposition1);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(blockposition1); // Yatopia
Block block = iblockdata.getBlock();
if (block.a((Tag) TagsBlock.FENCES) || block.a((Tag) TagsBlock.WALLS) || block instanceof BlockFenceGate) {
@@ -1005,17 +1014,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
protected float getBlockJumpFactor() {
- float f = this.world.getType(this.getChunkCoordinates()).getBlock().getJumpFactor();
- float f1 = this.world.getType(this.as()).getBlock().getJumpFactor();
+ // Yatopia start - tic-tacs unblocking
+ float f = this.world.getBlockStateIfLoaded(this.getChunkCoordinates()).getBlock().getJumpFactor();
+ float f1 = this.world.getBlockStateIfLoaded(this.as()).getBlock().getJumpFactor();
+ // Yatopia end
return (double) f == 1.0D ? f1 : f;
}
protected float getBlockSpeedFactor() {
- Block block = this.world.getType(this.getChunkCoordinates()).getBlock();
+ // Yatopia start - tic-tacs unblocking
+ Block block = this.world.getBlockStateIfLoaded(this.getChunkCoordinates()).getBlock();
float f = block.getSpeedFactor();
- return block != Blocks.WATER && block != Blocks.BUBBLE_COLUMN ? ((double) f == 1.0D ? this.world.getType(this.as()).getBlock().getSpeedFactor() : f) : f;
+ return block != Blocks.WATER && block != Blocks.BUBBLE_COLUMN ? ((double) f == 1.0D ? this.world.getBlockStateIfLoaded(this.as()).getBlock().getSpeedFactor() : f) : f;
+ // Yatopia end
}
protected BlockPosition as() {
@@ -1360,7 +1373,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
for (int i = blockposition.getX(); i <= blockposition1.getX(); ++i) {
// Tuinity end - reorder iteration to more cache aware
blockposition_mutableblockposition.d(i, j, k);
- IBlockData iblockdata = this.world.getType(blockposition_mutableblockposition);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(blockposition_mutableblockposition);
// Tuinity start - move fire checking in here - reuse getType from this method
if (checkFire) {
@@ -1396,7 +1409,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
protected void b(BlockPosition blockposition, IBlockData iblockdata) {
if (!iblockdata.getMaterial().isLiquid()) {
- IBlockData iblockdata1 = this.world.getType(blockposition.up());
+ IBlockData iblockdata1 = this.world.getBlockStateIfLoaded(blockposition.up()); // Yatopia
SoundEffectType soundeffecttype = iblockdata1.a(Blocks.SNOW) ? iblockdata1.getStepSound() : iblockdata.getStepSound();
this.playSound(soundeffecttype.getStepSound(), soundeffecttype.getVolume() * 0.15F, soundeffecttype.getPitch());
@@ -1487,7 +1500,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
public final boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
private boolean k() {
- return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN);
+ return this.world.getBlockStateIfLoaded(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN); // Yatopia
}
public boolean isInWaterOrRain() {
@@ -1558,7 +1571,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
BlockPosition blockposition = new BlockPosition(this.locX(), d0, this.locZ());
- Fluid fluid = this.world.getFluid(blockposition);
+ Fluid fluid = this.world.getFluidStateIfLoaded(blockposition); // Yatopia
Iterator iterator = TagsFluid.b().iterator();
Tag tag;
@@ -1616,7 +1629,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
protected IBlockData aN() {
- return this.world.getType(this.ap());
+ return this.world.getBlockStateIfLoaded(this.ap()); // Yatopia
}
public boolean aO() {
@@ -1628,7 +1641,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
int j = MathHelper.floor(this.locY() - 0.20000000298023224D);
int k = MathHelper.floor(this.locZ());
BlockPosition blockposition = new BlockPosition(i, j, k);
- IBlockData iblockdata = this.world.getType(blockposition);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(blockposition); // Yatopia
if (iblockdata.h() != EnumRenderType.INVISIBLE) {
Vec3D vec3d = this.getMot();
@@ -2867,7 +2880,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
EnumDirection enumdirection1 = aenumdirection[j];
blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection1);
- if (!this.world.getType(blockposition_mutableblockposition).r(this.world, blockposition_mutableblockposition)) {
+ if (!this.world.getBlockStateIfLoaded(blockposition_mutableblockposition).r(this.world, blockposition_mutableblockposition)) { // Yatopia
double d4 = vec3d.a(enumdirection1.n());
double d5 = enumdirection1.e() == EnumDirection.EnumAxisDirection.POSITIVE ? 1.0D - d4 : d4;
@@ -3081,14 +3094,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
return (ShapeDetectorShape) this.findOrCreatePortal(worldserver, blockposition, flag2, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> {
// CraftBukkit end
- IBlockData iblockdata = this.world.getType(this.ac);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(this.ac); // Yatopia
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
if (iblockdata.b(BlockProperties.E)) {
enumdirection_enumaxis = (EnumDirection.EnumAxis) iblockdata.get(BlockProperties.E);
BlockUtil.Rectangle blockutil_rectangle1 = BlockUtil.a(this.ac, enumdirection_enumaxis, 21, EnumDirection.EnumAxis.Y, 21, (blockposition1) -> {
- return this.world.getType(blockposition1) == iblockdata;
+ return this.world.getBlockStateIfLoaded(blockposition1) == iblockdata; // Yatopia
});
vec3d = this.a(enumdirection_enumaxis, blockutil_rectangle1);
@@ -3443,6 +3456,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
}
public boolean cl() {
+ if (!this.updateNeeded) this.chunkPosUpdateRequested = true; // Yatopia
boolean flag = this.au;
this.au = false;
@@ -3641,7 +3655,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
for (int i2 = k; i2 < l; ++i2) {
for (int j2 = i1; j2 < j1; ++j2) {
blockposition_mutableblockposition.d(l1, i2, j2);
- Fluid fluid = this.world.getFluid(blockposition_mutableblockposition);
+ Fluid fluid = this.world.getFluidStateIfLoaded(blockposition_mutableblockposition); // Yatopia
if (fluid.a(tag)) {
double d2 = (double) ((float) i2 + fluid.getHeight(this.world, blockposition_mutableblockposition));
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 6132c711836908569006a8993973526275c9fb7c..02f7a588f883c0ed8b5daef6839e385b4ce1334b 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
2021-06-03 04:37:38 +02:00
@@ -139,6 +139,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
// CraftBukkit end
+import net.gegy1000.tictacs.NonBlockingWorldAccess; // Yatopia
public abstract class EntityLiving extends Entity {
2021-06-03 04:37:38 +02:00
@@ -387,7 +388,7 @@ public abstract class EntityLiving extends Entity {
boolean flag1 = flag && ((EntityHuman) this).abilities.isInvulnerable;
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.a((Tag) TagsFluid.WATER) && !this.world.getBlockStateIfLoaded(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) { // Yatopia
if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden
this.setAirTicks(this.l(this.getAirTicks()));
2021-06-03 04:37:38 +02:00
if (this.getAirTicks() == -20) {
@@ -480,7 +481,7 @@ public abstract class EntityLiving extends Entity {
}
protected boolean cP() {
- return this.world.getType(this.as()).a((Tag) TagsBlock.SOUL_SPEED_BLOCKS);
+ return this.world.getBlockStateIfLoaded(this.as()).a((Tag) TagsBlock.SOUL_SPEED_BLOCKS); // Yatopia
}
@Override
2021-06-03 04:37:38 +02:00
@@ -528,6 +529,8 @@ public abstract class EntityLiving extends Entity {
}
protected void c(BlockPosition blockposition) {
+ if (!this.world.isLoaded(blockposition)) return; // Yatopia
+
int i = EnchantmentManager.a(Enchantments.FROST_WALKER, this);
if (i > 0) {
2021-06-03 04:37:38 +02:00
@@ -1561,7 +1564,7 @@ public abstract class EntityLiving extends Entity {
BlockPosition blockposition = this.getChunkCoordinates();
IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData();
- if (this.world.getType(blockposition).isAir() && iblockdata.canPlace(this.world, blockposition)) {
+ if (this.world.getBlockStateIfLoaded(blockposition).isAir() && iblockdata.canPlace(this.world, blockposition)) { // Yatopia
this.world.setTypeAndData(blockposition, iblockdata, 3);
flag = true;
}
2021-06-03 04:37:38 +02:00
@@ -1764,12 +1767,12 @@ public abstract class EntityLiving extends Entity {
Updated Upstream and Sidestream(s) (Paper/Airplane/Purpur/Empirecraft/Origami) (#474) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b8020379c Extract Adventure Version into a variable, add reminder to update the linked JD on the homepage (#5422) 809466f2e Fix anchor respawn acting as a bed respawn when using the end portal (#5540) d219fd642 [Auto] Updated Upstream (Bukkit/CraftBukkit) db464b099 Implement methods to convert between Component and Brigadier's Message (#5542) 4047cffca Add PlayerBedFailEnterEvent (#4935) 70d697e6e Update Paperpclip 5ed771591 [CI-SKIP] Remove bad null annotation (#5538) 454a4c78e More World API (#3850) 869e02304 Add PlayerDeepSleepEvent (#5525) fb56fc35e fix non-dummy objectives not updating dc859a61f [CI-SKIP] [Auto] Rebuild Patches 7d1689f1a Add missing checkReachable check for shulker boxes (#5453) ba8eb3d4b Add missing Javadoc for COLORABLE MaterialTag (#5376) db801cbf3 Fix PlayerItemHeldEvent firing twice (#5534) 14de2b795 fix PigZombieAngerEvent cancellation (fixes #5319) (v2) (#5329) 86d684ad1 Add get-set drop chance to EntityEquipment (#5528) 33fb8cf63 Add consumeFuel to FurnaceBurnEvent (#5532) 9957f4630 Fix duplicating /give items on item drop cancel (#5536) d94882043 Fix legacyComposer not using AsyncChatEvent messages (#5509) 053bd82cc Don't print spawn load time when not loading spawn (#5467) a6d78caae Add isDeeplySleeping to HumanEntity (#5470) 711b7a80b Expose more Adventure serializers through PaperComponents (#5443) 3f63bde0c Set Area Effect Cloud Rotation (#5462) 3523f0fda Remove useless check on player interact cancellation (#5448) 6574d1aa8 fix #5526 - use correct type when sending message to clients dbfa833ec don't throw when loading TE with invalid keys a9525a6f7 Do not schedule poi task for each block write on chunk gen Airplane Changes: f5fb024 Temporarily revert patch 3c728a7 Oops, these 2 too 37a93e5 Your daily dose of 1-3% optimization patches bbd689a Remove useless check d8bdbc5 Reduce allocations for fire spreading 41051fd Redo reduction of entity chunk ticking check patch 31272d8 Flare Update 8f32713 Remove criterion patch 0fed2df Various patches that need to be reorganized later f78856b Updated Upstream (Tuinity) f7d6382 Flare Update 71d0799 Update gradle configuration 0f79774 Updated Upstream (Tuinity) Purpur Changes: 3dce975 Updated Upstream (Paper & Airplane) (#298) eb07368 Run GitHub Actions for pull requests e97d062 Updated Upstream (Paper, Tuinity, & Airplane) Empirecraft Changes: 2a021ede Updated Paper e963bb2c Add Paper MojangAPI to pom 6f5bf24e Updated Paper Origami Changes: 73ecdf1 Update Paper 73a3735 Item and exp merge improvements
2021-04-27 18:40:55 +02:00
// Airplane end
public IBlockData ds() {
- return this.world.getType(this.getChunkCoordinates());
+ return this.world.getBlockStateIfLoaded(this.getChunkCoordinates()); // Yatopia
}
private boolean c(BlockPosition blockposition, IBlockData iblockdata) {
if ((Boolean) iblockdata.get(BlockTrapdoor.OPEN)) {
- IBlockData iblockdata1 = this.world.getType(blockposition.down());
+ IBlockData iblockdata1 = this.world.getBlockStateIfLoaded(blockposition.down()); // Yatopia
if (iblockdata1.a(Blocks.LADDER) && iblockdata1.get(BlockLadder.FACING) == iblockdata.get(BlockTrapdoor.FACING)) {
return true;
2021-06-03 04:37:38 +02:00
@@ -1816,7 +1819,7 @@ public abstract class EntityLiving extends Entity {
int i = MathHelper.floor(this.locX());
int j = MathHelper.floor(this.locY() - 0.20000000298023224D);
int k = MathHelper.floor(this.locZ());
- IBlockData iblockdata = this.world.getType(new BlockPosition(i, j, k));
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(new BlockPosition(i, j, k)); // Yatopia
if (!iblockdata.isAir()) {
SoundEffectType soundeffecttype = iblockdata.getStepSound();
2021-06-03 04:37:38 +02:00
@@ -2289,7 +2292,7 @@ public abstract class EntityLiving extends Entity {
private void a(Entity entity) {
Vec3D vec3d;
- if (!entity.dead && !this.world.getType(entity.getChunkCoordinates()).getBlock().a((Tag) TagsBlock.PORTALS)) {
+ if (!entity.dead && !this.world.getBlockStateIfLoaded(entity.getChunkCoordinates()).getBlock().a((Tag) TagsBlock.PORTALS)) { // Yatopia
vec3d = entity.b(this);
} else {
vec3d = new Vec3D(entity.locX(), entity.locY() + (double) entity.getHeight(), entity.locZ());
2021-06-03 04:37:38 +02:00
@@ -2343,7 +2346,7 @@ public abstract class EntityLiving extends Entity {
this.fallDistance = 0.0F;
}
- Fluid fluid = this.world.getFluid(this.getChunkCoordinates());
+ Fluid fluid = this.world.getFluidStateIfLoaded(this.getChunkCoordinates()); // Yatopia
double d1;
float f;
2021-06-03 04:37:38 +02:00
@@ -2459,7 +2462,7 @@ public abstract class EntityLiving extends Entity {
}
} else {
BlockPosition blockposition = this.as();
- float f5 = this.world.getType(blockposition).getBlock().getFrictionFactor();
+ float f5 = this.world.getBlockStateIfLoaded(blockposition).getBlock().getFrictionFactor(); // Yatopia
f = this.onGround ? f5 * 0.91F : 0.91F;
Vec3D vec3d6 = this.a(vec3d, f5);
@@ -3505,7 +3508,7 @@ public abstract class EntityLiving extends Entity {
while (!flag2 && blockposition.getY() > 0) {
BlockPosition blockposition1 = blockposition.down();
- IBlockData iblockdata = world.getType(blockposition1);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(blockposition1); // Yatopia
if (iblockdata.getMaterial().isSolid()) {
flag2 = true;
@@ -3617,7 +3620,7 @@ public abstract class EntityLiving extends Entity {
this.stopRiding();
}
- IBlockData iblockdata = this.world.getType(blockposition);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(blockposition); // Yatopia
if (iblockdata.getBlock() instanceof BlockBed) {
this.world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockBed.OCCUPIED, true), 3);
@@ -3636,7 +3639,7 @@ public abstract class EntityLiving extends Entity {
private boolean x() {
return (Boolean) this.getBedPosition().map((blockposition) -> {
- return this.world.getType(blockposition).getBlock() instanceof BlockBed;
+ return this.world.getBlockStateIfLoaded(blockposition).getBlock() instanceof BlockBed; // Yatopia
}).orElse(false);
}
@@ -3646,7 +3649,7 @@ public abstract class EntityLiving extends Entity {
this.world.getClass();
optional.filter(world::isLoaded).ifPresent((blockposition) -> {
- IBlockData iblockdata = this.world.getType(blockposition);
+ IBlockData iblockdata = this.world.getBlockStateIfLoaded(blockposition); // Yatopia
if (iblockdata.getBlock() instanceof BlockBed) {
this.world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockBed.OCCUPIED, false), 3);
diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java
index d571624244bf3db54ec266cb760407889fc33bf4..b04a785c70126ad3cc60eff47dffc4a913e0dd87 100644
--- a/src/main/java/net/minecraft/world/level/World.java
+++ b/src/main/java/net/minecraft/world/level/World.java
2021-06-03 04:37:38 +02:00
@@ -96,7 +96,9 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.event.block.BlockPhysicsEvent;
// CraftBukkit end
-public abstract class World implements GeneratorAccess, AutoCloseable {
+import net.gegy1000.tictacs.NonBlockingWorldAccess; // Yatopia
+
+public abstract class World implements GeneratorAccess, AutoCloseable, NonBlockingWorldAccess { // Yatopia
protected static final Logger LOGGER = LogManager.getLogger();
public static final Codec<ResourceKey<World>> f = MinecraftKey.a.xmap(ResourceKey.b(IRegistry.L), ResourceKey::a);
diff --git a/src/main/java/net/minecraft/world/level/material/FluidType.java b/src/main/java/net/minecraft/world/level/material/FluidType.java
index 6a60f53407db840150b84f4d2a709cc2e92362a4..bf3300607f9142486dc790a600d4c2ffa998d376 100644
--- a/src/main/java/net/minecraft/world/level/material/FluidType.java
+++ b/src/main/java/net/minecraft/world/level/material/FluidType.java
@@ -38,6 +38,7 @@ public abstract class FluidType {
this.a = fluid;
}
+ public final Fluid getFluidData() { return this.h(); } // Yatopia - OBFHELPER
public final Fluid h() {
return this.a;
}