mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Update to Minecraft 1.21.4
By: md_5 <git@md-5.net>
This commit is contained in:
parent
267ae64dd6
commit
5381ea78f7
125 changed files with 1383 additions and 1093 deletions
|
@ -25,7 +25,7 @@
|
|||
Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -90,14 +106,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
EntityTypes<?> entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack);
|
||||
EntityTypes<?> entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(sourceblock.level().registryAccess(), itemstack);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer worldserver = sourceblock.level();
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -29,6 +29,12 @@
|
||||
@@ -30,7 +30,13 @@
|
||||
import net.minecraft.world.level.block.state.BlockBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
-@SuppressForbidden(a = "System.out setup")
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.util.datafix.fixes.DataConverterFlattenData;
|
||||
+import net.minecraft.util.datafix.fixes.DataConverterMaterialId;
|
||||
+import net.minecraft.util.datafix.fixes.DataConverterSpawnEgg;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
+@SuppressForbidden(reason = "System.out setup")
|
||||
+// CraftBukkit end
|
||||
public class DispenserRegistry {
|
||||
|
||||
public static final PrintStream STDOUT = System.out;
|
||||
@@ -40,6 +46,23 @@
|
||||
@@ -42,6 +48,23 @@
|
||||
|
||||
public static void bootStrap() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
|
@ -37,7 +39,7 @@
|
|||
DispenserRegistry.isBootstrapped = true;
|
||||
Instant instant = Instant.now();
|
||||
|
||||
@@ -59,6 +82,69 @@
|
||||
@@ -61,6 +84,69 @@
|
||||
wrapStreams();
|
||||
DispenserRegistry.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -60,6 +60,17 @@
|
||||
@@ -61,16 +61,28 @@
|
||||
import net.minecraft.world.level.storage.WorldInfo;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -18,9 +18,11 @@
|
|||
public class Main {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -67,8 +78,9 @@
|
||||
|
||||
public Main() {}
|
||||
|
||||
- @SuppressForbidden(a = "System.out needed before bootstrap")
|
||||
+ @SuppressForbidden(reason = "System.out needed before bootstrap") // CraftBukkit - decompile error
|
||||
@DontObfuscate
|
||||
- public static void main(String[] astring) {
|
||||
+ public static void main(final OptionSet optionset) { // CraftBukkit - replaces main(String[] astring)
|
||||
|
@ -29,7 +31,7 @@
|
|||
OptionParser optionparser = new OptionParser();
|
||||
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
||||
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
||||
@@ -94,15 +106,18 @@
|
||||
@@ -96,15 +108,18 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +52,7 @@
|
|||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
@@ -110,14 +125,27 @@
|
||||
@@ -112,14 +127,27 @@
|
||||
DispenserRegistry.validate();
|
||||
SystemUtils.startTimerHackThread();
|
||||
Path path1 = Paths.get("server.properties");
|
||||
|
@ -80,7 +82,7 @@
|
|||
Main.LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath());
|
||||
return;
|
||||
}
|
||||
@@ -127,11 +155,13 @@
|
||||
@@ -129,11 +157,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -97,7 +99,7 @@
|
|||
Dynamic dynamic;
|
||||
|
||||
if (convertable_conversionsession.hasWorldData()) {
|
||||
@@ -172,13 +202,31 @@
|
||||
@@ -174,13 +204,31 @@
|
||||
}
|
||||
|
||||
Dynamic<?> dynamic1 = dynamic;
|
||||
|
@ -130,7 +132,7 @@
|
|||
|
||||
WorldStem worldstem;
|
||||
|
||||
@@ -187,6 +235,7 @@
|
||||
@@ -189,6 +237,7 @@
|
||||
|
||||
worldstem = (WorldStem) SystemUtils.blockUntilDone((executor) -> {
|
||||
return WorldLoader.load(worldloader_c, (worldloader_a) -> {
|
||||
|
@ -138,7 +140,7 @@
|
|||
IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM);
|
||||
|
||||
if (dynamic1 != null) {
|
||||
@@ -199,7 +248,7 @@
|
||||
@@ -201,7 +250,7 @@
|
||||
WorldOptions worldoptions;
|
||||
WorldDimensions worlddimensions;
|
||||
|
||||
|
@ -147,7 +149,7 @@
|
|||
worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
worldoptions = WorldOptions.DEMO_OPTIONS;
|
||||
worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
|
||||
@@ -207,7 +256,7 @@
|
||||
@@ -209,7 +258,7 @@
|
||||
DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties();
|
||||
|
||||
worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(worldloader_a.dataConfiguration().enabledFeatures()), worldloader_a.dataConfiguration());
|
||||
|
@ -156,7 +158,7 @@
|
|||
worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
|
||||
}
|
||||
|
||||
@@ -223,6 +272,7 @@
|
||||
@@ -225,6 +274,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,7 +166,7 @@
|
|||
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess();
|
||||
boolean flag1 = optionset.has(optionspec6);
|
||||
|
||||
@@ -235,20 +285,31 @@
|
||||
@@ -237,20 +287,31 @@
|
||||
SaveData savedata = worldstem.worldData();
|
||||
|
||||
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
|
||||
|
@ -198,7 +200,7 @@
|
|||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
dedicatedserver.halt(true);
|
||||
@@ -257,6 +318,7 @@
|
||||
@@ -259,6 +320,7 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
|
@ -206,7 +208,7 @@
|
|||
} catch (Exception exception1) {
|
||||
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
|
||||
}
|
||||
@@ -293,7 +355,7 @@
|
||||
@@ -295,7 +357,7 @@
|
||||
}
|
||||
|
||||
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistryCustom iregistrycustom, boolean flag1) {
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
- this.forceDifficulty();
|
||||
- this.prepareLevels(worldloadlistener);
|
||||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
profiledduration.finish(true);
|
||||
}
|
||||
@@ -387,23 +448,217 @@
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
@@ -64,12 +75,18 @@
|
||||
commandlistenerwrapper.getServer().forceTimeSynchronization();
|
||||
@@ -65,12 +76,18 @@
|
||||
}
|
||||
|
||||
public static int addTime(CommandListenerWrapper commandlistenerwrapper, int i) {
|
||||
|
@ -53,4 +53,4 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
int j = getDayTime(commandlistenerwrapper.getLevel());
|
||||
commandlistenerwrapper.getServer().forceTimeSynchronization();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -184,6 +184,41 @@
|
||||
@@ -183,6 +183,41 @@
|
||||
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
public class EntityPlayer extends EntityHuman {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -227,7 +262,7 @@
|
||||
@@ -225,7 +260,7 @@
|
||||
private int levitationStartTime;
|
||||
private boolean disconnected;
|
||||
private int requestedViewDistance;
|
||||
|
@ -51,7 +51,7 @@
|
|||
@Nullable
|
||||
private Vec3D startingToFallPosition;
|
||||
@Nullable
|
||||
@@ -261,6 +296,22 @@
|
||||
@@ -259,6 +294,22 @@
|
||||
private int containerCounter;
|
||||
public boolean wonGame;
|
||||
|
||||
|
@ -74,7 +74,7 @@
|
|||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, ClientInformation clientinformation) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -342,6 +393,13 @@
|
||||
@@ -340,6 +391,13 @@
|
||||
public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {
|
||||
EntityPlayer.this.sendSystemMessage(ichatbasecomponent);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@
|
|||
};
|
||||
this.textFilter = minecraftserver.createTextFilterForPlayer(this);
|
||||
this.gameMode = minecraftserver.createGameModeForPlayer(this);
|
||||
@@ -354,14 +412,67 @@
|
||||
@@ -352,14 +410,67 @@
|
||||
this.moveTo(this.adjustSpawnLocation(worldserver, worldserver.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
|
||||
this.updateOptions(clientinformation);
|
||||
this.object = null;
|
||||
|
@ -157,7 +157,7 @@
|
|||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -397,14 +508,20 @@
|
||||
@@ -395,14 +506,20 @@
|
||||
|
||||
Objects.requireNonNull(blockposition);
|
||||
crashreportsystemdetails.setDetail("Origin", blockposition::toString);
|
||||
|
@ -180,7 +180,7 @@
|
|||
});
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
@@ -442,7 +559,7 @@
|
||||
@@ -440,7 +557,7 @@
|
||||
dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
|
||||
logger = EntityPlayer.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
|
@ -189,7 +189,7 @@
|
|||
this.wardenSpawnTracker = wardenspawntracker;
|
||||
});
|
||||
}
|
||||
@@ -459,17 +576,26 @@
|
||||
@@ -457,17 +574,26 @@
|
||||
return this.server.getRecipeManager().byKey(resourcekey).isPresent();
|
||||
});
|
||||
}
|
||||
|
@ -217,7 +217,7 @@
|
|||
Logger logger1 = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -484,7 +610,7 @@
|
||||
@@ -482,7 +608,7 @@
|
||||
dataresult = BlockPosition.CODEC.parse(DynamicOpsNBT.INSTANCE, nbtbase);
|
||||
logger = EntityPlayer.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
|
@ -226,7 +226,7 @@
|
|||
this.raidOmenPosition = blockposition;
|
||||
});
|
||||
}
|
||||
@@ -494,7 +620,7 @@
|
||||
@@ -492,7 +618,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
|
@ -235,7 +235,7 @@
|
|||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -528,6 +654,7 @@
|
||||
@@ -526,6 +652,7 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
|
@ -243,7 +243,7 @@
|
|||
|
||||
nbttagcompound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
|
||||
if (this.raidOmenPosition != null) {
|
||||
@@ -546,7 +673,20 @@
|
||||
@@ -544,7 +671,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
|
@ -265,7 +265,7 @@
|
|||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
|
||||
@@ -600,12 +740,12 @@
|
||||
@@ -598,12 +738,12 @@
|
||||
|
||||
if (!this.isPassenger()) {
|
||||
EntityPlayer.LOGGER.warn("Couldn't reattach entity to player");
|
||||
|
@ -280,7 +280,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -627,7 +767,7 @@
|
||||
@@ -625,7 +765,7 @@
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
entityenderpearl.save(nbttagcompound1);
|
||||
|
@ -289,7 +289,7 @@
|
|||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -653,7 +793,7 @@
|
||||
@@ -651,7 +791,7 @@
|
||||
nbttaglist.forEach((nbtbase1) -> {
|
||||
if (nbtbase1 instanceof NBTTagCompound nbttagcompound) {
|
||||
if (nbttagcompound.contains("ender_pearl_dimension")) {
|
||||
|
@ -298,7 +298,7 @@
|
|||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -688,6 +828,29 @@
|
||||
@@ -686,6 +826,29 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@
|
|||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -746,6 +909,11 @@
|
||||
@@ -744,6 +907,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
@ -337,10 +337,10 @@
|
|||
+ this.joining = false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.tickClientLoadTimeout();
|
||||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -822,7 +990,7 @@
|
||||
@@ -820,7 +988,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
|
@ -349,7 +349,7 @@
|
|||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -853,6 +1021,12 @@
|
||||
@@ -851,6 +1019,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@
|
|||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -867,6 +1041,20 @@
|
||||
@@ -865,6 +1039,20 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -895,7 +1083,7 @@
|
||||
@@ -893,7 +1081,7 @@
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.serverLevel().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
|
||||
if (this.tickCount % 20 == 0) {
|
||||
if (this.getHealth() < this.getMaxHealth()) {
|
||||
|
@ -392,7 +392,7 @@
|
|||
}
|
||||
|
||||
float f = this.foodData.getSaturationLevel();
|
||||
@@ -948,7 +1136,8 @@
|
||||
@@ -946,7 +1134,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
|
@ -402,7 +402,7 @@
|
|||
scoreaccess.set(i);
|
||||
});
|
||||
}
|
||||
@@ -957,9 +1146,47 @@
|
||||
@@ -955,9 +1144,47 @@
|
||||
public void die(DamageSource damagesource) {
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
boolean flag = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
|
@ -452,7 +452,7 @@
|
|||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -990,12 +1217,18 @@
|
||||
@@ -988,12 +1215,18 @@
|
||||
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
|
@ -475,10 +475,10 @@
|
|||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -1030,10 +1263,12 @@
|
||||
@@ -1028,10 +1261,12 @@
|
||||
public void awardKillScore(Entity entity, DamageSource damagesource) {
|
||||
if (entity != this) {
|
||||
super.awardKillScore(entity, i, damagesource);
|
||||
this.increaseScore(i);
|
||||
super.awardKillScore(entity, damagesource);
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
|
||||
|
@ -490,7 +490,7 @@
|
|||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -1051,7 +1286,8 @@
|
||||
@@ -1049,7 +1284,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
|
@ -500,7 +500,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1101,10 +1337,16 @@
|
||||
@@ -1093,10 +1329,16 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
|
@ -519,7 +519,7 @@
|
|||
BlockPosition blockposition = this.getRespawnPosition();
|
||||
float f = this.getRespawnAngle();
|
||||
boolean flag1 = this.isRespawnForced();
|
||||
@@ -1116,13 +1358,32 @@
|
||||
@@ -1108,13 +1350,32 @@
|
||||
if (optional.isPresent()) {
|
||||
EntityPlayer.RespawnPosAngle entityplayer_respawnposangle = (EntityPlayer.RespawnPosAngle) optional.get();
|
||||
|
||||
|
@ -555,7 +555,7 @@
|
|||
}
|
||||
|
||||
public static Optional<EntityPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(WorldServer worldserver, BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
@@ -1137,11 +1398,11 @@
|
||||
@@ -1129,11 +1390,11 @@
|
||||
}
|
||||
|
||||
return optional.map((vec3d) -> {
|
||||
|
@ -569,7 +569,7 @@
|
|||
});
|
||||
} else if (!flag) {
|
||||
return Optional.empty();
|
||||
@@ -1150,7 +1411,7 @@
|
||||
@@ -1142,7 +1403,7 @@
|
||||
IBlockData iblockdata1 = worldserver.getBlockState(blockposition.above());
|
||||
boolean flag3 = iblockdata1.getBlock().isPossibleToRespawnInThis(iblockdata1);
|
||||
|
||||
|
@ -578,7 +578,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1168,6 +1429,7 @@
|
||||
@@ -1160,6 +1421,7 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityPlayer teleport(TeleportTransition teleporttransition) {
|
||||
|
@ -586,7 +586,7 @@
|
|||
if (this.isRemoved()) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -1177,18 +1439,38 @@
|
||||
@@ -1169,18 +1431,38 @@
|
||||
|
||||
WorldServer worldserver = teleporttransition.newLevel();
|
||||
WorldServer worldserver1 = this.serverLevel();
|
||||
|
@ -628,7 +628,7 @@
|
|||
this.isChangingDimension = true;
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
@@ -1199,17 +1481,31 @@
|
||||
@@ -1191,17 +1473,31 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
|
@ -662,7 +662,7 @@
|
|||
this.connection.resetPosition();
|
||||
worldserver.addDuringTeleport(this);
|
||||
gameprofilerfiller.pop();
|
||||
@@ -1223,11 +1519,29 @@
|
||||
@@ -1215,11 +1511,29 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -692,7 +692,7 @@
|
|||
@Override
|
||||
public void forceSetRotation(float f, float f1) {
|
||||
this.connection.send(new ClientboundPlayerRotationPacket(f, f1));
|
||||
@@ -1236,13 +1550,21 @@
|
||||
@@ -1228,13 +1542,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level().dimension();
|
||||
|
@ -717,7 +717,7 @@
|
|||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -1259,19 +1581,17 @@
|
||||
@@ -1251,19 +1573,17 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@
|
|||
if (this.level().isDay()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
|
||||
} else {
|
||||
@@ -1288,7 +1608,36 @@
|
||||
@@ -1280,7 +1600,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -779,7 +779,7 @@
|
|||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -1301,9 +1650,8 @@
|
||||
@@ -1293,9 +1642,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
|
@ -790,7 +790,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1330,13 +1678,31 @@
|
||||
@@ -1322,13 +1670,31 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
|
@ -823,7 +823,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1403,8 +1769,9 @@
|
||||
@@ -1387,8 +1753,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
|
||||
}
|
||||
|
||||
|
@ -834,7 +834,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1412,13 +1779,35 @@
|
||||
@@ -1396,13 +1763,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -870,7 +870,7 @@
|
|||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1426,9 +1815,11 @@
|
||||
@@ -1410,9 +1799,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -884,7 +884,7 @@
|
|||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1441,15 +1832,26 @@
|
||||
@@ -1425,15 +1816,26 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
|
@ -913,7 +913,7 @@
|
|||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1472,6 +1874,7 @@
|
||||
@@ -1456,6 +1858,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
|
@ -921,7 +921,7 @@
|
|||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1501,19 +1904,19 @@
|
||||
@@ -1485,19 +1888,19 @@
|
||||
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(StatisticList.SWIM_ONE_CM, i);
|
||||
|
@ -944,7 +944,7 @@
|
|||
}
|
||||
} else if (this.onClimbable()) {
|
||||
if (d1 > 0.0D) {
|
||||
@@ -1524,13 +1927,13 @@
|
||||
@@ -1508,13 +1911,13 @@
|
||||
if (i > 0) {
|
||||
if (this.isSprinting()) {
|
||||
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
|
||||
|
@ -961,7 +961,7 @@
|
|||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
@@ -1573,7 +1976,7 @@
|
||||
@@ -1557,7 +1960,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
|
@ -970,7 +970,7 @@
|
|||
scoreaccess.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1581,7 +1984,7 @@
|
||||
@@ -1565,7 +1968,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
|
@ -979,7 +979,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1613,9 +2016,9 @@
|
||||
@@ -1597,9 +2000,9 @@
|
||||
super.jumpFromGround();
|
||||
this.awardStat(StatisticList.JUMP);
|
||||
if (this.isSprinting()) {
|
||||
|
@ -991,7 +991,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1641,6 +2044,7 @@
|
||||
@@ -1625,6 +2028,7 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
|
@ -999,7 +999,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1677,7 +2081,7 @@
|
||||
@@ -1661,7 +2065,7 @@
|
||||
this.onUpdateAbilities();
|
||||
if (flag) {
|
||||
this.getAttributes().assignBaseValues(entityplayer.getAttributes());
|
||||
|
@ -1008,7 +1008,7 @@
|
|||
this.setHealth(entityplayer.getHealth());
|
||||
this.foodData = entityplayer.foodData;
|
||||
Iterator iterator = entityplayer.getActiveEffects().iterator();
|
||||
@@ -1685,7 +2089,7 @@
|
||||
@@ -1669,7 +2073,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
MobEffect mobeffect = (MobEffect) iterator.next();
|
||||
|
||||
|
@ -1017,7 +1017,7 @@
|
|||
}
|
||||
|
||||
this.getInventory().replaceWith(entityplayer.getInventory());
|
||||
@@ -1696,7 +2100,7 @@
|
||||
@@ -1680,7 +2084,7 @@
|
||||
this.portalProcess = entityplayer.portalProcess;
|
||||
} else {
|
||||
this.getAttributes().assignBaseValues(entityplayer.getAttributes());
|
||||
|
@ -1026,7 +1026,7 @@
|
|||
if (this.serverLevel().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || entityplayer.isSpectator()) {
|
||||
this.getInventory().replaceWith(entityplayer.getInventory());
|
||||
this.experienceLevel = entityplayer.experienceLevel;
|
||||
@@ -1712,7 +2116,7 @@
|
||||
@@ -1696,7 +2100,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -1035,16 +1035,16 @@
|
|||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.chunkTrackingView = entityplayer.chunkTrackingView;
|
||||
@@ -1768,7 +2172,7 @@
|
||||
@@ -1752,7 +2156,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<Relative> set, float f, float f1, boolean flag) {
|
||||
+ public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<Relative> set, float f, float f1, boolean flag, TeleportCause cause) { // CraftBukkit
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
|
||||
|
||||
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
|
||||
@@ -1780,7 +2184,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.stopSleepInBed(true, true);
|
||||
}
|
||||
@@ -1761,7 +2165,7 @@
|
||||
this.setCamera(this);
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1053,7 @@
|
|||
|
||||
if (flag1) {
|
||||
this.setYHeadRot(set.contains(Relative.Y_ROT) ? this.getYHeadRot() + f : f);
|
||||
@@ -1897,6 +2301,16 @@
|
||||
@@ -1878,6 +2282,16 @@
|
||||
}
|
||||
|
||||
public void updateOptions(ClientInformation clientinformation) {
|
||||
|
@ -1070,7 +1070,7 @@
|
|||
this.language = clientinformation.language();
|
||||
this.requestedViewDistance = clientinformation.viewDistance();
|
||||
this.chatVisibility = clientinformation.chatVisibility();
|
||||
@@ -1981,7 +2395,7 @@
|
||||
@@ -1962,7 +2376,7 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
|
@ -1079,7 +1079,7 @@
|
|||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -2018,11 +2432,11 @@
|
||||
@@ -1999,11 +2413,11 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
|
@ -1093,7 +1093,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -2065,6 +2479,32 @@
|
||||
@@ -2046,6 +2460,32 @@
|
||||
}
|
||||
|
||||
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
|
@ -1126,7 +1126,7 @@
|
|||
if (blockposition != null) {
|
||||
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
||||
|
||||
@@ -2107,12 +2547,38 @@
|
||||
@@ -2088,12 +2528,38 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1166,7 +1166,7 @@
|
|||
this.level().addFreshEntity(entityitem);
|
||||
ItemStack itemstack1 = entityitem.getItem();
|
||||
|
||||
@@ -2394,10 +2860,12 @@
|
||||
@@ -2375,10 +2841,12 @@
|
||||
return TicketType.ENDER_PEARL.timeout();
|
||||
}
|
||||
|
||||
|
@ -1182,7 +1182,7 @@
|
|||
}
|
||||
|
||||
private static float calculateLookAtYaw(Vec3D vec3d, BlockPosition blockposition) {
|
||||
@@ -2406,4 +2874,146 @@
|
||||
@@ -2387,4 +2855,146 @@
|
||||
return (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/server/level/TicketType.java
|
||||
+++ b/net/minecraft/server/level/TicketType.java
|
||||
@@ -23,6 +23,8 @@
|
||||
@@ -22,6 +22,8 @@
|
||||
public static final TicketType<BlockPosition> PORTAL = create("portal", BaseBlockPosition::compareTo, 300);
|
||||
public static final TicketType<ChunkCoordIntPair> ENDER_PEARL = create("ender_pearl", Comparator.comparingLong(ChunkCoordIntPair::toLong), 40);
|
||||
public static final TicketType<Integer> POST_TELEPORT = create("post_teleport", Integer::compareTo, 5);
|
||||
public static final TicketType<ChunkCoordIntPair> UNKNOWN = create("unknown", Comparator.comparingLong(ChunkCoordIntPair::toLong), 1);
|
||||
+ public static final TicketType<Unit> PLUGIN = create("plugin", (a, b) -> 0); // CraftBukkit
|
||||
+ public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = create("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -173,6 +173,23 @@
|
||||
@@ -174,6 +174,23 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
public class WorldServer extends World implements ServerEntityGetter, GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -186,7 +203,7 @@
|
||||
@@ -187,7 +204,7 @@
|
||||
final List<EntityPlayer> players = Lists.newArrayList();
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
|
@ -33,7 +33,7 @@
|
|||
private int lastSpawnChunkRadius;
|
||||
final EntityTickList entityTickList = new EntityTickList();
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
@@ -213,13 +230,47 @@
|
||||
@@ -214,13 +231,47 @@
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
|
||||
|
@ -83,7 +83,7 @@
|
|||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
||||
@@ -247,9 +298,9 @@
|
||||
@@ -248,9 +299,9 @@
|
||||
long l = minecraftserver.getWorldData().worldGenOptions().seed();
|
||||
|
||||
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
|
@ -96,7 +96,7 @@
|
|||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
@@ -259,6 +310,7 @@
|
||||
@@ -260,6 +311,7 @@
|
||||
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
|
||||
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
|
||||
});
|
||||
|
@ -104,7 +104,7 @@
|
|||
}
|
||||
|
||||
/** @deprecated */
|
||||
@@ -304,12 +356,20 @@
|
||||
@@ -305,12 +357,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
|
@ -128,7 +128,7 @@
|
|||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -344,7 +404,7 @@
|
||||
@@ -345,7 +405,7 @@
|
||||
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
|
@ -137,7 +137,7 @@
|
|||
|
||||
if (flag1) {
|
||||
this.resetEmptyTime();
|
||||
@@ -428,7 +488,7 @@
|
||||
@@ -429,7 +489,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
|
@ -146,7 +146,7 @@
|
|||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -455,7 +515,7 @@
|
||||
@@ -456,7 +516,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
|
@ -155,7 +155,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -464,7 +524,7 @@
|
||||
@@ -465,7 +525,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
|
@ -164,7 +164,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -520,7 +580,7 @@
|
||||
@@ -521,7 +581,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition2)) {
|
||||
|
@ -173,7 +173,7 @@
|
|||
}
|
||||
|
||||
if (this.isRaining()) {
|
||||
@@ -536,10 +596,10 @@
|
||||
@@ -537,10 +597,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
|
||||
|
@ -186,7 +186,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -700,6 +760,7 @@
|
||||
@@ -701,6 +761,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@
|
|||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -718,15 +779,48 @@
|
||||
@@ -719,15 +780,48 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
|
@ -245,7 +245,7 @@
|
|||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -762,6 +856,7 @@
|
||||
@@ -763,6 +857,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
|
@ -253,7 +253,7 @@
|
|||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -785,6 +880,7 @@
|
||||
@@ -786,6 +881,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
|
@ -261,7 +261,7 @@
|
|||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -809,6 +905,7 @@
|
||||
@@ -810,6 +906,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
|
@ -269,7 +269,7 @@
|
|||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -826,11 +923,19 @@
|
||||
@@ -827,11 +924,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -290,7 +290,7 @@
|
|||
}
|
||||
|
||||
WorldPersistentData worldpersistentdata = this.getChunkSource().getDataStorage();
|
||||
@@ -902,18 +1007,40 @@
|
||||
@@ -903,18 +1008,40 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
@ -334,7 +334,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -938,24 +1065,37 @@
|
||||
@@ -939,24 +1066,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
|
@ -376,19 +376,19 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -966,13 +1106,35 @@
|
||||
@@ -967,13 +1107,35 @@
|
||||
}
|
||||
|
||||
public void removePlayerImmediately(EntityPlayer entityplayer, Entity.RemovalReason entity_removalreason) {
|
||||
- entityplayer.remove(entity_removalreason);
|
||||
+ entityplayer.remove(entity_removalreason, null); // CraftBukkit - add Bukkit remove cause
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean strikeLightning(Entity entitylightning) {
|
||||
+ return this.strikeLightning(entitylightning, LightningStrikeEvent.Cause.UNKNOWN);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public boolean strikeLightning(Entity entitylightning, LightningStrikeEvent.Cause cause) {
|
||||
+ LightningStrikeEvent lightning = CraftEventFactory.callLightningStrikeEvent((org.bukkit.entity.LightningStrike) entitylightning.getBukkitEntity(), cause);
|
||||
+
|
||||
|
@ -413,7 +413,7 @@
|
|||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -981,6 +1143,12 @@
|
||||
@@ -982,6 +1144,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
|
@ -426,7 +426,7 @@
|
|||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1059,7 +1227,18 @@
|
||||
@@ -1060,7 +1228,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -446,7 +446,7 @@
|
|||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1125,6 +1304,12 @@
|
||||
@@ -1126,6 +1305,12 @@
|
||||
|
||||
@Override
|
||||
public void explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, Holder<SoundEffect> holder) {
|
||||
|
@ -459,7 +459,7 @@
|
|||
Explosion.Effect explosion_effect;
|
||||
|
||||
switch (world_a) {
|
||||
@@ -1143,6 +1328,11 @@
|
||||
@@ -1144,6 +1329,11 @@
|
||||
case TRIGGER:
|
||||
explosion_effect = Explosion.Effect.TRIGGER_BLOCK;
|
||||
break;
|
||||
|
@ -471,7 +471,7 @@
|
|||
default:
|
||||
throw new MatchException((String) null, (Throwable) null);
|
||||
}
|
||||
@@ -1152,6 +1342,11 @@
|
||||
@@ -1153,6 +1343,11 @@
|
||||
ServerExplosion serverexplosion = new ServerExplosion(this, entity, damagesource, explosiondamagecalculator, vec3d, f, flag, explosion_effect1);
|
||||
|
||||
serverexplosion.explode();
|
||||
|
@ -483,7 +483,7 @@
|
|||
ParticleParam particleparam2 = serverexplosion.isSmall() ? particleparam : particleparam1;
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -1165,6 +1360,7 @@
|
||||
@@ -1166,6 +1361,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -491,30 +491,28 @@
|
|||
}
|
||||
|
||||
private Explosion.Effect getDestroyType(GameRules.GameRuleKey<GameRules.GameRuleBoolean> gamerules_gamerulekey) {
|
||||
@@ -1225,13 +1421,20 @@
|
||||
@@ -1226,15 +1422,18 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
- PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, false, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
|
||||
- return this.sendParticles(t0, false, false, d0, d1, d2, i, d3, d4, d5, d6);
|
||||
+ // CraftBukkit - visibility api support
|
||||
+ return sendParticles(null, t0, d0, d1, d2, i, d3, d4, d5, d6, false);
|
||||
+ }
|
||||
+
|
||||
+ public <T extends ParticleParam> int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
|
||||
+ PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
|
||||
+ return this.sendParticlesSource(null, t0, false, false, d0, d1, d2, i, d3, d4, d5, d6);
|
||||
}
|
||||
|
||||
- public <T extends ParticleParam> int sendParticles(T t0, boolean flag, boolean flag1, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
+ public <T extends ParticleParam> int sendParticlesSource(EntityPlayer sender, T t0, boolean flag, boolean flag1, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
+ // CraftBukkit end
|
||||
PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, flag, flag1, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
|
||||
int j = 0;
|
||||
|
||||
for (int k = 0; k < this.players.size(); ++k) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(k);
|
||||
+ if (sender != null && !entityplayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit
|
||||
|
||||
- if (this.sendParticles(entityplayer, false, d0, d1, d2, packetplayoutworldparticles)) {
|
||||
+ if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
|
||||
if (this.sendParticles(entityplayer, flag, d0, d1, d2, packetplayoutworldparticles)) {
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1282,7 +1485,7 @@
|
||||
@@ -1292,7 +1491,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
|
@ -523,7 +521,7 @@
|
|||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(tagkey);
|
||||
@@ -1324,11 +1527,22 @@
|
||||
@@ -1334,11 +1533,22 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(MapId mapid) {
|
||||
|
@ -547,7 +545,7 @@
|
|||
this.getServer().overworld().getDataStorage().set(mapid.key(), worldmap);
|
||||
}
|
||||
|
||||
@@ -1639,6 +1853,11 @@
|
||||
@@ -1649,6 +1859,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
|
@ -559,7 +557,7 @@
|
|||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1658,12 +1877,12 @@
|
||||
@@ -1668,12 +1883,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
|
@ -574,7 +572,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1686,7 +1905,7 @@
|
||||
@@ -1696,7 +1911,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
|
@ -583,7 +581,7 @@
|
|||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1695,7 +1914,7 @@
|
||||
@@ -1705,7 +1920,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
|
@ -592,7 +590,7 @@
|
|||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1854,6 +2073,8 @@
|
||||
@@ -1864,6 +2079,8 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
|
@ -601,7 +599,7 @@
|
|||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1885,6 +2106,14 @@
|
||||
@@ -1895,6 +2112,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -196,6 +196,71 @@
|
||||
@@ -198,6 +198,71 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -72,7 +72,7 @@
|
|||
public class PlayerConnection extends ServerCommonPacketListenerImpl implements PacketListenerPlayIn, ServerPlayerConnection, TickablePacketListener {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -245,7 +310,7 @@
|
||||
@@ -247,7 +312,7 @@
|
||||
private boolean waitingForSwitchToConfig;
|
||||
|
||||
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
|
||||
|
@ -81,7 +81,7 @@
|
|||
this.chunkSender = new PlayerChunkSender(networkmanager.isMemoryConnection());
|
||||
this.player = entityplayer;
|
||||
entityplayer.connection = this;
|
||||
@@ -254,9 +319,25 @@
|
||||
@@ -256,9 +321,25 @@
|
||||
|
||||
Objects.requireNonNull(minecraftserver);
|
||||
this.signedMessageDecoder = SignedMessageChain.b.unsigned(uuid, minecraftserver::enforceSecureProfile);
|
||||
|
@ -108,7 +108,7 @@
|
|||
@Override
|
||||
public void tick() {
|
||||
if (this.ackBlockChangesUpTo > -1) {
|
||||
@@ -311,6 +392,7 @@
|
||||
@@ -313,6 +394,7 @@
|
||||
this.chatSpamThrottler.tick();
|
||||
this.dropSpamThrottler.tick();
|
||||
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && SystemUtils.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
|
||||
|
@ -116,7 +116,7 @@
|
|||
this.disconnect((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
|
||||
}
|
||||
|
||||
@@ -374,6 +456,12 @@
|
||||
@@ -376,6 +458,12 @@
|
||||
@Override
|
||||
public void handlePlayerInput(PacketPlayInSteerVehicle packetplayinsteervehicle) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinsteervehicle, this, this.player.serverLevel());
|
||||
|
@ -129,7 +129,7 @@
|
|||
this.player.setLastClientInput(packetplayinsteervehicle.input());
|
||||
}
|
||||
|
||||
@@ -399,6 +487,13 @@
|
||||
@@ -401,6 +489,13 @@
|
||||
|
||||
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
@ -143,7 +143,7 @@
|
|||
double d0 = entity.getX();
|
||||
double d1 = entity.getY();
|
||||
double d2 = entity.getZ();
|
||||
@@ -413,7 +508,33 @@
|
||||
@@ -415,7 +510,33 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
|
@ -176,9 +176,9 @@
|
|||
+ if (d10 - d9 > Math.max(100.0D, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||
+ // CraftBukkit end
|
||||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
||||
this.send(new PacketPlayOutVehicleMove(entity));
|
||||
this.send(PacketPlayOutVehicleMove.fromEntity(entity));
|
||||
return;
|
||||
@@ -453,14 +574,76 @@
|
||||
@@ -455,14 +576,67 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
|
@ -188,7 +188,7 @@
|
|||
if (flag && (flag2 || !flag3)) {
|
||||
entity.absMoveTo(d0, d1, d2, f, f1);
|
||||
+ player.absMoveTo(d0, d1, d2, this.player.getYRot(), this.player.getXRot()); // CraftBukkit
|
||||
this.send(new PacketPlayOutVehicleMove(entity));
|
||||
this.send(PacketPlayOutVehicleMove.fromEntity(entity));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,16 +203,7 @@
|
|||
+ this.hasMoved = true;
|
||||
+ }
|
||||
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
|
||||
+ Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
|
||||
+
|
||||
+ // If the packet contains movement information then we update the To location with the correct XYZ.
|
||||
+ to.setX(packetplayinvehiclemove.getX());
|
||||
+ to.setY(packetplayinvehiclemove.getY());
|
||||
+ to.setZ(packetplayinvehiclemove.getZ());
|
||||
+
|
||||
+ // If the packet contains look information then we update the To location with the correct Yaw & Pitch.
|
||||
+ to.setYaw(packetplayinvehiclemove.getYRot());
|
||||
+ to.setPitch(packetplayinvehiclemove.getXRot());
|
||||
+ Location to = CraftLocation.toBukkit(packetplayinvehiclemove.position(), player.getWorld(), packetplayinvehiclemove.yRot(), packetplayinvehiclemove.xRot());
|
||||
+
|
||||
+ // Prevent 40 event-calls for less than a single pixel of movement >.>
|
||||
+ double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + Math.pow(this.lastPosZ - to.getZ(), 2);
|
||||
|
@ -255,15 +246,15 @@
|
|||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
entity.recordMovementThroughBlocks(new Vec3D(d0, d1, d2), entity.position());
|
||||
Vec3D vec3d = new Vec3D(entity.getX() - d0, entity.getY() - d1, entity.getZ() - d2);
|
||||
@@ -498,6 +681,7 @@
|
||||
}
|
||||
|
||||
@@ -499,6 +673,7 @@
|
||||
this.lastGoodZ = this.awaitingPositionFromClient.z;
|
||||
this.player.hasChangedDimension();
|
||||
this.awaitingPositionFromClient = null;
|
||||
+ this.player.serverLevel().getChunkSource().move(this.player); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -521,6 +705,7 @@
|
||||
@@ -528,6 +703,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookChangeSettingsPacket(PacketPlayInRecipeSettings packetplayinrecipesettings) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipesettings, this, this.player.serverLevel());
|
||||
|
@ -271,7 +262,7 @@
|
|||
this.player.getRecipeBook().setBookSetting(packetplayinrecipesettings.getBookType(), packetplayinrecipesettings.isOpen(), packetplayinrecipesettings.isFiltering());
|
||||
}
|
||||
|
||||
@@ -541,6 +726,12 @@
|
||||
@@ -548,6 +724,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
|
||||
|
@ -284,7 +275,7 @@
|
|||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -550,6 +741,7 @@
|
||||
@@ -557,6 +739,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
|
@ -292,7 +283,7 @@
|
|||
Suggestions suggestions1 = suggestions.getList().size() <= 1000 ? suggestions : new Suggestions(suggestions.getRange(), suggestions.getList().subList(0, 1000));
|
||||
|
||||
this.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions1));
|
||||
@@ -796,6 +988,13 @@
|
||||
@@ -866,6 +1049,13 @@
|
||||
Container container = this.player.containerMenu;
|
||||
|
||||
if (container instanceof ContainerMerchant containermerchant) {
|
||||
|
@ -306,7 +297,7 @@
|
|||
if (!containermerchant.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
|
||||
return;
|
||||
@@ -809,6 +1008,13 @@
|
||||
@@ -879,6 +1069,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
|
@ -320,7 +311,7 @@
|
|||
int i = packetplayinbedit.slot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -829,12 +1035,16 @@
|
||||
@@ -899,12 +1096,16 @@
|
||||
}
|
||||
|
||||
private void updateBookContents(List<FilteredText> list, int i) {
|
||||
|
@ -338,7 +329,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -845,12 +1055,13 @@
|
||||
@@ -915,12 +1116,13 @@
|
||||
ItemStack itemstack1 = itemstack.transmuteCopy(Items.WRITTEN_BOOK);
|
||||
|
||||
itemstack1.remove(DataComponents.WRITABLE_BOOK_CONTENT);
|
||||
|
@ -354,7 +345,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -912,7 +1123,7 @@
|
||||
@@ -982,7 +1184,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
||||
|
@ -363,7 +354,7 @@
|
|||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -927,7 +1138,15 @@
|
||||
@@ -997,7 +1199,15 @@
|
||||
if (this.player.isPassenger()) {
|
||||
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
|
@ -379,7 +370,7 @@
|
|||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -949,15 +1168,33 @@
|
||||
@@ -1019,15 +1229,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
|
@ -415,7 +406,7 @@
|
|||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -979,6 +1216,7 @@
|
||||
@@ -1049,6 +1277,7 @@
|
||||
boolean flag2 = this.player.verticalCollisionBelow;
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
|
||||
|
@ -423,7 +414,7 @@
|
|||
double d11 = d7;
|
||||
|
||||
d6 = d0 - this.player.getX();
|
||||
@@ -997,9 +1235,75 @@
|
||||
@@ -1067,9 +1296,75 @@
|
||||
}
|
||||
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag3 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
|
||||
|
@ -500,7 +491,7 @@
|
|||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
boolean flag4 = this.player.isAutoSpinAttack();
|
||||
|
||||
@@ -1049,6 +1353,7 @@
|
||||
@@ -1119,6 +1414,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
|
@ -508,7 +499,7 @@
|
|||
|
||||
return true;
|
||||
} else {
|
||||
@@ -1077,10 +1382,62 @@
|
||||
@@ -1147,10 +1443,62 @@
|
||||
}
|
||||
|
||||
public void teleport(double d0, double d1, double d2, float f, float f1) {
|
||||
|
@ -572,7 +563,7 @@
|
|||
this.awaitingTeleportTime = this.tickCount;
|
||||
if (++this.awaitingTeleport == Integer.MAX_VALUE) {
|
||||
this.awaitingTeleport = 0;
|
||||
@@ -1088,12 +1445,20 @@
|
||||
@@ -1158,12 +1506,20 @@
|
||||
|
||||
this.player.teleportSetPosition(positionmoverotation, set);
|
||||
this.awaitingPositionFromClient = this.player.position();
|
||||
|
@ -590,131 +581,131 @@
|
|||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
if (this.player.hasClientLoaded()) {
|
||||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1104,14 +1469,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
@@ -1175,14 +1531,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
- this.player.setItemInHand(EnumHand.OFF_HAND, this.player.getItemInHand(EnumHand.MAIN_HAND));
|
||||
- this.player.setItemInHand(EnumHand.MAIN_HAND, itemstack);
|
||||
+ // CraftBukkit start - inspiration taken from DispenserRegistry (See SpigotCraft#394)
|
||||
+ CraftItemStack mainHand = CraftItemStack.asCraftMirror(itemstack);
|
||||
+ CraftItemStack offHand = CraftItemStack.asCraftMirror(this.player.getItemInHand(EnumHand.MAIN_HAND));
|
||||
+ PlayerSwapHandItemsEvent swapItemsEvent = new PlayerSwapHandItemsEvent(getCraftPlayer(), mainHand.clone(), offHand.clone());
|
||||
+ this.cserver.getPluginManager().callEvent(swapItemsEvent);
|
||||
+ if (swapItemsEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (swapItemsEvent.getOffHandItem().equals(offHand)) {
|
||||
+ this.player.setItemInHand(EnumHand.OFF_HAND, this.player.getItemInHand(EnumHand.MAIN_HAND));
|
||||
+ } else {
|
||||
+ this.player.setItemInHand(EnumHand.OFF_HAND, CraftItemStack.asNMSCopy(swapItemsEvent.getOffHandItem()));
|
||||
+ }
|
||||
+ if (swapItemsEvent.getMainHandItem().equals(mainHand)) {
|
||||
+ this.player.setItemInHand(EnumHand.MAIN_HAND, itemstack);
|
||||
+ } else {
|
||||
+ this.player.setItemInHand(EnumHand.MAIN_HAND, CraftItemStack.asNMSCopy(swapItemsEvent.getMainHandItem()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
|
||||
return;
|
||||
case DROP_ITEM:
|
||||
if (!this.player.isSpectator()) {
|
||||
+ // limit how quickly items can be dropped
|
||||
+ // If the ticks aren't the same then the count starts from 0 and we update the lastDropTick.
|
||||
+ if (this.lastDropTick != MinecraftServer.currentTick) {
|
||||
+ this.dropCount = 0;
|
||||
+ this.lastDropTick = MinecraftServer.currentTick;
|
||||
+ } else {
|
||||
+ // Else we increment the drop count and check the amount.
|
||||
+ this.dropCount++;
|
||||
+ if (this.dropCount >= 20) {
|
||||
+ LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
|
||||
+ this.disconnect(IChatBaseComponent.literal("You dropped your items too quickly (Hacking?)"));
|
||||
- this.player.setItemInHand(EnumHand.OFF_HAND, this.player.getItemInHand(EnumHand.MAIN_HAND));
|
||||
- this.player.setItemInHand(EnumHand.MAIN_HAND, itemstack);
|
||||
+ // CraftBukkit start - inspiration taken from DispenserRegistry (See SpigotCraft#394)
|
||||
+ CraftItemStack mainHand = CraftItemStack.asCraftMirror(itemstack);
|
||||
+ CraftItemStack offHand = CraftItemStack.asCraftMirror(this.player.getItemInHand(EnumHand.MAIN_HAND));
|
||||
+ PlayerSwapHandItemsEvent swapItemsEvent = new PlayerSwapHandItemsEvent(getCraftPlayer(), mainHand.clone(), offHand.clone());
|
||||
+ this.cserver.getPluginManager().callEvent(swapItemsEvent);
|
||||
+ if (swapItemsEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.player.drop(false);
|
||||
}
|
||||
+ if (swapItemsEvent.getOffHandItem().equals(offHand)) {
|
||||
+ this.player.setItemInHand(EnumHand.OFF_HAND, this.player.getItemInHand(EnumHand.MAIN_HAND));
|
||||
+ } else {
|
||||
+ this.player.setItemInHand(EnumHand.OFF_HAND, CraftItemStack.asNMSCopy(swapItemsEvent.getOffHandItem()));
|
||||
+ }
|
||||
+ if (swapItemsEvent.getMainHandItem().equals(mainHand)) {
|
||||
+ this.player.setItemInHand(EnumHand.MAIN_HAND, itemstack);
|
||||
+ } else {
|
||||
+ this.player.setItemInHand(EnumHand.MAIN_HAND, CraftItemStack.asNMSCopy(swapItemsEvent.getMainHandItem()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
|
||||
@@ -1149,6 +1546,7 @@
|
||||
return;
|
||||
case DROP_ITEM:
|
||||
if (!this.player.isSpectator()) {
|
||||
+ // limit how quickly items can be dropped
|
||||
+ // If the ticks aren't the same then the count starts from 0 and we update the lastDropTick.
|
||||
+ if (this.lastDropTick != MinecraftServer.currentTick) {
|
||||
+ this.dropCount = 0;
|
||||
+ this.lastDropTick = MinecraftServer.currentTick;
|
||||
+ } else {
|
||||
+ // Else we increment the drop count and check the amount.
|
||||
+ this.dropCount++;
|
||||
+ if (this.dropCount >= 20) {
|
||||
+ LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
|
||||
+ this.disconnect(IChatBaseComponent.literal("You dropped your items too quickly (Hacking?)"));
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1221,6 +1609,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
@@ -1171,6 +1569,7 @@
|
||||
if (this.player.hasClientLoaded()) {
|
||||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
@@ -1244,6 +1633,7 @@
|
||||
|
||||
if (blockposition.getY() <= i) {
|
||||
if (this.awaitingPositionFromClient == null && worldserver.mayInteract(this.player, blockposition)) {
|
||||
+ this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
if (blockposition.getY() <= i) {
|
||||
if (this.awaitingPositionFromClient == null && worldserver.mayInteract(this.player, blockposition)) {
|
||||
+ this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
@@ -1207,6 +1606,7 @@
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
@@ -1281,6 +1671,7 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinblockplace.getHand();
|
||||
@@ -1221,6 +1621,47 @@
|
||||
this.player.absRotateTo(f, f1);
|
||||
}
|
||||
if (this.player.hasClientLoaded()) {
|
||||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
@@ -1296,6 +1687,47 @@
|
||||
this.player.absRotateTo(f, f1);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ // Raytrace to look for 'rogue armswings'
|
||||
+ double d0 = this.player.getX();
|
||||
+ double d1 = this.player.getY() + (double) this.player.getEyeHeight();
|
||||
+ double d2 = this.player.getZ();
|
||||
+ Vec3D vec3d = new Vec3D(d0, d1, d2);
|
||||
+ // CraftBukkit start
|
||||
+ // Raytrace to look for 'rogue armswings'
|
||||
+ double d0 = this.player.getX();
|
||||
+ double d1 = this.player.getY() + (double) this.player.getEyeHeight();
|
||||
+ double d2 = this.player.getZ();
|
||||
+ Vec3D vec3d = new Vec3D(d0, d1, d2);
|
||||
+
|
||||
+ float f3 = MathHelper.cos(-f * 0.017453292F - 3.1415927F);
|
||||
+ float f4 = MathHelper.sin(-f * 0.017453292F - 3.1415927F);
|
||||
+ float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
+ float f7 = f4 * f5;
|
||||
+ float f8 = f3 * f5;
|
||||
+ double d3 = player.blockInteractionRange();
|
||||
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
+ MovingObjectPosition movingobjectposition = this.player.level().clip(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));
|
||||
+ float f3 = MathHelper.cos(-f * 0.017453292F - 3.1415927F);
|
||||
+ float f4 = MathHelper.sin(-f * 0.017453292F - 3.1415927F);
|
||||
+ float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
+ float f7 = f4 * f5;
|
||||
+ float f8 = f3 * f5;
|
||||
+ double d3 = player.blockInteractionRange();
|
||||
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
+ MovingObjectPosition movingobjectposition = this.player.level().clip(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));
|
||||
+
|
||||
+ boolean cancelled;
|
||||
+ if (movingobjectposition == null || movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand);
|
||||
+ cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
+ } else {
|
||||
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.isSameItemSameComponents(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ cancelled = player.gameMode.interactResult;
|
||||
+ } else {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand, movingobjectpositionblock.getLocation());
|
||||
+ boolean cancelled;
|
||||
+ if (movingobjectposition == null || movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand);
|
||||
+ cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
+ } else {
|
||||
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.isSameItemSameComponents(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ cancelled = player.gameMode.interactResult;
|
||||
+ } else {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand, movingobjectpositionblock.getLocation());
|
||||
+ cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
+ }
|
||||
+ player.gameMode.firedInteract = false;
|
||||
+ }
|
||||
+ player.gameMode.firedInteract = false;
|
||||
+ }
|
||||
+
|
||||
+ if (cancelled) {
|
||||
+ this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
|
||||
+ return;
|
||||
+ }
|
||||
+ itemstack = this.player.getItemInHand(enumhand); // Update in case it was changed in the event
|
||||
+ if (itemstack.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
+ if (cancelled) {
|
||||
+ this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524
|
||||
+ return;
|
||||
+ }
|
||||
+ itemstack = this.player.getItemInHand(enumhand); // Update in case it was changed in the event
|
||||
+ if (itemstack.isEmpty()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult instanceof EnumInteractionResult.d) {
|
||||
@@ -1245,7 +1686,7 @@
|
||||
if (enuminteractionresult instanceof EnumInteractionResult.d) {
|
||||
@@ -1321,7 +1753,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
|
@ -723,7 +714,7 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -1266,6 +1707,13 @@
|
||||
@@ -1342,6 +1774,13 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(DisconnectionDetails disconnectiondetails) {
|
||||
|
@ -737,7 +728,7 @@
|
|||
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), disconnectiondetails.reason().getString());
|
||||
this.removePlayerFromWorld();
|
||||
super.onDisconnect(disconnectiondetails);
|
||||
@@ -1273,10 +1721,18 @@
|
||||
@@ -1349,10 +1788,18 @@
|
||||
|
||||
private void removePlayerFromWorld() {
|
||||
this.chatMessageChain.close();
|
||||
|
@ -757,7 +748,7 @@
|
|||
this.player.getTextFilter().leave();
|
||||
}
|
||||
|
||||
@@ -1291,7 +1747,16 @@
|
||||
@@ -1367,7 +1814,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
|
||||
|
@ -774,7 +765,7 @@
|
|||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1300,11 +1765,18 @@
|
||||
@@ -1376,11 +1832,18 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
|
@ -793,7 +784,7 @@
|
|||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packetplayinchat.lastSeenMessages());
|
||||
|
||||
if (!optional.isEmpty()) {
|
||||
@@ -1318,7 +1790,7 @@
|
||||
@@ -1394,7 +1857,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -802,7 +793,7 @@
|
|||
IChatBaseComponent ichatbasecomponent = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent());
|
||||
|
||||
this.chatMessageChain.append(completablefuture, (filteredtext) -> {
|
||||
@@ -1326,19 +1798,36 @@
|
||||
@@ -1402,19 +1865,36 @@
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
});
|
||||
|
@ -841,7 +832,7 @@
|
|||
ParseResults<CommandListenerWrapper> parseresults = this.parseCommand(s);
|
||||
|
||||
if (this.server.enforceSecureProfile() && SignableCommand.hasSignableArguments(parseresults)) {
|
||||
@@ -1355,19 +1844,37 @@
|
||||
@@ -1431,19 +1911,37 @@
|
||||
|
||||
if (!optional.isEmpty()) {
|
||||
this.tryHandleChat(serverboundchatcommandsignedpacket.command(), () -> {
|
||||
|
@ -882,7 +873,7 @@
|
|||
} catch (SignedMessageChain.a signedmessagechain_a) {
|
||||
this.handleMessageDecodeFailure(signedmessagechain_a);
|
||||
return;
|
||||
@@ -1375,10 +1882,10 @@
|
||||
@@ -1451,10 +1949,10 @@
|
||||
|
||||
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
|
||||
|
||||
|
@ -895,7 +886,7 @@
|
|||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
|
||||
@@ -1454,14 +1961,20 @@
|
||||
@@ -1530,14 +2028,20 @@
|
||||
return com_mojang_brigadier_commanddispatcher.parse(s, this.player.createCommandSourceStack());
|
||||
}
|
||||
|
||||
|
@ -919,7 +910,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1490,6 +2003,116 @@
|
||||
@@ -1566,6 +2070,116 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1036,7 +1027,7 @@
|
|||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
|
||||
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
|
||||
|
||||
@@ -1497,13 +2120,33 @@
|
||||
@@ -1573,13 +2187,33 @@
|
||||
}
|
||||
|
||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
|
||||
|
@ -1073,7 +1064,7 @@
|
|||
this.disconnect((IChatBaseComponent) IChatBaseComponent.translatable("disconnect.spam"));
|
||||
}
|
||||
|
||||
@@ -1525,13 +2168,62 @@
|
||||
@@ -1601,7 +2235,33 @@
|
||||
@Override
|
||||
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
|
||||
|
@ -1107,36 +1098,37 @@
|
|||
this.player.swing(packetplayinarmanimation.getHand());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1609,6 +2269,29 @@
|
||||
public void handlePlayerCommand(PacketPlayInEntityAction packetplayinentityaction) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinentityaction, this, this.player.serverLevel());
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player.isRemoved()) return;
|
||||
+ switch (packetplayinentityaction.getAction()) {
|
||||
+ case PRESS_SHIFT_KEY:
|
||||
+ case RELEASE_SHIFT_KEY:
|
||||
+ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getCraftPlayer(), packetplayinentityaction.getAction() == PacketPlayInEntityAction.EnumPlayerAction.PRESS_SHIFT_KEY);
|
||||
+ this.cserver.getPluginManager().callEvent(event);
|
||||
if (this.player.hasClientLoaded()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player.isRemoved()) return;
|
||||
+ switch (packetplayinentityaction.getAction()) {
|
||||
+ case PRESS_SHIFT_KEY:
|
||||
+ case RELEASE_SHIFT_KEY:
|
||||
+ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getCraftPlayer(), packetplayinentityaction.getAction() == PacketPlayInEntityAction.EnumPlayerAction.PRESS_SHIFT_KEY);
|
||||
+ this.cserver.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ break;
|
||||
+ case START_SPRINTING:
|
||||
+ case STOP_SPRINTING:
|
||||
+ PlayerToggleSprintEvent e2 = new PlayerToggleSprintEvent(this.getCraftPlayer(), packetplayinentityaction.getAction() == PacketPlayInEntityAction.EnumPlayerAction.START_SPRINTING);
|
||||
+ this.cserver.getPluginManager().callEvent(e2);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ break;
|
||||
+ case START_SPRINTING:
|
||||
+ case STOP_SPRINTING:
|
||||
+ PlayerToggleSprintEvent e2 = new PlayerToggleSprintEvent(this.getCraftPlayer(), packetplayinentityaction.getAction() == PacketPlayInEntityAction.EnumPlayerAction.START_SPRINTING);
|
||||
+ this.cserver.getPluginManager().callEvent(e2);
|
||||
+
|
||||
+ if (e2.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.player.resetLastActionTime();
|
||||
Entity entity;
|
||||
|
||||
@@ -1608,6 +2300,12 @@
|
||||
+ if (e2.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.player.resetLastActionTime();
|
||||
Entity entity;
|
||||
IJumpable ijumpable;
|
||||
@@ -1691,6 +2374,12 @@
|
||||
}
|
||||
|
||||
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
|
||||
|
@ -1149,104 +1141,104 @@
|
|||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a));
|
||||
this.addPendingMessage(playerchatmessage);
|
||||
}
|
||||
@@ -1635,6 +2333,7 @@
|
||||
@@ -1718,6 +2407,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
final WorldServer worldserver = this.player.serverLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
if (this.player.hasClientLoaded()) {
|
||||
final WorldServer worldserver = this.player.serverLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
@@ -1733,13 +2423,51 @@
|
||||
|
||||
@@ -1649,13 +2348,51 @@
|
||||
if (this.player.canInteractWithEntity(axisalignedbb, 3.0D)) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
- private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a) {
|
||||
+ private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
|
||||
ItemStack itemstack = PlayerConnection.this.player.getItemInHand(enumhand);
|
||||
|
||||
if (this.player.canInteractWithEntity(axisalignedbb, 3.0D)) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
- private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a) {
|
||||
+ private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
|
||||
ItemStack itemstack = PlayerConnection.this.player.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemInHand = PlayerConnection.this.player.getItemInHand(enumhand);
|
||||
+ boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEAD && entity instanceof EntityInsentient;
|
||||
+ Item origItem = player.getInventory().getSelected() == null ? null : player.getInventory().getSelected().getItem();
|
||||
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemInHand = PlayerConnection.this.player.getItemInHand(enumhand);
|
||||
+ boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEAD && entity instanceof EntityInsentient;
|
||||
+ Item origItem = player.getInventory().getSelected() == null ? null : player.getInventory().getSelected().getItem();
|
||||
+
|
||||
+ cserver.getPluginManager().callEvent(event);
|
||||
+ cserver.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
||||
+ if ((entity instanceof Bucketable && entity instanceof EntityLiving && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ entity.getBukkitEntity().update(player);
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+
|
||||
+ if (triggerLeashUpdate && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ // Refresh the current leash state
|
||||
+ send(new PacketPlayOutAttachEntity(entity, ((EntityInsentient) entity).getLeashHolder()));
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem) {
|
||||
+ // Refresh the current entity metadata
|
||||
+ entity.refreshEntityData(player);
|
||||
+ // SPIGOT-7136 - Allays
|
||||
+ if (entity instanceof Allay) {
|
||||
+ send(new PacketPlayOutEntityEquipment(entity.getId(), Arrays.stream(EnumItemSlot.values()).map((slot) -> Pair.of(slot, ((EntityLiving) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
+ // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
||||
+ if ((entity instanceof Bucketable && entity instanceof EntityLiving && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ entity.getBukkitEntity().update(player);
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EnumInteractionResult enuminteractionresult = playerconnection_a.run(PlayerConnection.this.player, entity, enumhand);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ if (triggerLeashUpdate && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ // Refresh the current leash state
|
||||
+ send(new PacketPlayOutAttachEntity(entity, ((EntityInsentient) entity).getLeashHolder()));
|
||||
+ }
|
||||
+
|
||||
if (enuminteractionresult instanceof EnumInteractionResult.d) {
|
||||
EnumInteractionResult.d enuminteractionresult_d = (EnumInteractionResult.d) enuminteractionresult;
|
||||
ItemStack itemstack2 = enuminteractionresult_d.wasItemInteraction() ? itemstack1 : ItemStack.EMPTY;
|
||||
@@ -1671,19 +2408,20 @@
|
||||
+ if (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem) {
|
||||
+ // Refresh the current entity metadata
|
||||
+ entity.refreshEntityData(player);
|
||||
+ // SPIGOT-7136 - Allays
|
||||
+ if (entity instanceof Allay) {
|
||||
+ send(new PacketPlayOutEntityEquipment(entity.getId(), Arrays.stream(EnumItemSlot.values()).map((slot) -> Pair.of(slot, ((EntityLiving) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EnumInteractionResult enuminteractionresult = playerconnection_a.run(PlayerConnection.this.player, entity, enumhand);
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
- this.performInteraction(enumhand, EntityHuman::interactOn);
|
||||
+ this.performInteraction(enumhand, EntityHuman::interactOn, new PlayerInteractEntityEvent(getCraftPlayer(), entity.getBukkitEntity(), (enumhand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND)); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand, Vec3D vec3d) {
|
||||
this.performInteraction(enumhand, (entityplayer, entity1, enumhand1) -> {
|
||||
return entity1.interactAt(entityplayer, vec3d, enumhand1);
|
||||
- });
|
||||
+ }, new PlayerInteractAtEntityEvent(getCraftPlayer(), entity.getBukkitEntity(), new org.bukkit.util.Vector(vec3d.x, vec3d.y, vec3d.z), (enumhand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND)); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttack() {
|
||||
- if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && entity != PlayerConnection.this.player) {
|
||||
+ // CraftBukkit
|
||||
+ if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && (entity != PlayerConnection.this.player || player.isSpectator())) {
|
||||
label23:
|
||||
{
|
||||
if (entity instanceof EntityArrow) {
|
||||
@@ -1701,6 +2439,11 @@
|
||||
}
|
||||
|
||||
PlayerConnection.this.player.attack(entity);
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemstack.isEmpty() && itemstack.getCount() <= -1) {
|
||||
+ if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return;
|
||||
}
|
||||
+
|
||||
if (enuminteractionresult instanceof EnumInteractionResult.d) {
|
||||
EnumInteractionResult.d enuminteractionresult_d = (EnumInteractionResult.d) enuminteractionresult;
|
||||
ItemStack itemstack2 = enuminteractionresult_d.wasItemInteraction() ? itemstack1 : ItemStack.EMPTY;
|
||||
@@ -1755,19 +2483,20 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
- this.performInteraction(enumhand, EntityHuman::interactOn);
|
||||
+ this.performInteraction(enumhand, EntityHuman::interactOn, new PlayerInteractEntityEvent(getCraftPlayer(), entity.getBukkitEntity(), (enumhand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND)); // CraftBukkit
|
||||
}
|
||||
@@ -1724,7 +2467,7 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand, Vec3D vec3d) {
|
||||
this.performInteraction(enumhand, (entityplayer, entity1, enumhand1) -> {
|
||||
return entity1.interactAt(entityplayer, vec3d, enumhand1);
|
||||
- });
|
||||
+ }, new PlayerInteractAtEntityEvent(getCraftPlayer(), entity.getBukkitEntity(), new org.bukkit.util.Vector(vec3d.x, vec3d.y, vec3d.z), (enumhand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND)); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttack() {
|
||||
- if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && entity != PlayerConnection.this.player) {
|
||||
+ // CraftBukkit
|
||||
+ if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && (entity != PlayerConnection.this.player || player.isSpectator())) {
|
||||
label23:
|
||||
{
|
||||
if (entity instanceof EntityArrow) {
|
||||
@@ -1785,6 +2514,11 @@
|
||||
}
|
||||
|
||||
PlayerConnection.this.player.attack(entity);
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemstack.isEmpty() && itemstack.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1809,7 +2543,7 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
this.player.wonGame = false;
|
||||
|
@ -1255,7 +1247,7 @@
|
|||
this.resetPosition();
|
||||
CriterionTriggers.CHANGED_DIMENSION.trigger(this.player, World.END, World.OVERWORLD);
|
||||
} else {
|
||||
@@ -1732,11 +2475,11 @@
|
||||
@@ -1817,11 +2551,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1269,7 +1261,7 @@
|
|||
}
|
||||
}
|
||||
break;
|
||||
@@ -1749,15 +2492,21 @@
|
||||
@@ -1834,15 +2568,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
|
||||
|
@ -1293,7 +1285,7 @@
|
|||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
@@ -1770,7 +2519,284 @@
|
||||
@@ -1855,7 +2595,284 @@
|
||||
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
|
@ -1579,7 +1571,7 @@
|
|||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1816,7 +2842,21 @@
|
||||
@@ -1901,7 +2918,21 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1602,7 +1594,7 @@
|
|||
|
||||
if (containerrecipebook_a == ContainerRecipeBook.a.PLACE_GHOST_RECIPE) {
|
||||
this.player.connection.send(new PacketPlayOutAutoRecipe(this.player.containerMenu.containerId, craftingmanager_d.display().display()));
|
||||
@@ -1832,6 +2872,7 @@
|
||||
@@ -1917,6 +2948,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
|
||||
|
@ -1610,7 +1602,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.containerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1875,6 +2916,43 @@
|
||||
@@ -1945,6 +2977,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.slotNum() >= 1 && packetplayinsetcreativeslot.slotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
|
||||
|
@ -1654,7 +1646,7 @@
|
|||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).setByPlayer(itemstack);
|
||||
@@ -1902,6 +2980,7 @@
|
||||
@@ -1972,6 +3041,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||
|
@ -1662,7 +1654,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1923,7 +3002,17 @@
|
||||
@@ -1993,7 +3063,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
||||
|
@ -1681,7 +1673,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1982,7 +3071,7 @@
|
||||
@@ -2058,7 +3138,7 @@
|
||||
if (!this.waitingForSwitchToConfig) {
|
||||
throw new IllegalStateException("Client acknowledged config, but none was requested");
|
||||
} else {
|
||||
|
@ -1690,7 +1682,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -2007,8 +3096,10 @@
|
||||
@@ -2083,8 +3163,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -3,20 +3,20 @@
|
|||
@@ -21,6 +21,12 @@
|
||||
public SpawnUtil() {}
|
||||
|
||||
public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EntitySpawnReason entityspawnreason, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a) {
|
||||
public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EntitySpawnReason entityspawnreason, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a, boolean flag) {
|
||||
+ // CraftBukkit start
|
||||
+ return trySpawnMob(entitytypes, entityspawnreason, worldserver, blockposition, i, j, k, spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ return trySpawnMob(entitytypes, entityspawnreason, worldserver, blockposition, i, j, k, spawnutil_a, flag, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EntitySpawnReason entityspawnreason, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EntitySpawnReason entityspawnreason, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a, boolean flag, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ // CraftBukkit end
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
|
||||
for (int l = 0; l < i; ++l) {
|
||||
@@ -29,15 +35,15 @@
|
||||
@@ -29,16 +35,17 @@
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
|
||||
if (worldserver.getWorldBorder().isWithinBounds((BlockPosition) blockposition_mutableblockposition) && moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
|
||||
if (worldserver.getWorldBorder().isWithinBounds((BlockPosition) blockposition_mutableblockposition) && moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a) && (!flag || worldserver.noCollision(entitytypes.getSpawnAABB((double) blockposition_mutableblockposition.getX() + 0.5D, (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + 0.5D)))) {
|
||||
- T t0 = (EntityInsentient) entitytypes.create(worldserver, (Consumer) null, blockposition_mutableblockposition, entityspawnreason, false, false);
|
||||
+ T t0 = entitytypes.create(worldserver, (Consumer<T>) null, blockposition_mutableblockposition, entityspawnreason, false, false); // CraftBukkit - decompile error
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
|||
if (t0.checkSpawnRules(worldserver, entityspawnreason) && t0.checkSpawnObstruction(worldserver)) {
|
||||
- worldserver.addFreshEntityWithPassengers(t0);
|
||||
+ worldserver.addFreshEntityWithPassengers(t0, reason); // CraftBukkit
|
||||
+ if (t0.isRemoved()) return Optional.empty(); // CraftBukkit
|
||||
t0.playAmbientSound();
|
||||
return Optional.of(t0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
@@ -511,6 +511,18 @@
|
||||
@@ -517,6 +517,18 @@
|
||||
datafixerbuilder.addFixer(new DataConverterItemFrame(schema44, false));
|
||||
Schema schema45 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema45, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema45, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema45, false));
|
||||
@@ -769,7 +781,8 @@
|
||||
@@ -775,7 +787,8 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema110, "Added Zoglin", DataConverterTypes.ENTITY));
|
||||
Schema schema111 = datafixerbuilder.addSchema(2523, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
|||
Schema schema112 = datafixerbuilder.addSchema(2527, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
datafixerbuilder.addFixer(new DataConverterBitStorageAlign(schema112));
|
||||
@@ -832,12 +845,14 @@
|
||||
@@ -838,12 +851,14 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Squid", DataConverterTypes.ENTITY));
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Item Frame", DataConverterTypes.ENTITY));
|
||||
Schema schema131 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema132, "Rename copper item suffixes", createRenamer(immutablemap1)));
|
||||
datafixerbuilder.addFixer(DataConverterBlockRename.create(schema132, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
|
||||
@@ -845,7 +860,8 @@
|
||||
@@ -851,7 +866,8 @@
|
||||
|
||||
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema133, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
|
||||
Schema schema134 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema134, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
|
||||
datafixerbuilder.addFixer(DataConverterBlockRename.create(schema134, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
|
||||
@@ -932,10 +948,11 @@
|
||||
@@ -938,10 +954,11 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema159, "Added Allay", DataConverterTypes.ENTITY));
|
||||
Schema schema160 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
int2objectopenhashmap1.defaultReturnValue("minecraft:tabby");
|
||||
int2objectopenhashmap1.put(0, "minecraft:tabby");
|
||||
int2objectopenhashmap1.put(1, "minecraft:black");
|
||||
@@ -952,7 +969,8 @@
|
||||
@@ -958,7 +975,8 @@
|
||||
|
||||
Objects.requireNonNull(int2objectopenhashmap);
|
||||
datafixerbuilder.addFixer(new EntityVariantFix(schema161, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
@@ -12,7 +12,7 @@
|
||||
@@ -14,7 +14,7 @@
|
||||
@Override
|
||||
public boolean applyEffectTick(WorldServer worldserver, EntityLiving entityliving, int i) {
|
||||
if (entityliving.getHealth() > 1.0F) {
|
||||
|
|
|
@ -200,7 +200,7 @@
|
|||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -458,6 +597,15 @@
|
||||
@@ -462,6 +601,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@
|
|||
public void baseTick() {
|
||||
GameProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
@@ -471,7 +619,7 @@
|
||||
@@ -475,7 +623,7 @@
|
||||
--this.boardingCooldown;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@
|
|||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -510,6 +658,10 @@
|
||||
@@ -514,6 +662,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
|
@ -236,7 +236,7 @@
|
|||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -521,7 +673,7 @@
|
||||
@@ -525,7 +677,7 @@
|
||||
world = this.level();
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (this instanceof Leashable) {
|
||||
|
@ -245,7 +245,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -564,15 +716,32 @@
|
||||
@@ -568,15 +720,32 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
|
@ -280,7 +280,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -583,6 +752,22 @@
|
||||
@@ -587,6 +756,22 @@
|
||||
}
|
||||
|
||||
public final void igniteForSeconds(float f) {
|
||||
|
@ -303,7 +303,7 @@
|
|||
this.igniteForTicks(MathHelper.floor(f * 20.0F));
|
||||
}
|
||||
|
||||
@@ -606,7 +791,7 @@
|
||||
@@ -610,7 +795,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
|
@ -312,7 +312,7 @@
|
|||
}
|
||||
|
||||
public boolean isFree(double d0, double d1, double d2) {
|
||||
@@ -739,6 +924,28 @@
|
||||
@@ -750,6 +935,28 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@
|
|||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
||||
|
||||
@@ -1120,6 +1327,20 @@
|
||||
@@ -1133,6 +1340,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@
|
|||
public void recordMovementThroughBlocks(Vec3D vec3d, Vec3D vec3d1) {
|
||||
this.movementThisTick.add(new Entity.b(vec3d, vec3d1));
|
||||
}
|
||||
@@ -1586,6 +1807,7 @@
|
||||
@@ -1609,6 +1830,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
|
@ -370,7 +370,7 @@
|
|||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1838,6 +2060,12 @@
|
||||
@@ -1861,6 +2083,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -380,10 +380,10 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
public void awardKillScore(Entity entity, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1866,16 +2094,22 @@
|
||||
@@ -1889,16 +2117,22 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
|
||||
|
@ -408,7 +408,7 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1886,16 +2120,38 @@
|
||||
@@ -1909,16 +2143,38 @@
|
||||
}
|
||||
|
||||
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
|
||||
|
@ -451,7 +451,7 @@
|
|||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1903,7 +2159,28 @@
|
||||
@@ -1926,7 +2182,28 @@
|
||||
nbttagcompound.putBoolean("OnGround", this.onGround());
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
|
@ -481,7 +481,7 @@
|
|||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1952,7 +2229,7 @@
|
||||
@@ -1975,7 +2252,7 @@
|
||||
nbttagcompound.put("Tags", nbttaglist);
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@
|
|||
if (this.isVehicle()) {
|
||||
nbttaglist = new NBTTagList();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1961,7 +2238,7 @@
|
||||
@@ -1984,7 +2261,7 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
|
@ -499,7 +499,7 @@
|
|||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@@ -1971,6 +2248,11 @@
|
||||
@@ -1994,6 +2271,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@
|
|||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2055,6 +2337,45 @@
|
||||
@@ -2080,6 +2362,45 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
|
@ -557,7 +557,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -2076,6 +2397,12 @@
|
||||
@@ -2101,6 +2422,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@
|
|||
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
|
||||
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
@@ -2128,9 +2455,22 @@
|
||||
@@ -2153,9 +2480,22 @@
|
||||
if (itemstack.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -593,7 +593,7 @@
|
|||
worldserver.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2159,6 +2499,12 @@
|
||||
@@ -2184,6 +2524,12 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == entityhuman) {
|
||||
if (!this.level().isClientSide()) {
|
||||
|
@ -603,10 +603,10 @@
|
|||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
leashable.dropLeash(true, !entityhuman.hasInfiniteMaterials());
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
}
|
||||
@@ -2170,6 +2516,13 @@
|
||||
if (entityhuman.hasInfiniteMaterials()) {
|
||||
leashable.removeLeash();
|
||||
} else {
|
||||
@@ -2200,6 +2546,13 @@
|
||||
|
||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
|
@ -620,7 +620,7 @@
|
|||
leashable.setLeashedTo(entityhuman, true);
|
||||
}
|
||||
|
||||
@@ -2243,7 +2596,7 @@
|
||||
@@ -2273,7 +2626,7 @@
|
||||
return false;
|
||||
} else if (!entity.couldAcceptPassenger()) {
|
||||
return false;
|
||||
|
@ -629,7 +629,7 @@
|
|||
return false;
|
||||
} else {
|
||||
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
|
||||
@@ -2255,6 +2608,27 @@
|
||||
@@ -2285,6 +2638,27 @@
|
||||
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -657,7 +657,7 @@
|
|||
if (this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
}
|
||||
@@ -2288,7 +2662,7 @@
|
||||
@@ -2318,7 +2692,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
|
@ -666,7 +666,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -2319,10 +2693,38 @@
|
||||
@@ -2349,10 +2723,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,7 @@
|
|||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -2334,6 +2736,7 @@
|
||||
@@ -2364,6 +2766,7 @@
|
||||
entity.boardingCooldown = 60;
|
||||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
|
||||
}
|
||||
|
@ -714,7 +714,7 @@
|
|||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2434,7 +2837,7 @@
|
||||
@@ -2464,7 +2867,7 @@
|
||||
if (teleporttransition != null) {
|
||||
WorldServer worldserver1 = teleporttransition.newLevel();
|
||||
|
||||
|
@ -723,7 +723,7 @@
|
|||
this.teleport(teleporttransition);
|
||||
}
|
||||
}
|
||||
@@ -2541,6 +2944,13 @@
|
||||
@@ -2571,6 +2974,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
|
@ -737,7 +737,7 @@
|
|||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2594,8 +3004,12 @@
|
||||
@@ -2624,8 +3034,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@
|
|||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2614,7 +3028,7 @@
|
||||
@@ -2644,7 +3058,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -760,7 +760,7 @@
|
|||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2622,7 +3036,18 @@
|
||||
@@ -2652,7 +3066,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
|
@ -780,7 +780,7 @@
|
|||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2649,11 +3074,40 @@
|
||||
@@ -2679,11 +3104,40 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
|
@ -823,7 +823,7 @@
|
|||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2822,6 +3276,18 @@
|
||||
@@ -2852,6 +3306,18 @@
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (!this.isRemoved()) {
|
||||
|
@ -842,7 +842,7 @@
|
|||
WorldServer worldserver1 = teleporttransition.newLevel();
|
||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||
|
||||
@@ -2890,8 +3356,12 @@
|
||||
@@ -2920,8 +3386,12 @@
|
||||
} else {
|
||||
entity.restoreFrom(this);
|
||||
this.removeAfterChangingDimensions();
|
||||
|
@ -856,7 +856,7 @@
|
|||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -2965,8 +3435,9 @@
|
||||
@@ -2995,8 +3465,9 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
|
@ -864,10 +864,10 @@
|
|||
+ this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
|
||||
if (this instanceof Leashable leashable) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
leashable.dropLeash(true, false);
|
||||
leashable.removeLeash();
|
||||
}
|
||||
|
||||
@@ -2976,6 +3447,20 @@
|
||||
@@ -3006,6 +3477,20 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
|
@ -888,7 +888,7 @@
|
|||
public boolean canUsePortal(boolean flag) {
|
||||
return (flag || !this.isPassenger()) && this.isAlive();
|
||||
}
|
||||
@@ -3104,9 +3589,15 @@
|
||||
@@ -3134,9 +3619,15 @@
|
||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
|
@ -906,7 +906,7 @@
|
|||
|
||||
return entity != null;
|
||||
}
|
||||
@@ -3228,7 +3719,26 @@
|
||||
@@ -3258,7 +3749,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -934,7 +934,7 @@
|
|||
}
|
||||
|
||||
public final float getEyeHeight(EntityPose entitypose) {
|
||||
@@ -3463,8 +3973,37 @@
|
||||
@@ -3489,8 +3999,37 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@
|
|||
}
|
||||
|
||||
public void lookAt(ArgumentAnchor.Anchor argumentanchor_anchor, Vec3D vec3d) {
|
||||
@@ -3525,6 +4064,11 @@
|
||||
@@ -3551,6 +4090,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
@ -985,7 +985,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -3792,6 +4336,14 @@
|
||||
@@ -3818,6 +4362,14 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason entity_removalreason) {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
Vec3D vec3d = new Vec3D(this.followingPlayer.getX() - this.getX(), this.followingPlayer.getY() + (double) this.followingPlayer.getEyeHeight() / 2.0D - this.getY(), this.followingPlayer.getZ() - this.getZ());
|
||||
double d0 = vec3d.lengthSqr();
|
||||
|
||||
@@ -119,7 +143,7 @@
|
||||
@@ -121,7 +145,7 @@
|
||||
|
||||
++this.age;
|
||||
if (this.age >= 6000) {
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -188,7 +212,7 @@
|
||||
@@ -190,7 +214,7 @@
|
||||
private void merge(EntityExperienceOrb entityexperienceorb) {
|
||||
this.count += entityexperienceorb.count;
|
||||
this.age = Math.min(this.age, entityexperienceorb.age);
|
||||
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
private void setUnderwaterMovement() {
|
||||
@@ -213,7 +237,7 @@
|
||||
@@ -215,7 +239,7 @@
|
||||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
if (this.health <= 0) {
|
||||
|
@ -74,7 +74,7 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -240,17 +264,17 @@
|
||||
@@ -242,17 +266,17 @@
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (entityhuman instanceof EntityPlayer entityplayer) {
|
||||
if (entityhuman.takeXpDelay == 0) {
|
||||
|
@ -95,7 +95,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -264,12 +288,20 @@
|
||||
@@ -266,12 +290,20 @@
|
||||
ItemStack itemstack = ((EnchantedItemInUse) optional.get()).itemStack();
|
||||
int j = EnchantmentManager.modifyDurabilityToRepairFromXp(entityplayer.serverLevel(), itemstack, i);
|
||||
int k = Math.min(j, itemstack.getDamageValue());
|
||||
|
@ -116,7 +116,7 @@
|
|||
return this.repairPlayerItems(entityplayer, l);
|
||||
}
|
||||
}
|
||||
@@ -289,6 +321,24 @@
|
||||
@@ -291,6 +323,24 @@
|
||||
}
|
||||
|
||||
public static int getExperienceValue(int i) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -89,6 +89,18 @@
|
||||
@@ -85,6 +85,18 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Leashable, Targeting {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -136,6 +148,8 @@
|
||||
@@ -132,6 +144,8 @@
|
||||
private BlockPosition restrictCenter;
|
||||
private float restrictRadius;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
||||
@@ -164,6 +178,12 @@
|
||||
@@ -160,6 +174,12 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
|||
protected void registerGoals() {}
|
||||
|
||||
public static AttributeProvider.Builder createMobAttributes() {
|
||||
@@ -268,11 +288,42 @@
|
||||
@@ -264,11 +284,42 @@
|
||||
|
||||
@Nullable
|
||||
protected final EntityLiving getTargetFromBrain() {
|
||||
|
@ -85,7 +85,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -403,6 +454,12 @@
|
||||
@@ -399,6 +450,12 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -476,16 +533,26 @@
|
||||
@@ -473,13 +530,25 @@
|
||||
nbttagcompound.putBoolean("NoAI", this.isNoAi());
|
||||
}
|
||||
|
||||
|
@ -108,17 +108,16 @@
|
|||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
+
|
||||
- this.setCanPickUpLoot(nbttagcompound.getBoolean("CanPickUpLoot"));
|
||||
- this.persistenceRequired = nbttagcompound.getBoolean("PersistenceRequired");
|
||||
+ // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
|
||||
if (nbttagcompound.contains("CanPickUpLoot", 99)) {
|
||||
- this.setCanPickUpLoot(nbttagcompound.getBoolean("CanPickUpLoot"));
|
||||
+ if (nbttagcompound.contains("CanPickUpLoot", 99)) {
|
||||
+ boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
|
||||
+ if (isLevelAtLeast(nbttagcompound, 1) || data) {
|
||||
+ this.setCanPickUpLoot(data);
|
||||
+ }
|
||||
}
|
||||
|
||||
- this.persistenceRequired = nbttagcompound.getBoolean("PersistenceRequired");
|
||||
+ }
|
||||
+
|
||||
+ boolean data = nbttagcompound.getBoolean("PersistenceRequired");
|
||||
+ if (isLevelAtLeast(nbttagcompound, 1) || data) {
|
||||
+ this.persistenceRequired = data;
|
||||
|
@ -127,9 +126,9 @@
|
|||
NBTTagList nbttaglist;
|
||||
NBTTagCompound nbttagcompound1;
|
||||
int i;
|
||||
@@ -539,6 +606,11 @@
|
||||
}
|
||||
@@ -547,6 +616,11 @@
|
||||
|
||||
this.lootTableSeed = nbttagcompound.getLong("DeathLootTableSeed");
|
||||
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
|
||||
+ // CraftBukkit start
|
||||
+ if (nbttagcompound.contains("Bukkit.Aware")) {
|
||||
|
@ -139,7 +138,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -615,20 +687,26 @@
|
||||
@@ -623,20 +697,26 @@
|
||||
|
||||
protected void pickUpItem(WorldServer worldserver, EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
@ -168,7 +167,7 @@
|
|||
EnumItemSlot enumitemslot = this.getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1, enumitemslot);
|
||||
@@ -639,11 +717,19 @@
|
||||
@@ -647,11 +727,19 @@
|
||||
flag = itemstack1.isEmpty();
|
||||
}
|
||||
|
||||
|
@ -189,7 +188,7 @@
|
|||
}
|
||||
|
||||
ItemStack itemstack2 = enumitemslot.limit(itemstack);
|
||||
@@ -770,7 +856,7 @@
|
||||
@@ -768,7 +856,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
|
@ -198,7 +197,7 @@
|
|||
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
||||
EntityHuman entityhuman = this.level().getNearestPlayer(this, -1.0D);
|
||||
|
||||
@@ -780,14 +866,14 @@
|
||||
@@ -778,14 +866,14 @@
|
||||
int j = i * i;
|
||||
|
||||
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
||||
|
@ -215,7 +214,7 @@
|
|||
} else if (d0 < (double) l) {
|
||||
this.noActionTime = 0;
|
||||
}
|
||||
@@ -801,6 +887,7 @@
|
||||
@@ -799,6 +887,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
|
@ -223,7 +222,7 @@
|
|||
GameProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("sensing");
|
||||
@@ -1340,7 +1427,7 @@
|
||||
@@ -1338,7 +1427,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level() instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
|
@ -232,7 +231,7 @@
|
|||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1391,12 +1478,19 @@
|
||||
@@ -1389,12 +1478,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
|
@ -253,7 +252,7 @@
|
|||
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1405,14 +1499,24 @@
|
||||
@@ -1403,14 +1499,24 @@
|
||||
conversionparams_a.finalizeConversion(t0);
|
||||
World world = this.level();
|
||||
|
||||
|
@ -280,7 +279,7 @@
|
|||
}
|
||||
|
||||
return t0;
|
||||
@@ -1422,7 +1526,14 @@
|
||||
@@ -1420,7 +1526,14 @@
|
||||
|
||||
@Nullable
|
||||
public <T extends EntityInsentient> T convertTo(EntityTypes<T> entitytypes, ConversionParams conversionparams, ConversionParams.a<T> conversionparams_a) {
|
||||
|
@ -296,15 +295,15 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1461,6 +1572,7 @@
|
||||
@@ -1458,6 +1571,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
this.dropLeash();
|
||||
}
|
||||
|
||||
@@ -1545,7 +1657,7 @@
|
||||
@@ -1542,7 +1656,7 @@
|
||||
|
||||
if (f1 > 0.0F && entity instanceof EntityLiving) {
|
||||
entityliving = (EntityLiving) entity;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -137,6 +137,33 @@
|
||||
@@ -136,6 +136,33 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
public abstract class EntityLiving extends Entity implements Attackable {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -262,6 +289,19 @@
|
||||
@@ -260,6 +287,19 @@
|
||||
protected boolean skipDropExperience;
|
||||
private final EnumMap<EnumItemSlot, Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>>> activeLocationDependentEnchantments;
|
||||
protected float appliedScale;
|
||||
|
@ -54,7 +54,7 @@
|
|||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -278,7 +318,9 @@
|
||||
@@ -276,7 +316,9 @@
|
||||
this.activeLocationDependentEnchantments = new EnumMap(EnumItemSlot.class);
|
||||
this.appliedScale = 1.0F;
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
|
@ -65,14 +65,14 @@
|
|||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -358,7 +400,13 @@
|
||||
@@ -356,7 +398,13 @@
|
||||
double d8 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d8);
|
||||
|
||||
- worldserver.sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ // CraftBukkit start - visiblity api
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ worldserver.sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ worldserver.sendParticlesSource((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), false, false, d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ } else {
|
||||
+ worldserver.sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
|
@ -498,7 +498,7 @@
|
|||
this.hurtDuration = 10;
|
||||
this.hurtTime = this.hurtDuration;
|
||||
}
|
||||
@@ -1275,7 +1519,7 @@
|
||||
@@ -1243,7 +1487,7 @@
|
||||
worldserver.broadcastDamageEvent(this, damagesource);
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@
|
|||
this.markHurt();
|
||||
}
|
||||
|
||||
@@ -1295,7 +1539,7 @@
|
||||
@@ -1263,7 +1507,7 @@
|
||||
d1 = damagesource.getSourcePosition().z() - this.getZ();
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@
|
|||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1314,7 +1558,7 @@
|
||||
@@ -1282,7 +1526,7 @@
|
||||
this.playHurtSound(damagesource);
|
||||
}
|
||||
|
||||
|
@ -525,7 +525,7 @@
|
|||
|
||||
if (flag2) {
|
||||
this.lastDamageSource = damagesource;
|
||||
@@ -1352,7 +1596,7 @@
|
||||
@@ -1363,7 +1607,7 @@
|
||||
}
|
||||
|
||||
protected void blockedByShield(EntityLiving entityliving) {
|
||||
|
@ -534,7 +534,7 @@
|
|||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource damagesource) {
|
||||
@@ -1364,20 +1608,33 @@
|
||||
@@ -1375,20 +1619,33 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
|
@ -572,7 +572,7 @@
|
|||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
|
||||
@@ -1501,14 +1758,22 @@
|
||||
@@ -1512,14 +1769,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
|
@ -597,7 +597,7 @@
|
|||
this.level().addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1519,22 +1784,37 @@
|
||||
@@ -1530,22 +1795,37 @@
|
||||
protected void dropAllDeathLoot(WorldServer worldserver, DamageSource damagesource) {
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
|
@ -638,7 +638,7 @@
|
|||
}
|
||||
|
||||
protected void dropCustomDeathLoot(WorldServer worldserver, DamageSource damagesource, boolean flag) {}
|
||||
@@ -1601,9 +1881,14 @@
|
||||
@@ -1612,9 +1892,14 @@
|
||||
}
|
||||
|
||||
public void knockback(double d0, double d1, double d2) {
|
||||
|
@ -655,7 +655,7 @@
|
|||
|
||||
Vec3D vec3d;
|
||||
|
||||
@@ -1613,7 +1898,14 @@
|
||||
@@ -1624,7 +1909,14 @@
|
||||
|
||||
Vec3D vec3d1 = (new Vec3D(d1, 0.0D, d2)).normalize().scale(d0);
|
||||
|
||||
|
@ -671,7 +671,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1668,6 +1960,20 @@
|
||||
@@ -1683,6 +1975,20 @@
|
||||
return new EntityLiving.a(SoundEffects.GENERIC_SMALL_FALL, SoundEffects.GENERIC_BIG_FALL);
|
||||
}
|
||||
|
||||
|
@ -692,7 +692,7 @@
|
|||
public Optional<BlockPosition> getLastClimbablePos() {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
@@ -1746,9 +2052,14 @@
|
||||
@@ -1757,9 +2063,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -708,7 +708,7 @@
|
|||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1819,7 +2130,7 @@
|
||||
@@ -1830,7 +2141,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
|
@ -717,7 +717,7 @@
|
|||
f = CombatMath.getDamageAfterAbsorb(this, f, damagesource, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1830,7 +2141,8 @@
|
||||
@@ -1841,7 +2152,8 @@
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_EFFECTS)) {
|
||||
return f;
|
||||
} else {
|
||||
|
@ -727,7 +727,7 @@
|
|||
int i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1873,15 +2185,141 @@
|
||||
@@ -1884,15 +2196,141 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -876,7 +876,7 @@
|
|||
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
Entity entity = damagesource.getEntity();
|
||||
@@ -1893,13 +2331,48 @@
|
||||
@@ -1904,13 +2342,48 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -927,7 +927,7 @@
|
|||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1924,9 +2397,19 @@
|
||||
@@ -1935,9 +2408,19 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
|
@ -948,7 +948,7 @@
|
|||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
}
|
||||
@@ -2171,6 +2654,12 @@
|
||||
@@ -2182,6 +2665,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
|
@ -961,7 +961,7 @@
|
|||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
public Iterable<ItemStack> getHandSlots() {
|
||||
@@ -2623,7 +3112,7 @@
|
||||
@@ -2634,7 +3123,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -970,7 +970,7 @@
|
|||
if (this.tickCount % 20 == 0) {
|
||||
this.getCombatTracker().recheckStatus();
|
||||
}
|
||||
@@ -2730,7 +3219,7 @@
|
||||
@@ -2741,7 +3230,7 @@
|
||||
this.elytraAnimationState.tick();
|
||||
}
|
||||
|
||||
|
@ -979,7 +979,7 @@
|
|||
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||
|
||||
if (map != null) {
|
||||
@@ -3052,6 +3541,7 @@
|
||||
@@ -3063,6 +3552,7 @@
|
||||
this.checkSlowFallDistance();
|
||||
if (!this.level().isClientSide) {
|
||||
if (!this.canGlide()) {
|
||||
|
@ -987,7 +987,7 @@
|
|||
this.setSharedFlag(7, false);
|
||||
return;
|
||||
}
|
||||
@@ -3298,14 +3788,21 @@
|
||||
@@ -3305,14 +3795,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
|
@ -1011,7 +1011,7 @@
|
|||
@Override
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
@@ -3476,7 +3973,30 @@
|
||||
@@ -3483,7 +3980,30 @@
|
||||
this.releaseUsingItem();
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
|
@ -1043,7 +1043,7 @@
|
|||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3561,6 +4081,12 @@
|
||||
@@ -3568,6 +4088,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
|
@ -1056,7 +1056,7 @@
|
|||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3585,16 +4111,41 @@
|
||||
@@ -3592,16 +4118,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
|
@ -1101,7 +1101,7 @@
|
|||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3606,7 +4157,7 @@
|
||||
@@ -3613,7 +4164,7 @@
|
||||
entitycreature.getNavigation().stop();
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1110,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -3699,7 +4250,7 @@
|
||||
@@ -3706,7 +4257,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
|
@ -1119,7 +1119,7 @@
|
|||
World world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3733,7 +4284,7 @@
|
||||
@@ -3740,7 +4291,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
public abstract class EntityTameableAnimal extends EntityAnimal implements OwnableEntity {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS_SQ = 144;
|
||||
@@ -292,7 +298,14 @@
|
||||
@@ -295,7 +301,14 @@
|
||||
if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
|
||||
public static <T extends Entity> Consumer<T> createDefaultStackConfig(World world, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
|
||||
@@ -464,21 +472,37 @@
|
||||
@@ -464,21 +472,40 @@
|
||||
CustomData customdata = (CustomData) itemstack.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY);
|
||||
|
||||
return !customdata.isEmpty() ? consumer.andThen((entity) -> {
|
||||
|
@ -86,13 +86,16 @@
|
|||
|
||||
if (t0 != null) {
|
||||
- worldserver.addFreshEntityWithPassengers(t0);
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.addFreshEntityWithPassengers(t0, spawnReason);
|
||||
+ return !t0.isRemoved() ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled
|
||||
+ if (t0.isRemoved()) {
|
||||
+ return null; // Don't return an entity when CreatureSpawnEvent is canceled
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
if (t0 instanceof EntityInsentient) {
|
||||
EntityInsentient entityinsentient = (EntityInsentient) t0;
|
||||
|
||||
return t0;
|
||||
@@ -649,7 +673,7 @@
|
||||
@@ -657,7 +684,7 @@
|
||||
}
|
||||
|
||||
return entity;
|
||||
|
@ -101,7 +104,7 @@
|
|||
}
|
||||
|
||||
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world, final EntitySpawnReason entityspawnreason) {
|
||||
@@ -710,7 +734,7 @@
|
||||
@@ -718,7 +745,7 @@
|
||||
|
||||
@Nullable
|
||||
public T tryCast(Entity entity) {
|
||||
|
@ -110,7 +113,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -779,7 +803,7 @@
|
||||
@@ -791,7 +818,7 @@
|
||||
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/Interaction.java
|
||||
+++ b/net/minecraft/world/entity/Interaction.java
|
||||
@@ -26,6 +26,12 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
@@ -27,6 +27,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class Interaction extends Entity implements Attackable, Targeting {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -64,7 +70,7 @@
|
||||
@@ -65,7 +71,7 @@
|
||||
this.setHeight(nbttagcompound.getFloat("height"));
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
Logger logger;
|
||||
|
||||
if (nbttagcompound.contains("attack")) {
|
||||
@@ -144,9 +150,16 @@
|
||||
@@ -145,9 +151,16 @@
|
||||
@Override
|
||||
public boolean skipAttackInteraction(Entity entity) {
|
||||
if (entity instanceof EntityHuman entityhuman) {
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
+ dropLeash((Entity & Leashable) this, false, false); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -54,7 +59,7 @@
|
||||
default void readLeashData(NBTTagCompound nbttagcompound) {
|
||||
@@ -64,7 +69,7 @@
|
||||
return new Leashable.a(Either.left(nbttagcompound.getCompound("leash").getUUID("UUID")));
|
||||
} else {
|
||||
if (nbttagcompound.contains("leash", 11)) {
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
if (either != null) {
|
||||
return new Leashable.a(either);
|
||||
@@ -69,6 +74,11 @@
|
||||
@@ -79,6 +84,11 @@
|
||||
if (leashable_a != null) {
|
||||
Either<UUID, BlockPosition> either = leashable_a.delayedLeashInfo;
|
||||
Entity entity = leashable_a.leashHolder;
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
if (entity instanceof EntityLeash) {
|
||||
EntityLeash entityleash = (EntityLeash) entity;
|
||||
@@ -111,7 +121,9 @@
|
||||
@@ -121,7 +131,9 @@
|
||||
}
|
||||
|
||||
if (e0.tickCount > 100) {
|
||||
|
@ -52,16 +52,21 @@
|
|||
((Leashable) e0).setLeashData((Leashable.a) null);
|
||||
}
|
||||
}
|
||||
@@ -120,7 +132,7 @@
|
||||
@@ -130,11 +142,11 @@
|
||||
}
|
||||
|
||||
default void dropLeash(boolean flag, boolean flag1) {
|
||||
- dropLeash((Entity) this, flag, flag1);
|
||||
+ dropLeash((Entity & Leashable) this, flag, flag1); // CraftBukkit - decompile error
|
||||
default void dropLeash() {
|
||||
- dropLeash((Entity) this, true, true);
|
||||
+ dropLeash((Entity & Leashable) this, true, true); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void dropLeash(E e0, boolean flag, boolean flag1) {
|
||||
@@ -134,7 +146,9 @@
|
||||
default void removeLeash() {
|
||||
- dropLeash((Entity) this, true, false);
|
||||
+ dropLeash((Entity & Leashable) this, true, false); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
default void onLeashRemoved() {}
|
||||
@@ -151,7 +163,9 @@
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
if (flag1) {
|
||||
|
@ -71,17 +76,17 @@
|
|||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -154,7 +168,8 @@
|
||||
@@ -171,7 +185,8 @@
|
||||
|
||||
if (leashable_a != null && leashable_a.leashHolder != null) {
|
||||
if (!e0.isAlive() || !leashable_a.leashHolder.isAlive()) {
|
||||
- dropLeash(e0, true, worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS));
|
||||
- if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(e0.getBukkitEntity(), (!e0.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
+ dropLeash(e0, true, worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS) && !e0.pluginRemoved); // CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
|
||||
}
|
||||
|
||||
Entity entity = ((Leashable) e0).getLeashHolder();
|
||||
@@ -184,13 +199,18 @@
|
||||
+ if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS) && !e0.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
|
||||
((Leashable) e0).dropLeash();
|
||||
} else {
|
||||
((Leashable) e0).removeLeash();
|
||||
@@ -205,13 +220,18 @@
|
||||
}
|
||||
|
||||
default void leashTooFarBehaviour() {
|
||||
|
@ -90,7 +95,7 @@
|
|||
+ entity.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(entity.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.dropLeash(true, true);
|
||||
this.dropLeash();
|
||||
}
|
||||
|
||||
default void closeRangeLeashBehaviour(Entity entity) {}
|
||||
|
@ -101,7 +106,7 @@
|
|||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void legacyElasticRangeLeashBehaviour(E e0, Entity entity, float f) {
|
||||
@@ -202,7 +222,7 @@
|
||||
@@ -223,7 +243,7 @@
|
||||
}
|
||||
|
||||
default void setLeashedTo(Entity entity, boolean flag) {
|
||||
|
@ -110,7 +115,7 @@
|
|||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void setLeashedTo(E e0, Entity entity, boolean flag) {
|
||||
@@ -233,7 +253,7 @@
|
||||
@@ -254,7 +274,7 @@
|
||||
|
||||
@Nullable
|
||||
default Entity getLeashHolder() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityBee.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityBee.java
|
||||
@@ -89,6 +89,12 @@
|
||||
@@ -93,6 +93,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityBird {
|
||||
|
||||
public static final float FLAP_DEGREES_PER_TICK = 120.32113F;
|
||||
@@ -194,12 +200,19 @@
|
||||
@@ -198,12 +204,19 @@
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
|
@ -35,7 +35,7 @@
|
|||
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
|
||||
}
|
||||
|
||||
@@ -219,8 +232,8 @@
|
||||
@@ -223,8 +236,8 @@
|
||||
this.ticksWithoutNectarSinceExitingHive = nbttagcompound.getInt("TicksSincePollination");
|
||||
this.stayOutOfHiveCountdown = nbttagcompound.getInt("CannotEnterHiveTicks");
|
||||
this.numCropsGrownSincePollination = nbttagcompound.getInt("CropsGrownSincePollination");
|
||||
|
@ -46,7 +46,7 @@
|
|||
this.readPersistentAngerSaveData(this.level(), nbttagcompound);
|
||||
}
|
||||
|
||||
@@ -244,7 +257,7 @@
|
||||
@@ -248,7 +261,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
|
@ -55,7 +55,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -502,7 +515,7 @@
|
||||
@@ -506,7 +519,7 @@
|
||||
|
||||
@Nullable
|
||||
TileEntityBeehive getBeehiveBlockEntity() {
|
||||
|
@ -64,7 +64,7 @@
|
|||
}
|
||||
|
||||
boolean isHiveValid() {
|
||||
@@ -638,8 +651,14 @@
|
||||
@@ -671,8 +684,14 @@
|
||||
if (this.isInvulnerableTo(worldserver, damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -80,7 +80,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1048,7 +1067,7 @@
|
||||
@@ -1082,7 +1101,7 @@
|
||||
|
||||
e() {
|
||||
super();
|
||||
|
@ -89,7 +89,7 @@
|
|||
this.blacklistedTargets = Lists.newArrayList();
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
@@ -1162,7 +1181,7 @@
|
||||
@@ -1196,7 +1215,7 @@
|
||||
|
||||
f() {
|
||||
super();
|
||||
|
@ -98,7 +98,7 @@
|
|||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
|
||||
@@ -1267,7 +1286,7 @@
|
||||
@@ -1301,7 +1320,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@
|
|||
EntityBee.this.level().levelEvent(2011, blockposition, 15);
|
||||
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1344,7 +1363,7 @@
|
||||
@@ -1378,7 +1397,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
|
@ -116,7 +116,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1353,7 +1372,7 @@
|
||||
@@ -1387,7 +1406,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
Objects.requireNonNull(iregistry);
|
||||
optional.flatMap(iregistry::get).ifPresent(this::setVariant);
|
||||
@@ -463,7 +463,7 @@
|
||||
@@ -462,7 +462,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(EntityHuman entityhuman) {
|
||||
|
@ -22,7 +22,7 @@
|
|||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -481,7 +481,7 @@
|
||||
@@ -480,7 +480,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
@Nullable
|
||||
|
@ -31,7 +31,7 @@
|
|||
private final EntityCat cat;
|
||||
|
||||
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, Predicate<ItemStack> predicate, boolean flag) {
|
||||
@@ -615,7 +615,15 @@
|
||||
@@ -614,7 +614,15 @@
|
||||
this.cat.randomTeleport((double) (blockposition_mutableblockposition.getX() + randomsource.nextInt(11) - 5), (double) (blockposition_mutableblockposition.getY() + randomsource.nextInt(5) - 2), (double) (blockposition_mutableblockposition.getZ() + randomsource.nextInt(11) - 5), false);
|
||||
blockposition_mutableblockposition.set(this.cat.blockPosition());
|
||||
this.cat.dropFromGiftLootTable(getServerLevel((Entity) this.cat), LootTables.CAT_MORNING_GIFT, (worldserver, itemstack) -> {
|
||||
|
@ -48,7 +48,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
@@ -646,10 +654,10 @@
|
||||
@@ -645,10 +653,10 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
@@ -44,6 +44,13 @@
|
||||
@@ -43,6 +43,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> {
|
||||
|
||||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
@@ -121,6 +128,11 @@
|
||||
@@ -120,6 +127,11 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
this.shear(worldserver, SoundCategory.PLAYERS, itemstack);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
@@ -162,11 +174,19 @@
|
||||
@@ -163,11 +175,19 @@
|
||||
worldserver.sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
this.dropFromShearingLootTable(worldserver, LootTables.SHEAR_MOOSHROOM, itemstack, (worldserver1, itemstack1) -> {
|
||||
for (int i = 0; i < itemstack1.getCount(); ++i) {
|
||||
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -262,7 +282,7 @@
|
||||
@@ -263,7 +283,7 @@
|
||||
}
|
||||
|
||||
static EntityMushroomCow.Type byName(String s) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
@@ -250,7 +250,7 @@
|
||||
@@ -248,7 +248,7 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
this.tame(entityhuman);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
@@ -271,7 +271,7 @@
|
||||
@@ -269,7 +269,7 @@
|
||||
}
|
||||
} else {
|
||||
this.usePlayerItem(entityhuman, enumhand, itemstack);
|
||||
|
@ -18,7 +18,7 @@
|
|||
if (entityhuman.isCreative() || !this.isInvulnerable()) {
|
||||
this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -365,7 +365,7 @@
|
||||
@@ -363,7 +363,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -380,8 +380,14 @@
|
||||
@@ -378,8 +378,14 @@
|
||||
if (this.isInvulnerableTo(worldserver, damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
@@ -57,6 +57,12 @@
|
||||
@@ -50,6 +50,12 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -167,6 +173,11 @@
|
||||
@@ -160,6 +166,11 @@
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
if (this.readyForShearing()) {
|
||||
|
@ -25,7 +25,7 @@
|
|||
this.shear(worldserver, SoundCategory.PLAYERS, itemstack);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
@@ -185,7 +196,9 @@
|
||||
@@ -178,7 +189,9 @@
|
||||
worldserver.playSound((EntityHuman) null, (Entity) this, SoundEffects.SHEEP_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
this.dropFromShearingLootTable(worldserver, LootTables.SHEAR_SHEEP, itemstack, (worldserver1, itemstack1) -> {
|
||||
for (int i = 0; i < itemstack1.getCount(); ++i) {
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
if (entityitem != null) {
|
||||
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
|
||||
@@ -280,6 +293,12 @@
|
||||
@@ -276,6 +289,12 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
|
@ -48,12 +48,3 @@
|
|||
super.ate();
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
@@ -299,7 +318,7 @@
|
||||
EnumColor enumcolor = entitysheep.getColor();
|
||||
EnumColor enumcolor1 = entitysheep1.getColor();
|
||||
CraftingInput craftinginput = makeCraftInput(enumcolor, enumcolor1);
|
||||
- Optional optional = worldserver.recipeAccess().getRecipeFor(Recipes.CRAFTING, craftinginput, worldserver).map((recipeholder) -> {
|
||||
+ Optional<Item> optional = worldserver.recipeAccess().getRecipeFor(Recipes.CRAFTING, craftinginput, worldserver).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
return ((RecipeCrafting) recipeholder.value()).assemble(craftinginput, worldserver.registryAccess());
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
public static AttributeProvider.Builder createAttributes() {
|
||||
@@ -229,7 +236,7 @@
|
||||
@@ -233,7 +240,7 @@
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
|
||||
|
@ -39,7 +39,7 @@
|
|||
}
|
||||
|
||||
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
|
||||
@@ -299,7 +306,12 @@
|
||||
@@ -303,7 +310,12 @@
|
||||
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
|
||||
|
||||
if (this.isDancing() && itemstack.is(TagsItem.DUPLICATES_ALLAYS) && this.canDuplicate()) {
|
||||
|
@ -53,7 +53,7 @@
|
|||
this.level().broadcastEntityEvent(this, (byte) 18);
|
||||
this.level().playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
@@ -310,7 +322,7 @@
|
||||
@@ -314,7 +326,7 @@
|
||||
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
this.level().playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
|
@ -62,7 +62,7 @@
|
|||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
|
||||
@@ -411,6 +423,7 @@
|
||||
@@ -415,6 +427,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
|
@ -70,7 +70,7 @@
|
|||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
}
|
||||
|
||||
@@ -502,7 +515,7 @@
|
||||
@@ -506,7 +519,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
|||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level(), EntitySpawnReason.BREEDING);
|
||||
|
||||
if (allay != null) {
|
||||
@@ -510,9 +523,9 @@
|
||||
@@ -514,9 +527,9 @@
|
||||
allay.setPersistenceRequired();
|
||||
allay.resetDuplicationCooldown();
|
||||
this.resetDuplicationCooldown();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
@@ -94,7 +98,7 @@
|
||||
this.despawnDelay = this.isLeashedToWanderingTrader() ? ((EntityVillagerTrader) this.getLeashHolder()).getDespawnDelay() - 1 : this.despawnDelay - 1;
|
||||
if (this.despawnDelay <= 0) {
|
||||
this.dropLeash(true, false);
|
||||
this.removeLeash();
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
|
|
@ -191,18 +191,16 @@
|
|||
EntityExperienceOrb.award(worldserver, this.position(), MathHelper.floor((float) short0 * 0.08F));
|
||||
}
|
||||
|
||||
@@ -577,8 +672,8 @@
|
||||
if (this.dragonDeathTime == 200) {
|
||||
world = this.level();
|
||||
if (world instanceof WorldServer) {
|
||||
- worldserver = (WorldServer) world;
|
||||
- if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
+ WorldServer worldserver = (WorldServer) world; // CraftBukkit - decompile error
|
||||
@@ -592,7 +687,7 @@
|
||||
if (world1 instanceof WorldServer) {
|
||||
WorldServer worldserver1 = (WorldServer) world1;
|
||||
|
||||
- if (worldserver1.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
+ if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
||||
EntityExperienceOrb.award(worldserver, this.position(), MathHelper.floor((float) short0 * 0.2F));
|
||||
EntityExperienceOrb.award(worldserver1, this.position(), MathHelper.floor((float) short0 * 0.2F));
|
||||
}
|
||||
|
||||
@@ -586,7 +681,7 @@
|
||||
@@ -600,7 +695,7 @@
|
||||
this.dragonFight.setDragonKilled(this);
|
||||
}
|
||||
|
||||
|
@ -211,7 +209,7 @@
|
|||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
}
|
||||
}
|
||||
@@ -800,6 +895,7 @@
|
||||
@@ -814,6 +909,7 @@
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
|
||||
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
|
||||
|
@ -219,7 +217,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -813,6 +909,11 @@
|
||||
@@ -827,6 +923,11 @@
|
||||
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
public class EntityWither extends EntityMonster implements IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -253,15 +265,40 @@
|
||||
@@ -252,15 +264,40 @@
|
||||
i = this.getInvulnerableTicks() - 1;
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
|
@ -63,7 +63,7 @@
|
|||
}
|
||||
|
||||
} else {
|
||||
@@ -306,6 +343,7 @@
|
||||
@@ -305,6 +342,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
this.setAlternativeTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -332,6 +370,11 @@
|
||||
@@ -331,6 +369,11 @@
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
if (canDestroy(iblockdata)) {
|
||||
|
@ -83,7 +83,7 @@
|
|||
flag = worldserver.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -343,7 +386,7 @@
|
||||
@@ -342,7 +385,7 @@
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
|
@ -92,7 +92,7 @@
|
|||
}
|
||||
|
||||
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
|
||||
@@ -500,7 +543,7 @@
|
||||
@@ -499,7 +542,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
leashable.setLeashedTo(this, true);
|
||||
flag = true;
|
||||
}
|
||||
@@ -93,18 +109,34 @@
|
||||
@@ -93,18 +109,38 @@
|
||||
boolean flag1 = false;
|
||||
|
||||
if (!flag) {
|
||||
|
@ -47,7 +47,7 @@
|
|||
Leashable leashable1 = (Leashable) iterator1.next();
|
||||
|
||||
if (leashable1.isLeashed() && leashable1.getLeashHolder() == this) {
|
||||
- leashable1.dropLeash(true, false);
|
||||
- leashable1.removeLeash();
|
||||
+ // CraftBukkit start
|
||||
+ if (leashable1 instanceof Entity leashed) {
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(leashed, entityhuman, enumhand).isCancelled()) {
|
||||
|
@ -55,7 +55,11 @@
|
|||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ leashable1.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ if (entityhuman.getAbilities().instabuild){
|
||||
+ leashable1.removeLeash();
|
||||
+ } else {
|
||||
+ leashable1.dropLeash();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
flag1 = true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
@@ -70,6 +70,11 @@
|
||||
@@ -69,6 +69,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
|
||||
private static final MinecraftKey SPEED_MODIFIER_ATTACKING_ID = MinecraftKey.withDefaultNamespace("attacking");
|
||||
@@ -113,7 +118,17 @@
|
||||
@@ -112,7 +117,17 @@
|
||||
|
||||
@Override
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
|
@ -31,7 +31,7 @@
|
|||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -128,6 +143,7 @@
|
||||
@@ -127,6 +142,7 @@
|
||||
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -466,9 +482,11 @@
|
||||
@@ -465,9 +481,11 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -507,9 +525,11 @@
|
||||
@@ -506,9 +524,11 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
@@ -50,6 +50,10 @@
|
||||
@@ -53,6 +53,10 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.WorldAccess;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityPillager extends EntityIllagerAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> IS_CHARGING_CROSSBOW = DataWatcher.defineId(EntityPillager.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -198,7 +202,7 @@
|
||||
@@ -206,7 +210,7 @@
|
||||
ItemStack itemstack1 = this.inventory.addItem(itemstack);
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
@@ -45,6 +45,10 @@
|
||||
@@ -43,6 +43,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityRavager extends EntityRaider {
|
||||
|
||||
private static final Predicate<Entity> ROAR_TARGET_WITH_GRIEFING = (entity) -> {
|
||||
@@ -161,6 +165,11 @@
|
||||
@@ -158,6 +162,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockLeaves) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
@@ -207,7 +207,17 @@
|
||||
@@ -209,7 +209,17 @@
|
||||
World world = this.level();
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySkeletonWither.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonWither.java
|
||||
@@ -97,7 +97,7 @@
|
||||
@@ -110,7 +110,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (entity instanceof EntityLiving) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -255,6 +255,7 @@
|
||||
@@ -252,6 +252,7 @@
|
||||
|
||||
@Override
|
||||
public boolean canAttackType(EntityTypes<?> entitytypes) {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
--- a/net/minecraft/world/entity/monster/creaking/Creaking.java
|
||||
+++ b/net/minecraft/world/entity/monster/creaking/Creaking.java
|
||||
@@ -206,7 +206,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Creaking> getBrain() {
|
||||
- return super.getBrain();
|
||||
+ return (BehaviorController<Creaking>) super.getBrain(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -329,7 +329,7 @@
|
||||
}
|
||||
|
||||
this.makeSound(this.getDeathSound());
|
||||
- this.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ this.remove(Entity.RemovalReason.DISCARDED, null); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
public void creakingDeathEffects(DamageSource damagesource) {
|
||||
@@ -476,7 +476,7 @@
|
||||
|
||||
@Override
|
||||
protected SoundEffect getHurtSound(DamageSource damagesource) {
|
||||
- return this.isHeartBound() ? SoundEffects.CREAKING_SWAY : super.getHurtSound(damagesource);
|
||||
+ return SoundEffects.CREAKING_SWAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -549,7 +549,7 @@
|
||||
}
|
||||
|
||||
public void activate(EntityHuman entityhuman) {
|
||||
- this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityhuman);
|
||||
+ this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityhuman); // CraftBukkit - decompile error
|
||||
this.gameEvent(GameEvent.ENTITY_ACTION);
|
||||
this.makeSound(SoundEffects.CREAKING_ACTIVATE);
|
||||
this.setIsActive(true);
|
|
@ -1,20 +0,0 @@
|
|||
--- a/net/minecraft/world/entity/monster/creaking/CreakingTransient.java
|
||||
+++ b/net/minecraft/world/entity/monster/creaking/CreakingTransient.java
|
||||
@@ -97,7 +97,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.setRemoved(Entity.RemovalReason.DISCARDED);
|
||||
+ this.setRemoved(Entity.RemovalReason.DISCARDED, null); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ this.remove(Entity.RemovalReason.DISCARDED, null); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
@@ -57,6 +57,18 @@
|
||||
@@ -60,6 +60,18 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -76,6 +88,10 @@
|
||||
@@ -79,6 +91,10 @@
|
||||
public boolean cannotHunt;
|
||||
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
|
||||
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -94,6 +110,14 @@
|
||||
@@ -97,6 +113,14 @@
|
||||
}
|
||||
|
||||
this.writeInventoryToTag(nbttagcompound, this.registryAccess());
|
||||
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -102,6 +126,10 @@
|
||||
@@ -105,6 +129,10 @@
|
||||
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
|
||||
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
|
||||
this.readInventoryFromTag(nbttagcompound, this.registryAccess());
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
@VisibleForDebug
|
||||
@@ -221,7 +249,7 @@
|
||||
@@ -224,7 +252,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityPiglin> getBrain() {
|
||||
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -366,7 +394,7 @@
|
||||
@@ -374,7 +402,7 @@
|
||||
}
|
||||
|
||||
protected void holdInOffHand(ItemStack itemstack) {
|
||||
|
@ -74,18 +74,18 @@
|
|||
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
|
||||
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
||||
} else {
|
||||
@@ -392,8 +420,8 @@
|
||||
if (EnchantmentManager.has(itemstack1, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) {
|
||||
@@ -401,8 +429,8 @@
|
||||
return false;
|
||||
} else {
|
||||
- boolean flag = PiglinAI.isLovedItem(itemstack) || itemstack.is(Items.CROSSBOW);
|
||||
- boolean flag1 = PiglinAI.isLovedItem(itemstack1) || itemstack1.is(Items.CROSSBOW);
|
||||
+ boolean flag = PiglinAI.isLovedItem(itemstack, this) || itemstack.is(Items.CROSSBOW); // CraftBukkit
|
||||
+ boolean flag1 = PiglinAI.isLovedItem(itemstack1, this) || itemstack1.is(Items.CROSSBOW); // CraftBukkit
|
||||
TagKey<Item> tagkey = this.getPreferredWeaponType();
|
||||
- boolean flag = PiglinAI.isLovedItem(itemstack) || tagkey != null && itemstack.is(tagkey);
|
||||
- boolean flag1 = PiglinAI.isLovedItem(itemstack1) || tagkey != null && itemstack1.is(tagkey);
|
||||
+ boolean flag = PiglinAI.isLovedItem(itemstack, this) || tagkey != null && itemstack.is(tagkey); // CraftBukkit
|
||||
+ boolean flag1 = PiglinAI.isLovedItem(itemstack1, this) || tagkey != null && itemstack1.is(tagkey); // CraftBukkit
|
||||
|
||||
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1, enumitemslot)));
|
||||
return flag && !flag1 ? true : (!flag && flag1 ? false : super.canReplaceCurrentItem(itemstack, itemstack1, enumitemslot));
|
||||
}
|
||||
@@ -422,7 +450,7 @@
|
||||
@@ -431,7 +459,7 @@
|
||||
|
||||
@Override
|
||||
protected SoundEffect getAmbientSound() {
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
SonicBoom.setCooldown(this, 200);
|
||||
}
|
||||
@@ -582,12 +582,12 @@
|
||||
@@ -582,11 +582,11 @@
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract createNavigation(World world) {
|
||||
|
@ -36,7 +36,6 @@
|
|||
@Override
|
||||
protected Pathfinder createPathFinder(int i) {
|
||||
this.nodeEvaluator = new PathfinderNormal();
|
||||
this.nodeEvaluator.setCanPassDoors(true);
|
||||
- return new Pathfinder(this, this.nodeEvaluator, i) {
|
||||
+ return new Pathfinder(this.nodeEvaluator, i) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
|
|
|
@ -95,8 +95,8 @@
|
|||
}).limit(5L).toList();
|
||||
|
||||
if (list1.size() >= j) {
|
||||
- if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EntitySpawnReason.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM).isEmpty()) {
|
||||
+ if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EntitySpawnReason.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit
|
||||
- if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EntitySpawnReason.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, false).isEmpty()) {
|
||||
+ if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EntitySpawnReason.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit
|
||||
list.forEach(SensorGolemLastSeen::golemDetected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
|
||||
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
|
||||
protected static final DataWatcherObject<Byte> DATA_PLAYER_MODE_CUSTOMISATION = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.BYTE);
|
||||
@@ -148,7 +162,7 @@
|
||||
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
|
||||
@@ -149,7 +163,7 @@
|
||||
public static final int CLIENT_LOADED_TIMEOUT_TIME = 60;
|
||||
private long timeEntitySatOnShoulder;
|
||||
final PlayerInventory inventory = new PlayerInventory(this);
|
||||
- protected InventoryEnderChest enderChestInventory = new InventoryEnderChest();
|
||||
|
@ -39,7 +39,7 @@
|
|||
public final ContainerPlayer inventoryMenu;
|
||||
public Container containerMenu;
|
||||
protected FoodMetaData foodData = new FoodMetaData();
|
||||
@@ -186,6 +200,16 @@
|
||||
@@ -189,6 +203,16 @@
|
||||
private boolean ignoreFallDamageFromCurrentImpulse;
|
||||
private int currentImpulseContextResetGraceTime;
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
|
||||
super(EntityTypes.PLAYER, world);
|
||||
this.lastItemInMainHand = ItemStack.EMPTY;
|
||||
@@ -350,7 +374,7 @@
|
||||
@@ -353,7 +377,7 @@
|
||||
}
|
||||
|
||||
private void turtleHelmetTick() {
|
||||
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
private boolean isEquipped(Item item) {
|
||||
@@ -520,8 +544,14 @@
|
||||
@@ -523,8 +547,14 @@
|
||||
public void rideTick() {
|
||||
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
|
@ -82,7 +82,7 @@
|
|||
super.rideTick();
|
||||
this.oBob = this.bob;
|
||||
this.bob = 0.0F;
|
||||
@@ -716,6 +746,13 @@
|
||||
@@ -719,6 +749,13 @@
|
||||
|
||||
@Nullable
|
||||
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
|
||||
|
@ -96,7 +96,7 @@
|
|||
if (!itemstack.isEmpty() && this.level().isClientSide) {
|
||||
this.swing(EnumHand.MAIN_HAND);
|
||||
}
|
||||
@@ -806,7 +843,7 @@
|
||||
@@ -809,7 +846,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("LastDeathLocation", 10)) {
|
||||
|
@ -105,7 +105,7 @@
|
|||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -814,7 +851,7 @@
|
||||
@@ -817,7 +854,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("current_explosion_impact_pos", 9)) {
|
||||
|
@ -114,7 +114,7 @@
|
|||
Logger logger1 = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -851,7 +888,7 @@
|
||||
@@ -854,7 +891,7 @@
|
||||
}
|
||||
|
||||
this.getLastDeathLocation().flatMap((globalpos) -> {
|
||||
|
@ -123,7 +123,7 @@
|
|||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -883,10 +920,10 @@
|
||||
@@ -886,10 +923,10 @@
|
||||
if (this.isDeadOrDying()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -136,7 +136,7 @@
|
|||
}
|
||||
|
||||
if (worldserver.getDifficulty() == EnumDifficulty.EASY) {
|
||||
@@ -898,7 +935,13 @@
|
||||
@@ -901,7 +938,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -920,10 +963,29 @@
|
||||
@@ -923,10 +966,29 @@
|
||||
}
|
||||
|
||||
public boolean canHarmPlayer(EntityHuman entityhuman) {
|
||||
|
@ -184,7 +184,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -963,8 +1025,13 @@
|
||||
@@ -966,8 +1028,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@
|
|||
if (!this.isInvulnerableTo(worldserver, damagesource)) {
|
||||
f = this.getDamageAfterArmorAbsorb(damagesource, f);
|
||||
f = this.getDamageAfterMagicAbsorb(damagesource, f);
|
||||
@@ -979,7 +1046,7 @@
|
||||
@@ -982,7 +1049,7 @@
|
||||
}
|
||||
|
||||
if (f != 0.0F) {
|
||||
|
@ -208,7 +208,7 @@
|
|||
this.getCombatTracker().recordDamage(damagesource, f);
|
||||
this.setHealth(this.getHealth() - f);
|
||||
if (f < 3.4028235E37F) {
|
||||
@@ -989,6 +1056,7 @@
|
||||
@@ -992,6 +1059,7 @@
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE);
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@
|
|||
}
|
||||
|
||||
public boolean isTextFilteringEnabled() {
|
||||
@@ -1141,10 +1209,15 @@
|
||||
@@ -1144,10 +1212,15 @@
|
||||
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
|
@ -233,7 +233,7 @@
|
|||
if (iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true)) {
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource());
|
||||
return;
|
||||
@@ -1220,8 +1293,13 @@
|
||||
@@ -1223,8 +1296,13 @@
|
||||
if (entityliving2 != this && entityliving2 != entity && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof EntityArmorStand) || !((EntityArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) {
|
||||
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
|
||||
|
||||
|
@ -248,7 +248,7 @@
|
|||
World world = this.level();
|
||||
|
||||
if (world instanceof WorldServer) {
|
||||
@@ -1237,9 +1315,26 @@
|
||||
@@ -1240,9 +1318,26 @@
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer && entity.hurtMarked) {
|
||||
|
@ -275,7 +275,7 @@
|
|||
}
|
||||
|
||||
if (flag2) {
|
||||
@@ -1305,9 +1400,14 @@
|
||||
@@ -1308,9 +1403,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1348,7 +1448,14 @@
|
||||
@@ -1351,7 +1451,14 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
|
@ -307,7 +307,7 @@
|
|||
this.inventoryMenu.removed(this);
|
||||
if (this.containerMenu != null && this.hasContainerOpen()) {
|
||||
this.doCloseContainer();
|
||||
@@ -1388,6 +1495,12 @@
|
||||
@@ -1391,6 +1498,12 @@
|
||||
}
|
||||
|
||||
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
|
||||
|
@ -320,7 +320,7 @@
|
|||
this.startSleeping(blockposition);
|
||||
this.sleepCounter = 0;
|
||||
return Either.right(Unit.INSTANCE);
|
||||
@@ -1542,12 +1655,24 @@
|
||||
@@ -1545,12 +1658,24 @@
|
||||
}
|
||||
|
||||
public void startFallFlying() {
|
||||
|
@ -346,7 +346,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1662,10 +1787,21 @@
|
||||
@@ -1665,10 +1790,21 @@
|
||||
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1745,13 +1881,20 @@
|
||||
@@ -1748,13 +1884,20 @@
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
|
@ -393,7 +393,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1795,26 +1938,31 @@
|
||||
@@ -1798,26 +1941,31 @@
|
||||
|
||||
protected void removeEntitiesOnShoulder() {
|
||||
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
public abstract class EntityArrow extends IProjectile {
|
||||
|
||||
private static final double ARROW_BASE_DAMAGE = 2.0D;
|
||||
@@ -86,7 +93,14 @@
|
||||
@@ -88,7 +95,14 @@
|
||||
}
|
||||
|
||||
protected EntityArrow(EntityTypes<? extends EntityArrow> entitytypes, double d0, double d1, double d2, World world, ItemStack itemstack, @Nullable ItemStack itemstack1) {
|
||||
|
@ -29,7 +29,7 @@
|
|||
this.pickupItemStack = itemstack.copy();
|
||||
this.setCustomName((IChatBaseComponent) itemstack.get(DataComponents.CUSTOM_NAME));
|
||||
Unit unit = (Unit) itemstack.remove(DataComponents.INTANGIBLE_PROJECTILE);
|
||||
@@ -112,8 +126,8 @@
|
||||
@@ -114,8 +128,8 @@
|
||||
}
|
||||
|
||||
protected EntityArrow(EntityTypes<? extends EntityArrow> entitytypes, EntityLiving entityliving, World world, ItemStack itemstack, @Nullable ItemStack itemstack1) {
|
||||
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
|
||||
public void setSoundEvent(SoundEffect soundeffect) {
|
||||
@@ -276,7 +290,7 @@
|
||||
@@ -282,7 +296,7 @@
|
||||
|
||||
if (movingobjectpositionentity == null) {
|
||||
if (this.isAlive() && movingobjectpositionblock.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
|
@ -49,7 +49,7 @@
|
|||
this.hasImpulse = true;
|
||||
}
|
||||
} else {
|
||||
@@ -284,7 +298,7 @@
|
||||
@@ -290,7 +304,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
|||
|
||||
this.hasImpulse = true;
|
||||
if (this.getPierceLevel() > 0 && projectiledeflection == ProjectileDeflection.NONE) {
|
||||
@@ -356,7 +370,7 @@
|
||||
@@ -357,7 +371,7 @@
|
||||
protected void tickDespawn() {
|
||||
++this.life;
|
||||
if (this.life >= 1200) {
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -408,7 +422,7 @@
|
||||
@@ -423,7 +437,7 @@
|
||||
}
|
||||
|
||||
if (this.piercingIgnoreEntityIds.size() >= this.getPierceLevel() + 1) {
|
||||
|
@ -76,7 +76,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -429,7 +443,13 @@
|
||||
@@ -444,7 +458,13 @@
|
||||
int k = entity.getRemainingFireTicks();
|
||||
|
||||
if (this.isOnFire() && !flag) {
|
||||
|
@ -91,7 +91,7 @@
|
|||
}
|
||||
|
||||
if (entity.hurtOrSimulate(damagesource, (float) i)) {
|
||||
@@ -475,7 +495,7 @@
|
||||
@@ -490,7 +510,7 @@
|
||||
|
||||
this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
if (this.getPierceLevel() <= 0) {
|
||||
|
@ -100,7 +100,7 @@
|
|||
}
|
||||
} else {
|
||||
entity.setRemainingFireTicks(k);
|
||||
@@ -491,7 +511,7 @@
|
||||
@@ -506,7 +526,7 @@
|
||||
this.spawnAtLocation(worldserver2, this.getPickupItem(), 0.1F);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -660,7 +680,7 @@
|
||||
@@ -675,7 +695,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("weapon", 10)) {
|
||||
|
@ -118,7 +118,7 @@
|
|||
} else {
|
||||
this.firedFromWeapon = null;
|
||||
}
|
||||
@@ -673,34 +693,31 @@
|
||||
@@ -688,34 +708,31 @@
|
||||
Entity entity1 = entity;
|
||||
byte b0 = 0;
|
||||
|
||||
|
@ -165,7 +165,7 @@
|
|||
}
|
||||
|
||||
this.pickup = entityarrow_pickupstatus;
|
||||
@@ -709,9 +726,24 @@
|
||||
@@ -724,9 +741,24 @@
|
||||
@Override
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level().isClientSide && (this.isInGround() || this.isNoPhysics()) && this.shakeTime <= 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
@@ -19,11 +19,17 @@
|
||||
@@ -15,11 +15,17 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -73,7 +79,7 @@
|
||||
@@ -69,7 +75,7 @@
|
||||
|
||||
this.applyInertia();
|
||||
if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) {
|
||||
|
@ -27,7 +27,7 @@
|
|||
} else {
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
|
||||
Vec3D vec3d;
|
||||
@@ -93,7 +99,7 @@
|
||||
@@ -89,7 +95,7 @@
|
||||
}
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && this.isAlive()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
||||
@@ -12,6 +12,10 @@
|
||||
@@ -10,6 +10,10 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
|
||||
|
@ -11,20 +11,20 @@
|
|||
public class EntityThrownExpBottle extends EntityProjectileThrowable {
|
||||
|
||||
public EntityThrownExpBottle(EntityTypes<? extends EntityThrownExpBottle> entitytypes, World world) {
|
||||
@@ -40,11 +44,20 @@
|
||||
@@ -38,11 +42,20 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (this.level() instanceof WorldServer) {
|
||||
- this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
||||
- this.level().levelEvent(2002, this.blockPosition(), -13083194);
|
||||
+ // CraftBukkit - moved to after event
|
||||
+ // this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
||||
+ // this.level().levelEvent(2002, this.blockPosition(), -13083194);
|
||||
int i = 3 + this.level().random.nextInt(5) + this.level().random.nextInt(5);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, movingobjectposition, i);
|
||||
+ i = event.getExperience();
|
||||
+ if (event.getShowEffect()) {
|
||||
+ this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
||||
+ this.level().levelEvent(2002, this.blockPosition(), -13083194);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
public class EntityThrownTrident extends EntityArrow {
|
||||
|
||||
private static final DataWatcherObject<Byte> ID_LOYALTY = DataWatcher.defineId(EntityThrownTrident.class, DataWatcherRegistry.BYTE);
|
||||
@@ -75,10 +79,10 @@
|
||||
@@ -76,10 +80,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -136,7 +140,7 @@
|
||||
@@ -137,7 +141,7 @@
|
||||
|
||||
world = this.level();
|
||||
if (world instanceof WorldServer) {
|
||||
|
|
|
@ -29,15 +29,6 @@
|
|||
this.mob = entityraider;
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
@@ -524,7 +528,7 @@
|
||||
private final float hostileRadiusSqr;
|
||||
public final PathfinderTargetCondition shoutTargeting = PathfinderTargetCondition.forNonCombat().range(8.0D).ignoreLineOfSight().ignoreInvisibilityTesting();
|
||||
|
||||
- public a(final EntityRaider entityraider, final EntityIllagerAbstract entityillagerabstract, final float f) {
|
||||
+ public a(final EntityIllagerAbstract entityillagerabstract, final float f) { // CraftBukkit - decompile error
|
||||
this.mob = entityillagerabstract;
|
||||
this.hostileRadiusSqr = f * f;
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
|
||||
@@ -547,7 +551,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityRaider entityraider = (EntityRaider) iterator.next();
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
if (!this.level().isClientSide && entity_removalreason.shouldDestroy() && this.isLeashed()) {
|
||||
this.dropLeash(true, true);
|
||||
this.dropLeash();
|
||||
}
|
||||
|
||||
- super.remove(entity_removalreason);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartCommandBlock.java
|
||||
@@ -140,5 +140,12 @@
|
||||
@@ -135,5 +135,12 @@
|
||||
public boolean isValid() {
|
||||
return !EntityMinecartCommandBlock.this.isRemoved();
|
||||
}
|
||||
|
|
|
@ -12,22 +12,22 @@
|
|||
public class EntityMinecartTNT extends EntityMinecartAbstract {
|
||||
|
||||
private static final byte EVENT_PRIME = 10;
|
||||
@@ -33,6 +38,7 @@
|
||||
private static final float DEFAULT_EXPLOSION_POWER_BASE = 4.0F;
|
||||
@@ -37,6 +42,7 @@
|
||||
public int fuse = -1;
|
||||
public float explosionPowerBase = 4.0F;
|
||||
public float explosionSpeedFactor = 1.0F;
|
||||
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
|
||||
public EntityMinecartTNT(EntityTypes<? extends EntityMinecartTNT> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -113,8 +119,16 @@
|
||||
@@ -117,8 +123,16 @@
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
double d1 = Math.min(Math.sqrt(d0), 5.0D);
|
||||
|
||||
- worldserver.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), (float) ((double) this.explosionPowerBase + this.random.nextDouble() * 1.5D * d1), false, World.a.TNT);
|
||||
- worldserver.explode(this, damagesource, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), (float) ((double) this.explosionPowerBase + (double) this.explosionSpeedFactor * this.random.nextDouble() * 1.5D * d1), false, World.a.TNT);
|
||||
- this.discard();
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), (float) ((double) this.explosionPowerBase + this.random.nextDouble() * 1.5D * d1), this.isIncendiary);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), (float) ((double) this.explosionPowerBase + (double) this.explosionSpeedFactor * this.random.nextDouble() * 1.5D * d1), this.isIncendiary);
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ fuse = -1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/inventory/ContainerBrewingStand.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerBrewingStand.java
|
||||
@@ -16,6 +16,11 @@
|
||||
@@ -17,6 +17,11 @@
|
||||
import net.minecraft.world.item.alchemy.PotionContents;
|
||||
import net.minecraft.world.item.alchemy.PotionRegistry;
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
|||
+
|
||||
public class ContainerBrewingStand extends Container {
|
||||
|
||||
private static final int BOTTLE_SLOT_START = 0;
|
||||
@@ -32,12 +37,18 @@
|
||||
static final MinecraftKey EMPTY_SLOT_FUEL = MinecraftKey.withDefaultNamespace("container/slot/brewing_fuel");
|
||||
@@ -35,12 +40,18 @@
|
||||
private final IContainerProperties brewingStandData;
|
||||
private final Slot ingredientSlot;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
checkContainerSize(iinventory, 5);
|
||||
checkContainerDataCount(icontainerproperties, 2);
|
||||
this.brewingStand = iinventory;
|
||||
@@ -55,6 +66,7 @@
|
||||
@@ -58,6 +69,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
|
@ -39,8 +39,8 @@
|
|||
return this.brewingStand.stillValid(entityhuman);
|
||||
}
|
||||
|
||||
@@ -185,4 +197,17 @@
|
||||
return itemstack.is(TagsItem.BREWING_FUEL);
|
||||
@@ -198,4 +210,17 @@
|
||||
return ContainerBrewingStand.EMPTY_SLOT_FUEL;
|
||||
}
|
||||
}
|
||||
+
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/inventory/ContainerEnchantTable.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerEnchantTable.java
|
||||
@@ -31,6 +31,19 @@
|
||||
@@ -30,6 +30,19 @@
|
||||
import net.minecraft.world.level.block.BlockEnchantmentTable;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
|||
+
|
||||
public class ContainerEnchantTable extends Container {
|
||||
|
||||
static final MinecraftKey EMPTY_SLOT_LAPIS_LAZULI = MinecraftKey.withDefaultNamespace("item/empty_slot_lapis_lazuli");
|
||||
@@ -41,6 +54,10 @@
|
||||
static final MinecraftKey EMPTY_SLOT_LAPIS_LAZULI = MinecraftKey.withDefaultNamespace("container/slot/lapis_lazuli");
|
||||
@@ -40,6 +53,10 @@
|
||||
public final int[] costs;
|
||||
public final int[] enchantClue;
|
||||
public final int[] levelClue;
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
public ContainerEnchantTable(int i, PlayerInventory playerinventory) {
|
||||
this(i, playerinventory, ContainerAccess.NULL);
|
||||
@@ -54,6 +71,13 @@
|
||||
@@ -53,6 +70,13 @@
|
||||
super.setChanged();
|
||||
ContainerEnchantTable.this.slotsChanged(this);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
|||
};
|
||||
this.random = RandomSource.create();
|
||||
this.enchantmentSeed = ContainerProperty.standalone();
|
||||
@@ -61,13 +85,13 @@
|
||||
@@ -60,13 +84,13 @@
|
||||
this.enchantClue = new int[]{-1, -1, -1};
|
||||
this.levelClue = new int[]{-1, -1, -1};
|
||||
this.access = containeraccess;
|
||||
|
@ -61,7 +61,7 @@
|
|||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.is(Items.LAPIS_LAZULI);
|
||||
@@ -89,6 +113,9 @@
|
||||
@@ -88,6 +112,9 @@
|
||||
this.addDataSlot(ContainerProperty.shared(this.levelClue, 0));
|
||||
this.addDataSlot(ContainerProperty.shared(this.levelClue, 1));
|
||||
this.addDataSlot(ContainerProperty.shared(this.levelClue, 2));
|
||||
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -96,7 +123,7 @@
|
||||
@@ -95,7 +122,7 @@
|
||||
if (iinventory == this.enchantSlots) {
|
||||
ItemStack itemstack = iinventory.getItem(0);
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
|||
this.access.execute((world, blockposition) -> {
|
||||
Registry<Holder<Enchantment>> registry = world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT).asHolderIdMap();
|
||||
int i = 0;
|
||||
@@ -136,6 +163,41 @@
|
||||
@@ -135,6 +162,41 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@
|
|||
this.broadcastChanges();
|
||||
});
|
||||
} else {
|
||||
@@ -163,21 +225,46 @@
|
||||
@@ -162,21 +224,46 @@
|
||||
ItemStack itemstack2 = itemstack;
|
||||
List<WeightedRandomEnchant> list = this.getEnchantmentList(world.registryAccess(), itemstack, i, this.costs[i]);
|
||||
|
||||
|
@ -175,7 +175,7 @@
|
|||
itemstack1.consume(j, entityhuman);
|
||||
if (itemstack1.isEmpty()) {
|
||||
this.enchantSlots.setItem(1, ItemStack.EMPTY);
|
||||
@@ -244,6 +331,7 @@
|
||||
@@ -243,6 +330,7 @@
|
||||
|
||||
@Override
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
|
@ -183,7 +183,7 @@
|
|||
return stillValid(this.access, entityhuman, Blocks.ENCHANTING_TABLE);
|
||||
}
|
||||
|
||||
@@ -294,4 +382,17 @@
|
||||
@@ -293,4 +381,17 @@
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/inventory/ContainerHorse.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerHorse.java
|
||||
@@ -10,6 +10,11 @@
|
||||
@@ -11,6 +11,11 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
|||
+
|
||||
public class ContainerHorse extends Container {
|
||||
|
||||
private final IInventory horseContainer;
|
||||
@@ -18,13 +23,28 @@
|
||||
static final MinecraftKey SADDLE_SLOT_SPRITE = MinecraftKey.withDefaultNamespace("container/slot/saddle");
|
||||
@@ -22,13 +27,28 @@
|
||||
private static final int SLOT_BODY_ARMOR = 1;
|
||||
private static final int SLOT_HORSE_INVENTORY_START = 2;
|
||||
|
||||
|
@ -42,12 +42,12 @@
|
|||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return itemstack.is(Items.SADDLE) && !this.hasItem() && entityhorseabstract.isSaddleable();
|
||||
@@ -35,7 +55,7 @@
|
||||
return entityhorseabstract.isSaddleable();
|
||||
}
|
||||
@@ -46,7 +66,7 @@
|
||||
});
|
||||
- this.addSlot(new ArmorSlot(this, this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, (MinecraftKey) null) {
|
||||
+ this.addSlot(new ArmorSlot(this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, (MinecraftKey) null) { // CraftBukkit - decompile error
|
||||
MinecraftKey minecraftkey = entityhorseabstract instanceof EntityLlama ? ContainerHorse.LLAMA_ARMOR_SLOT_SPRITE : ContainerHorse.ARMOR_SLOT_SPRITE;
|
||||
|
||||
- this.addSlot(new ArmorSlot(this, this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, minecraftkey) {
|
||||
+ this.addSlot(new ArmorSlot(this.armorContainer, entityhorseabstract, EnumItemSlot.BODY, 0, 8, 36, minecraftkey) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack itemstack) {
|
||||
return entityhorseabstract.isEquippableInSlot(itemstack, EnumItemSlot.BODY);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/inventory/ContainerPlayer.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerPlayer.java
|
||||
@@ -13,6 +13,12 @@
|
||||
@@ -12,6 +12,12 @@
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class ContainerPlayer extends AbstractCraftingMenu {
|
||||
|
||||
public static final int CONTAINER_ID = 0;
|
||||
@@ -40,9 +46,15 @@
|
||||
@@ -38,9 +44,15 @@
|
||||
private static final EnumItemSlot[] SLOT_IDS = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
|
||||
public final boolean active;
|
||||
private final EntityHuman owner;
|
||||
|
@ -30,7 +30,7 @@
|
|||
this.active = flag;
|
||||
this.owner = entityhuman;
|
||||
this.addResultSlot(entityhuman, 154, 28);
|
||||
@@ -56,7 +68,7 @@
|
||||
@@ -54,7 +66,7 @@
|
||||
}
|
||||
|
||||
this.addStandardInventorySlots(playerinventory, 8, 84);
|
||||
|
@ -39,7 +39,7 @@
|
|||
@Override
|
||||
public void setByPlayer(ItemStack itemstack, ItemStack itemstack1) {
|
||||
entityhuman.onEquipItem(EnumItemSlot.OFFHAND, itemstack1, itemstack);
|
||||
@@ -192,4 +204,17 @@
|
||||
@@ -190,4 +202,17 @@
|
||||
protected EntityHuman owner() {
|
||||
return this.owner;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
return stillValid(this.access, entityhuman, Blocks.STONECUTTER);
|
||||
}
|
||||
|
||||
@@ -154,7 +185,7 @@
|
||||
@@ -158,7 +189,7 @@
|
||||
}
|
||||
|
||||
void setupResultSlot(int i) {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
--- a/net/minecraft/world/item/ItemEgg.java
|
||||
+++ b/net/minecraft/world/item/ItemEgg.java
|
||||
@@ -23,10 +23,18 @@
|
||||
@@ -25,10 +25,18 @@
|
||||
public EnumInteractionResult use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
+ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
- IProjectile.spawnProjectileFromRotation(EntityEgg::new, worldserver, itemstack, entityhuman, 0.0F, 1.5F, 1.0F);
|
||||
- IProjectile.spawnProjectileFromRotation(EntityEgg::new, worldserver, itemstack, entityhuman, 0.0F, ItemEgg.PROJECTILE_SHOOT_POWER, 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ if (IProjectile.spawnProjectileFromRotation(EntityEgg::new, worldserver, itemstack, entityhuman, 0.0F, 1.5F, 1.0F).isRemoved()) {
|
||||
+ if (IProjectile.spawnProjectileFromRotation(EntityEgg::new, worldserver, itemstack, entityhuman, 0.0F, ItemEgg.PROJECTILE_SHOOT_POWER, 1.0F).isRemoved()) {
|
||||
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
--- a/net/minecraft/world/item/ItemEnderPearl.java
|
||||
+++ b/net/minecraft/world/item/ItemEnderPearl.java
|
||||
@@ -21,10 +21,17 @@
|
||||
@@ -23,10 +23,17 @@
|
||||
public EnumInteractionResult use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
- IProjectile.spawnProjectileFromRotation(EntityEnderPearl::new, worldserver, itemstack, entityhuman, 0.0F, 1.5F, 1.0F);
|
||||
- IProjectile.spawnProjectileFromRotation(EntityEnderPearl::new, worldserver, itemstack, entityhuman, 0.0F, ItemEnderPearl.PROJECTILE_SHOOT_POWER, 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ if (IProjectile.spawnProjectileFromRotation(EntityEnderPearl::new, worldserver, itemstack, entityhuman, 0.0F, 1.5F, 1.0F).isRemoved()) {
|
||||
+ if (IProjectile.spawnProjectileFromRotation(EntityEnderPearl::new, worldserver, itemstack, entityhuman, 0.0F, ItemEnderPearl.PROJECTILE_SHOOT_POWER, 1.0F).isRemoved()) {
|
||||
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
||||
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
int j = (int) (EnchantmentManager.getFishingTimeReduction(worldserver, itemstack, entityhuman) * 20.0F);
|
||||
int k = EnchantmentManager.getFishingLuckBonus(worldserver, itemstack, entityhuman);
|
||||
|
||||
- IProjectile.spawnProjectile(new EntityFishingHook(entityhuman, world, k, j, itemstack), worldserver, itemstack);
|
||||
- IProjectile.spawnProjectile(new EntityFishingHook(entityhuman, world, k, j), worldserver, itemstack);
|
||||
+ // CraftBukkit start
|
||||
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, k, j, itemstack);
|
||||
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, k, j);
|
||||
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand), PlayerFishEvent.State.FISHING);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
||||
+
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/item/ItemSnowball.java
|
||||
+++ b/net/minecraft/world/item/ItemSnowball.java
|
||||
@@ -23,13 +23,21 @@
|
||||
@@ -25,13 +25,21 @@
|
||||
public EnumInteractionResult use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
|||
+ // CraftBukkit start - moved down
|
||||
+ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
- IProjectile.spawnProjectileFromRotation(EntitySnowball::new, worldserver, itemstack, entityhuman, 0.0F, 1.5F, 1.0F);
|
||||
+ if (IProjectile.spawnProjectileFromRotation(EntitySnowball::new, worldserver, itemstack, entityhuman, 0.0F, 1.5F, 1.0F).isAlive()) {
|
||||
- IProjectile.spawnProjectileFromRotation(EntitySnowball::new, worldserver, itemstack, entityhuman, 0.0F, ItemSnowball.PROJECTILE_SHOOT_POWER, 1.0F);
|
||||
+ if (IProjectile.spawnProjectileFromRotation(EntitySnowball::new, worldserver, itemstack, entityhuman, 0.0F, ItemSnowball.PROJECTILE_SHOOT_POWER, 1.0F).isAlive()) {
|
||||
+ itemstack.consume(1, entityhuman);
|
||||
+
|
||||
+ world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -96,17 +96,51 @@
|
||||
@@ -96,18 +96,52 @@
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
|||
+
|
||||
public final class ItemStack implements DataComponentHolder {
|
||||
|
||||
private static final List<IChatBaseComponent> OP_NBT_WARNING = List.of(IChatBaseComponent.translatable("item.op_warning.line1").withStyle(EnumChatFormat.RED, EnumChatFormat.BOLD), IChatBaseComponent.translatable("item.op_warning.line2").withStyle(EnumChatFormat.RED), IChatBaseComponent.translatable("item.op_warning.line3").withStyle(EnumChatFormat.RED));
|
||||
public static final Codec<ItemStack> CODEC = Codec.lazyInitialized(() -> {
|
||||
- return RecordCodecBuilder.create((instance) -> {
|
||||
+ return RecordCodecBuilder.<ItemStack>create((instance) -> { // CraftBukkit - decompile error
|
||||
|
@ -54,7 +55,7 @@
|
|||
return instance.group(Item.CODEC.fieldOf("id").forGetter(ItemStack::getItemHolder), DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY).forGetter((itemstack) -> {
|
||||
return itemstack.components.asPatch();
|
||||
})).apply(instance, (holder, datacomponentpatch) -> {
|
||||
@@ -131,19 +165,25 @@
|
||||
@@ -132,19 +166,25 @@
|
||||
if (i <= 0) {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
|
@ -84,7 +85,7 @@
|
|||
DataComponentPatch.STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.components.asPatch());
|
||||
}
|
||||
}
|
||||
@@ -186,7 +226,7 @@
|
||||
@@ -187,7 +227,7 @@
|
||||
|
||||
return dataresult.isError() ? dataresult.map((unit) -> {
|
||||
return itemstack;
|
||||
|
@ -93,7 +94,7 @@
|
|||
int i = itemstack.getCount();
|
||||
|
||||
return "Item stack with stack size of " + i + " was larger than maximum: " + itemstack.getMaxStackSize();
|
||||
@@ -289,8 +329,9 @@
|
||||
@@ -294,8 +334,9 @@
|
||||
j = itemstack.getMaxStackSize();
|
||||
} while (i <= j);
|
||||
|
||||
|
@ -104,7 +105,7 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
@@ -372,15 +413,173 @@
|
||||
@@ -377,15 +418,173 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
Item item = this.getItem();
|
||||
|
@ -280,7 +281,7 @@
|
|||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -487,6 +686,21 @@
|
||||
@@ -492,6 +691,21 @@
|
||||
|
||||
public void hurtAndBreak(int i, WorldServer worldserver, @Nullable EntityPlayer entityplayer, Consumer<Item> consumer) {
|
||||
int j = this.processDurabilityChange(i, worldserver, entityplayer);
|
||||
|
@ -302,7 +303,7 @@
|
|||
|
||||
if (j != 0) {
|
||||
this.applyDamage(this.getDamageValue() + j, entityplayer, consumer);
|
||||
@@ -506,6 +720,11 @@
|
||||
@@ -511,6 +725,11 @@
|
||||
this.setDamageValue(i);
|
||||
if (this.isBroken()) {
|
||||
Item item = this.getItem();
|
||||
|
@ -314,7 +315,7 @@
|
|||
|
||||
this.shrink(1);
|
||||
consumer.accept(item);
|
||||
@@ -765,6 +984,12 @@
|
||||
@@ -770,6 +989,12 @@
|
||||
return this.getItem().useOnRelease(this);
|
||||
}
|
||||
|
||||
|
@ -327,7 +328,7 @@
|
|||
@Nullable
|
||||
public <T> T set(DataComponentType<? super T> datacomponenttype, @Nullable T t0) {
|
||||
return this.components.set(datacomponenttype, t0);
|
||||
@@ -846,7 +1071,7 @@
|
||||
@@ -858,7 +1083,7 @@
|
||||
}
|
||||
|
||||
private <T extends TooltipProvider> void addToTooltip(DataComponentType<T> datacomponenttype, Item.b item_b, Consumer<IChatBaseComponent> consumer, TooltipFlag tooltipflag) {
|
||||
|
@ -336,7 +337,7 @@
|
|||
|
||||
if (t0 != null) {
|
||||
t0.addToTooltip(item_b, consumer, tooltipflag);
|
||||
@@ -1073,6 +1298,13 @@
|
||||
@@ -1091,6 +1316,13 @@
|
||||
EnchantmentManager.forEachModifier(this, enumitemslot, biconsumer);
|
||||
}
|
||||
|
||||
|
@ -350,7 +351,7 @@
|
|||
public IChatBaseComponent getDisplayName() {
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().append(this.getHoverName());
|
||||
|
||||
@@ -1135,7 +1367,7 @@
|
||||
@@ -1153,7 +1385,7 @@
|
||||
}
|
||||
|
||||
public void consume(int i, @Nullable EntityLiving entityliving) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/item/ItemTrident.java
|
||||
+++ b/net/minecraft/world/item/ItemTrident.java
|
||||
@@ -85,9 +85,19 @@
|
||||
@@ -86,9 +86,19 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
if (entityhuman.hasInfiniteMaterials()) {
|
||||
entitythrowntrident.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
||||
@@ -97,6 +107,10 @@
|
||||
@@ -98,6 +108,10 @@
|
||||
|
||||
world.playSound((EntityHuman) null, (Entity) entitythrowntrident, (SoundEffect) holder.value(), SoundCategory.PLAYERS, 1.0F, 1.0F);
|
||||
return true;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
public int getColor() {
|
||||
@@ -176,7 +176,7 @@
|
||||
@@ -172,7 +172,7 @@
|
||||
if (((MobEffectList) mobeffect.getEffect().value()).isInstantenous()) {
|
||||
((MobEffectList) mobeffect.getEffect().value()).applyInstantenousEffect(worldserver, entityhuman2, entityhuman2, entityliving, mobeffect.getAmplifier(), 1.0D);
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
@@ -38,6 +38,11 @@
|
||||
@@ -39,6 +39,11 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class CraftingManager extends ResourceDataAbstract<RecipeMap> implements RecipeAccess {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -109,7 +114,25 @@
|
||||
@@ -111,7 +116,25 @@
|
||||
CraftingManager.LOGGER.info("Loaded {} recipes", recipemap.values().size());
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
List<SelectableRecipe.a<RecipeStonecutting>> list = new ArrayList();
|
||||
List<CraftingManager.b> list1 = CraftingManager.RECIPE_PROPERTY_SETS.entrySet().stream().map((entry) -> {
|
||||
return new CraftingManager.b((ResourceKey) entry.getKey(), (CraftingManager.c) entry.getValue());
|
||||
@@ -128,7 +151,7 @@
|
||||
@@ -130,7 +153,7 @@
|
||||
RecipeStonecutting recipestonecutting = (RecipeStonecutting) irecipe;
|
||||
|
||||
if (isIngredientEnabled(featureflagset, recipestonecutting.input()) && recipestonecutting.resultDisplay().isEnabled(featureflagset)) {
|
||||
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +193,10 @@
|
||||
@@ -172,7 +195,10 @@
|
||||
}
|
||||
|
||||
public <I extends RecipeInput, T extends IRecipe<I>> Optional<RecipeHolder<T>> getRecipeFor(Recipes<T> recipes, I i0, World world) {
|
||||
|
@ -59,7 +59,7 @@
|
|||
}
|
||||
|
||||
public Optional<RecipeHolder<?>> byKey(ResourceKey<IRecipe<?>> resourcekey) {
|
||||
@@ -181,7 +207,7 @@
|
||||
@@ -183,7 +209,7 @@
|
||||
private <T extends IRecipe<?>> RecipeHolder<T> byKeyTyped(Recipes<T> recipes, ResourceKey<IRecipe<?>> resourcekey) {
|
||||
RecipeHolder<?> recipeholder = this.recipes.byKey(resourcekey);
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
}
|
||||
|
||||
public Map<ResourceKey<RecipePropertySet>, RecipePropertySet> getSynchronizedItemProperties() {
|
||||
@@ -229,6 +255,22 @@
|
||||
@@ -231,6 +257,22 @@
|
||||
return new RecipeHolder<>(resourcekey, irecipe);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,21 @@
|
|||
--- a/net/minecraft/world/item/crafting/RecipeItemStack.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeItemStack.java
|
||||
@@ -42,6 +42,24 @@
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.item.crafting.display.SlotDisplay;
|
||||
import net.minecraft.world.level.IMaterial;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import javax.annotation.Nullable;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public final class RecipeItemStack implements AutoRecipeStackManager.a<Holder<Item>>, Predicate<ItemStack> {
|
||||
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, RecipeItemStack> CONTENTS_STREAM_CODEC = ByteBufCodecs.holderSet(Registries.ITEM).map(RecipeItemStack::new, (recipeitemstack) -> {
|
||||
@@ -38,6 +43,24 @@
|
||||
return recipeitemstack.values;
|
||||
});
|
||||
private final HolderSet<Item> values;
|
||||
@Nullable
|
||||
private List<Holder<Item>> items;
|
||||
+ // CraftBukkit start
|
||||
+ @Nullable
|
||||
+ private List<ItemStack> itemStacks;
|
||||
|
@ -25,7 +37,7 @@
|
|||
|
||||
private RecipeItemStack(HolderSet<Item> holderset) {
|
||||
holderset.unwrap().ifRight((list) -> {
|
||||
@@ -72,6 +90,17 @@
|
||||
@@ -70,6 +93,17 @@
|
||||
}
|
||||
|
||||
public boolean test(ItemStack itemstack) {
|
||||
|
@ -40,10 +52,10 @@
|
|||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
List<Holder<Item>> list = this.items();
|
||||
return itemstack.is(this.values);
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
@@ -85,7 +114,7 @@
|
||||
@@ -79,7 +113,7 @@
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof RecipeItemStack recipeitemstack) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--- a/net/minecraft/world/item/trading/IMerchant.java
|
||||
+++ b/net/minecraft/world/item/trading/IMerchant.java
|
||||
@@ -52,4 +52,6 @@
|
||||
}
|
||||
|
||||
@@ -54,4 +54,6 @@
|
||||
boolean isClientSide();
|
||||
|
||||
boolean stillValid(EntityHuman entityhuman);
|
||||
+
|
||||
+ org.bukkit.craftbukkit.inventory.CraftMerchant getCraftMerchant(); // CraftBukkit
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
+ vec3d = (event.isCancelled()) ? Vec3D.ZERO : new Vec3D(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d));
|
||||
entity.push(vec3d);
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
@@ -235,10 +290,62 @@
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/World.java
|
||||
+++ b/net/minecraft/world/level/World.java
|
||||
@@ -80,6 +80,28 @@
|
||||
@@ -81,6 +81,28 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.scores.Scoreboard;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
|||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
|
||||
@@ -120,7 +142,42 @@
|
||||
@@ -121,7 +143,42 @@
|
||||
private final DamageSources damageSources;
|
||||
private long subTickCount;
|
||||
|
||||
|
@ -73,7 +73,7 @@
|
|||
this.levelData = worlddatamutable;
|
||||
this.dimensionTypeRegistration = holder;
|
||||
final DimensionManager dimensionmanager = (DimensionManager) holder.value();
|
||||
@@ -128,15 +185,15 @@
|
||||
@@ -129,15 +186,15 @@
|
||||
this.dimension = resourcekey;
|
||||
this.isClientSide = flag;
|
||||
if (dimensionmanager.coordinateScale() != 1.0D) {
|
||||
|
@ -92,7 +92,7 @@
|
|||
}
|
||||
};
|
||||
} else {
|
||||
@@ -149,6 +206,42 @@
|
||||
@@ -150,6 +207,42 @@
|
||||
this.neighborUpdater = new CollectingNeighborUpdater(this, j);
|
||||
this.registryAccess = iregistrycustom;
|
||||
this.damageSources = new DamageSources(iregistrycustom);
|
||||
|
@ -135,7 +135,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -206,6 +299,18 @@
|
||||
@@ -207,6 +300,18 @@
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
|
@ -154,7 +154,7 @@
|
|||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.isDebug()) {
|
||||
@@ -213,13 +318,29 @@
|
||||
@@ -214,13 +319,29 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAt(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
@ -185,7 +185,7 @@
|
|||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -246,12 +367,69 @@
|
||||
@@ -247,12 +368,69 @@
|
||||
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
|
@ -255,7 +255,7 @@
|
|||
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
@Override
|
||||
@@ -339,6 +517,14 @@
|
||||
@@ -340,6 +518,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData getBlockState(BlockPosition blockposition) {
|
||||
|
@ -270,7 +270,7 @@
|
|||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return Blocks.VOID_AIR.defaultBlockState();
|
||||
} else {
|
||||
@@ -509,6 +695,16 @@
|
||||
@@ -510,6 +696,16 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity getBlockEntity(BlockPosition blockposition) {
|
||||
|
@ -287,7 +287,7 @@
|
|||
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
|
||||
}
|
||||
|
||||
@@ -516,6 +712,12 @@
|
||||
@@ -517,6 +713,12 @@
|
||||
BlockPosition blockposition = tileentity.getBlockPos();
|
||||
|
||||
if (!this.isOutsideBuildHeight(blockposition)) {
|
||||
|
@ -300,7 +300,7 @@
|
|||
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
|
||||
}
|
||||
}
|
||||
@@ -645,7 +847,7 @@
|
||||
@@ -643,7 +845,7 @@
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
EntityComplexPart entitycomplexpart = aentitycomplexpart[k];
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
|
||||
}
|
||||
|
||||
@@ -494,15 +500,23 @@
|
||||
@@ -490,15 +496,23 @@
|
||||
return this.builtInRegistryHolder;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
}
|
||||
|
||||
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
|
||||
@@ -325,6 +357,11 @@
|
||||
@@ -320,6 +352,11 @@
|
||||
BlockPosition blockposition1 = blockposition.relative((EnumDirection) iblockdata.getValue(BlockBed.FACING));
|
||||
|
||||
world.setBlock(blockposition1, (IBlockData) iblockdata.setValue(BlockBed.PART, BlockPropertyBedPart.HEAD), 3);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -302,7 +302,7 @@
|
||||
@@ -297,7 +297,7 @@
|
||||
ItemStack itemstack = new ItemStack(this);
|
||||
|
||||
itemstack.applyComponents(tileentitybeehive.collectComponents());
|
||||
|
@ -18,3 +18,12 @@
|
|||
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
@@ -332,7 +332,7 @@
|
||||
ItemStack itemstack = super.getCloneItemStack(iworldreader, blockposition, iblockdata, flag);
|
||||
|
||||
if (flag) {
|
||||
- itemstack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(BlockBeehive.HONEY_LEVEL, (Comparable) ((Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL))));
|
||||
+ itemstack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(BlockBeehive.HONEY_LEVEL, ((Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL)))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
super.entityInside(iblockdata, world, blockposition, entity);
|
||||
@@ -224,6 +224,11 @@
|
||||
@@ -219,6 +219,11 @@
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (iprojectile.isOnFire() && iprojectile.mayInteract(worldserver, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
@Override
|
||||
public MapCodec<? extends BlockChest> codec() {
|
||||
return BlockChest.CODEC;
|
||||
@@ -262,7 +277,7 @@
|
||||
@@ -257,7 +272,7 @@
|
||||
|
||||
@Override
|
||||
public DoubleBlockFinder.Result<? extends TileEntityChest> combine(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
|
||||
|
@ -74,7 +74,7 @@
|
|||
|
||||
if (flag) {
|
||||
bipredicate = (generatoraccess, blockposition1) -> {
|
||||
@@ -278,7 +293,14 @@
|
||||
@@ -273,7 +288,14 @@
|
||||
@Nullable
|
||||
@Override
|
||||
protected ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
public static final MapCodec<BlockComposter> CODEC = simpleCodec(BlockComposter::new);
|
||||
@@ -267,7 +272,14 @@
|
||||
@@ -269,7 +274,14 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
|
||||
if (i < 7 && BlockComposter.COMPOSTABLES.containsKey(itemstack.getItem())) {
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
itemstack.shrink(1);
|
||||
return iblockdata1;
|
||||
@@ -277,6 +289,14 @@
|
||||
@@ -279,6 +291,14 @@
|
||||
}
|
||||
|
||||
public static IBlockData extractProduce(Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
@ -43,7 +43,7 @@
|
|||
if (!world.isClientSide) {
|
||||
Vec3D vec3d = Vec3D.atLowerCornerWithOffset(blockposition, 0.5D, 1.01D, 0.5D).offsetRandom(world.random, 0.7F);
|
||||
EntityItem entityitem = new EntityItem(world, vec3d.x(), vec3d.y(), vec3d.z(), new ItemStack(Items.BONE_MEAL));
|
||||
@@ -300,10 +320,16 @@
|
||||
@@ -302,10 +322,16 @@
|
||||
}
|
||||
|
||||
static IBlockData addItem(@Nullable Entity entity, IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
|
||||
|
@ -61,7 +61,7 @@
|
|||
return iblockdata;
|
||||
} else {
|
||||
int j = i + 1;
|
||||
@@ -352,7 +378,8 @@
|
||||
@@ -354,7 +380,8 @@
|
||||
public IWorldInventory getContainer(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
|
||||
public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -367,6 +394,7 @@
|
||||
@@ -369,6 +396,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
|
@ -79,7 +79,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -391,8 +419,15 @@
|
||||
@@ -393,8 +421,15 @@
|
||||
|
||||
@Override
|
||||
public void setChanged() {
|
||||
|
@ -95,7 +95,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -405,6 +440,7 @@
|
||||
@@ -407,6 +442,7 @@
|
||||
|
||||
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
super(1);
|
||||
|
@ -103,7 +103,7 @@
|
|||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -447,8 +483,9 @@
|
||||
@@ -449,8 +485,9 @@
|
||||
|
||||
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
BlockPosition blockposition1 = blockposition.offset(randomsource.nextInt(3) - 1, randomsource.nextInt(5) - 3, randomsource.nextInt(3) - 1);
|
||||
|
||||
if (worldserver.getBlockState(blockposition1).is(Blocks.DIRT) && canPropagate(iblockdata1, worldserver, blockposition1)) {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW)));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
|
||||
- worldserver.setBlockAndUpdate(blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, isSnowySetting(worldserver.getBlockState(blockposition1.above()))));
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, isSnowySetting(worldserver.getBlockState(blockposition1.above())))); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/block/BlockLectern.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLectern.java
|
||||
@@ -211,11 +211,12 @@
|
||||
@@ -206,11 +206,12 @@
|
||||
}
|
||||
|
||||
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
@@ -67,8 +75,10 @@
|
||||
if (blockposition1.equals(blockposition)) {
|
||||
return true;
|
||||
return BlockPosition.b.ACCEPT;
|
||||
} else {
|
||||
- IBlockData iblockdata = world.getBlockState(blockposition1);
|
||||
- Fluid fluid = world.getFluidState(blockposition1);
|
||||
|
@ -36,14 +36,14 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
if (!fluid.is(TagsFluid.WATER)) {
|
||||
return false;
|
||||
return BlockPosition.b.SKIP;
|
||||
@@ -78,27 +88,64 @@
|
||||
if (block instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) block;
|
||||
|
||||
- if (!ifluidsource.pickupBlock((EntityHuman) null, world, blockposition1, iblockdata).isEmpty()) {
|
||||
+ if (!ifluidsource.pickupBlock((EntityHuman) null, blockList, blockposition1, iblockdata).isEmpty()) { // CraftBukkit
|
||||
return true;
|
||||
return BlockPosition.b.ACCEPT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
+ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3); // CraftBukkit
|
||||
} else {
|
||||
if (!iblockdata.is(Blocks.KELP) && !iblockdata.is(Blocks.KELP_PLANT) && !iblockdata.is(Blocks.SEAGRASS) && !iblockdata.is(Blocks.TALL_SEAGRASS)) {
|
||||
return false;
|
||||
return BlockPosition.b.SKIP;
|
||||
}
|
||||
|
||||
- TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
|
||||
|
@ -66,7 +66,7 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return true;
|
||||
return BlockPosition.b.ACCEPT;
|
||||
}
|
||||
}
|
||||
- }) > 1;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
if (world instanceof WorldServer worldserver) {
|
||||
if (world.getDifficulty() != EnumDifficulty.PEACEFUL && entity instanceof EntityLiving entityliving) {
|
||||
if (!entityliving.isInvulnerableTo(worldserver, world.damageSources().wither())) {
|
||||
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40));
|
||||
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WITHER_ROSE); // CraftBukkit
|
||||
- entityliving.addEffect(this.getBeeInteractionEffect());
|
||||
+ entityliving.addEffect(this.getBeeInteractionEffect(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WITHER_ROSE); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/block/SculkCatalystBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkCatalystBlock.java
|
||||
@@ -68,9 +68,16 @@
|
||||
@@ -63,9 +63,16 @@
|
||||
@Override
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
TileEntity tileentity = world.getBlockEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof SculkSensorBlockEntity) {
|
||||
@@ -207,6 +224,15 @@
|
||||
@@ -202,6 +219,15 @@
|
||||
}
|
||||
|
||||
public static void deactivate(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
|
@ -47,7 +47,7 @@
|
|||
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.COOLDOWN)).setValue(SculkSensorBlock.POWER, 0), 3);
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), 10);
|
||||
updateNeighbours(world, blockposition, iblockdata);
|
||||
@@ -218,6 +244,15 @@
|
||||
@@ -213,6 +239,15 @@
|
||||
}
|
||||
|
||||
public void activate(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
|
@ -63,7 +63,7 @@
|
|||
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.ACTIVE)).setValue(SculkSensorBlock.POWER, i), 3);
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), this.getActiveTicks());
|
||||
updateNeighbours(world, blockposition, iblockdata);
|
||||
@@ -298,9 +333,16 @@
|
||||
@@ -293,9 +328,16 @@
|
||||
@Override
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
worldserver.getBlockEntity(blockposition, TileEntityTypes.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> {
|
||||
sculkshriekerblockentity.tryShriek(worldserver, entityplayer);
|
||||
});
|
||||
@@ -145,10 +146,17 @@
|
||||
@@ -140,10 +141,17 @@
|
||||
@Override
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/block/SculkVeinBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkVeinBlock.java
|
||||
@@ -110,10 +110,11 @@
|
||||
@@ -101,10 +101,11 @@
|
||||
|
||||
@Override
|
||||
public int attemptUseCharge(SculkSpreader.a sculkspreader_a, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource, SculkSpreader sculkspreader, boolean flag) {
|
||||
|
@ -14,7 +14,7 @@
|
|||
IBlockData iblockdata = generatoraccess.getBlockState(blockposition);
|
||||
TagKey<Block> tagkey = sculkspreader.replaceableBlocks();
|
||||
Iterator iterator = EnumDirection.allShuffled(randomsource).iterator();
|
||||
@@ -128,7 +129,11 @@
|
||||
@@ -119,7 +120,11 @@
|
||||
if (iblockdata1.is(tagkey)) {
|
||||
IBlockData iblockdata2 = Blocks.SCULK.defaultBlockState();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
@@ -27,8 +27,18 @@
|
||||
@@ -26,8 +26,18 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final TileEntityTypes<?> type;
|
||||
@Nullable
|
||||
@@ -75,7 +85,16 @@
|
||||
@@ -74,7 +84,16 @@
|
||||
return this.level != null;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
public final void loadWithComponents(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
this.loadAdditional(nbttagcompound, holderlookup_a);
|
||||
@@ -115,6 +134,11 @@
|
||||
@@ -114,6 +133,11 @@
|
||||
}).ifPresent((nbtbase) -> {
|
||||
nbttagcompound.merge((NBTTagCompound) nbtbase);
|
||||
});
|
||||
|
@ -49,7 +49,7 @@
|
|||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -277,12 +301,18 @@
|
||||
@@ -263,13 +287,19 @@
|
||||
}
|
||||
|
||||
public final void applyComponents(DataComponentMap datacomponentmap, DataComponentPatch datacomponentpatch) {
|
||||
|
@ -62,6 +62,7 @@
|
|||
final Set<DataComponentType<?>> set = new HashSet();
|
||||
|
||||
set.add(DataComponents.BLOCK_ENTITY_DATA);
|
||||
set.add(DataComponents.BLOCK_STATE);
|
||||
final PatchedDataComponentMap patcheddatacomponentmap = PatchedDataComponentMap.fromPatch(datacomponentmap, datacomponentpatch);
|
||||
|
||||
- this.applyImplicitComponents(new TileEntity.b(this) {
|
||||
|
@ -69,7 +70,7 @@
|
|||
@Nullable
|
||||
@Override
|
||||
public <T> T get(DataComponentType<T> datacomponenttype) {
|
||||
@@ -300,6 +330,10 @@
|
||||
@@ -287,6 +317,10 @@
|
||||
DataComponentPatch datacomponentpatch1 = datacomponentpatch.forget(set::contains);
|
||||
|
||||
this.components = datacomponentpatch1.split().added();
|
||||
|
@ -80,7 +81,7 @@
|
|||
}
|
||||
|
||||
protected void collectImplicitComponents(DataComponentMap.a datacomponentmap_a) {}
|
||||
@@ -334,6 +368,15 @@
|
||||
@@ -321,6 +355,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
public class TileEntityBanner extends TileEntity implements INamableTileEntity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -80,7 +84,7 @@
|
||||
@@ -74,7 +78,7 @@
|
||||
BannerPatternLayers.CODEC.parse(holderlookup_a.createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("patterns")).resultOrPartial((s) -> {
|
||||
TileEntityBanner.LOGGER.error("Failed to parse banner patterns: '{}'", s);
|
||||
}).ifPresent((bannerpatternlayers) -> {
|
||||
|
@ -20,7 +20,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
@@ -114,7 +118,7 @@
|
||||
@@ -108,7 +112,7 @@
|
||||
@Override
|
||||
protected void applyImplicitComponents(TileEntity.b tileentity_b) {
|
||||
super.applyImplicitComponents(tileentity_b);
|
||||
|
@ -29,7 +29,7 @@
|
|||
this.name = (IChatBaseComponent) tileentity_b.get(DataComponents.CUSTOM_NAME);
|
||||
}
|
||||
|
||||
@@ -130,4 +134,13 @@
|
||||
@@ -124,4 +128,13 @@
|
||||
nbttagcompound.remove("patterns");
|
||||
nbttagcompound.remove("CustomName");
|
||||
}
|
||||
|
|
|
@ -55,37 +55,35 @@
|
|||
});
|
||||
if (!list.isEmpty()) {
|
||||
super.setChanged();
|
||||
@@ -151,7 +162,19 @@
|
||||
@@ -151,7 +162,17 @@
|
||||
}
|
||||
|
||||
public void addOccupant(Entity entity) {
|
||||
public void addOccupant(EntityBee entitybee) {
|
||||
- if (this.stored.size() < 3) {
|
||||
+ if (this.stored.size() < this.maxBees) { // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+ if (this.level != null) {
|
||||
+ org.bukkit.event.entity.EntityEnterBlockEvent event = new org.bukkit.event.entity.EntityEnterBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, getBlockPos()));
|
||||
+ org.bukkit.event.entity.EntityEnterBlockEvent event = new org.bukkit.event.entity.EntityEnterBlockEvent(entitybee.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, getBlockPos()));
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ if (entity instanceof EntityBee) {
|
||||
+ ((EntityBee) entity).setStayOutOfHiveCountdown(400);
|
||||
+ }
|
||||
+ entitybee.setStayOutOfHiveCountdown(400);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.stopRiding();
|
||||
entity.ejectPassengers();
|
||||
this.storeBee(TileEntityBeehive.c.of(entity));
|
||||
@@ -170,7 +193,7 @@
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, this.getBlockState()));
|
||||
entitybee.stopRiding();
|
||||
entitybee.ejectPassengers();
|
||||
entitybee.dropLeash();
|
||||
@@ -167,7 +188,7 @@
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entitybee, this.getBlockState()));
|
||||
}
|
||||
|
||||
- entity.discard();
|
||||
+ entity.discard(EntityRemoveEvent.Cause.ENTER_BLOCK); // CraftBukkit - add Bukkit remove cause
|
||||
- entitybee.discard();
|
||||
+ entitybee.discard(EntityRemoveEvent.Cause.ENTER_BLOCK); // CraftBukkit - add Bukkit remove cause
|
||||
super.setChanged();
|
||||
}
|
||||
}
|
||||
@@ -180,7 +203,13 @@
|
||||
@@ -177,7 +198,13 @@
|
||||
}
|
||||
|
||||
private static boolean releaseOccupant(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.c tileentitybeehive_c, @Nullable List<Entity> list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1) {
|
||||
|
@ -100,7 +98,7 @@
|
|||
return false;
|
||||
} else {
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.getValue(BlockBeehive.FACING);
|
||||
@@ -193,6 +222,18 @@
|
||||
@@ -190,6 +217,18 @@
|
||||
Entity entity = tileentitybeehive_c.createEntity(world, blockposition);
|
||||
|
||||
if (entity != null) {
|
||||
|
@ -119,7 +117,7 @@
|
|||
if (entity instanceof EntityBee) {
|
||||
EntityBee entitybee = (EntityBee) entity;
|
||||
|
||||
@@ -223,6 +264,7 @@
|
||||
@@ -220,6 +259,7 @@
|
||||
list.add(entitybee);
|
||||
}
|
||||
|
||||
|
@ -127,7 +125,7 @@
|
|||
float f = entity.getBbWidth();
|
||||
double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F);
|
||||
double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX();
|
||||
@@ -230,11 +272,12 @@
|
||||
@@ -227,11 +267,12 @@
|
||||
double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
|
||||
|
||||
entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
|
||||
|
@ -141,7 +139,7 @@
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -259,6 +302,10 @@
|
||||
@@ -256,6 +297,10 @@
|
||||
if (releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_hivebee.toOccupant(), (List) null, tileentitybeehive_releasestatus, blockposition1)) {
|
||||
flag = true;
|
||||
iterator.remove();
|
||||
|
@ -152,7 +150,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -285,7 +332,7 @@
|
||||
@@ -282,7 +327,7 @@
|
||||
@Override
|
||||
protected void loadAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
super.loadAdditional(nbttagcompound, holderlookup_a);
|
||||
|
@ -161,7 +159,7 @@
|
|||
if (nbttagcompound.contains("bees")) {
|
||||
TileEntityBeehive.c.LIST_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("bees")).resultOrPartial((s) -> {
|
||||
TileEntityBeehive.LOGGER.error("Failed to parse bees: '{}'", s);
|
||||
@@ -294,7 +341,12 @@
|
||||
@@ -291,7 +336,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -175,7 +173,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -304,13 +356,14 @@
|
||||
@@ -301,13 +351,14 @@
|
||||
if (this.hasSavedFlowerPos()) {
|
||||
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.savedFlowerPos));
|
||||
}
|
||||
|
@ -191,7 +189,7 @@
|
|||
List<TileEntityBeehive.c> list = (List) tileentity_b.getOrDefault(DataComponents.BEES, List.of());
|
||||
|
||||
list.forEach(this::storeBee);
|
||||
@@ -351,7 +404,7 @@
|
||||
@@ -348,7 +399,7 @@
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
entity.save(nbttagcompound);
|
||||
|
@ -200,7 +198,7 @@
|
|||
|
||||
Objects.requireNonNull(nbttagcompound);
|
||||
list.forEach(nbttagcompound::remove);
|
||||
@@ -370,7 +423,7 @@
|
||||
@@ -367,7 +418,7 @@
|
||||
@Nullable
|
||||
public Entity createEntity(World world, BlockPosition blockposition) {
|
||||
NBTTagCompound nbttagcompound = this.entityData.copyTag();
|
||||
|
|
|
@ -50,15 +50,3 @@
|
|||
protected TileEntityChest(TileEntityTypes<?> tileentitytypes, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(tileentitytypes, blockposition, iblockdata);
|
||||
this.items = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
@@ -199,4 +235,11 @@
|
||||
|
||||
world.blockEvent(blockposition, block, 1, j);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public boolean onlyOpCanSetNbt() {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeCraftingHolder, AutoRecipeOutput {
|
||||
|
||||
protected static final int SLOT_INPUT = 0;
|
||||
@@ -112,9 +127,39 @@
|
||||
@@ -110,9 +125,39 @@
|
||||
}
|
||||
};
|
||||
this.recipesUsed = new Reference2IntOpenHashMap();
|
||||
|
@ -61,9 +61,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
private boolean isLit() {
|
||||
return this.litTime > 0;
|
||||
return this.litTimeRemaining > 0;
|
||||
}
|
||||
@@ -180,7 +225,7 @@
|
||||
@@ -175,7 +220,7 @@
|
||||
RecipeHolder recipeholder;
|
||||
|
||||
if (flag2) {
|
||||
|
@ -72,11 +72,11 @@
|
|||
} else {
|
||||
recipeholder = null;
|
||||
}
|
||||
@@ -188,9 +233,20 @@
|
||||
@@ -183,9 +228,20 @@
|
||||
int i = tileentityfurnace.getMaxStackSize();
|
||||
|
||||
if (!tileentityfurnace.isLit() && canBurn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
|
||||
- tileentityfurnace.litTime = tileentityfurnace.getBurnDuration(worldserver.fuelValues(), itemstack);
|
||||
- tileentityfurnace.litTimeRemaining = tileentityfurnace.getBurnDuration(worldserver.fuelValues(), itemstack);
|
||||
+ // CraftBukkit start
|
||||
+ CraftItemStack fuel = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
|
@ -87,20 +87,20 @@
|
|||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ tileentityfurnace.litTime = furnaceBurnEvent.getBurnTime();
|
||||
tileentityfurnace.litDuration = tileentityfurnace.litTime;
|
||||
+ tileentityfurnace.litTimeRemaining = furnaceBurnEvent.getBurnTime();
|
||||
tileentityfurnace.litTotalTime = tileentityfurnace.litTimeRemaining;
|
||||
- if (tileentityfurnace.isLit()) {
|
||||
+ if (tileentityfurnace.isLit() && furnaceBurnEvent.isBurning()) {
|
||||
+ // CraftBukkit end
|
||||
flag1 = true;
|
||||
if (flag3) {
|
||||
Item item = itemstack.getItem();
|
||||
@@ -204,11 +260,23 @@
|
||||
@@ -199,11 +255,23 @@
|
||||
}
|
||||
|
||||
if (tileentityfurnace.isLit() && canBurn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (recipeholder != null && tileentityfurnace.cookingProgress == 0) {
|
||||
+ if (recipeholder != null && tileentityfurnace.cookingTimer == 0) {
|
||||
+ CraftItemStack source = CraftItemStack.asCraftMirror(tileentityfurnace.items.get(0));
|
||||
+ CookingRecipe<?> recipe = (CookingRecipe<?>) recipeholder.toBukkitRecipe();
|
||||
+
|
||||
|
@ -111,16 +111,16 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
++tileentityfurnace.cookingProgress;
|
||||
if (tileentityfurnace.cookingProgress == tileentityfurnace.cookingTotalTime) {
|
||||
tileentityfurnace.cookingProgress = 0;
|
||||
++tileentityfurnace.cookingTimer;
|
||||
if (tileentityfurnace.cookingTimer == tileentityfurnace.cookingTotalTime) {
|
||||
tileentityfurnace.cookingTimer = 0;
|
||||
tileentityfurnace.cookingTotalTime = getTotalCookTime(worldserver, tileentityfurnace);
|
||||
- if (burn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
|
||||
+ if (burn(tileentityfurnace.level, tileentityfurnace.worldPosition, worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) { // CraftBukkit
|
||||
tileentityfurnace.setRecipeUsed(recipeholder);
|
||||
}
|
||||
|
||||
@@ -247,17 +315,44 @@
|
||||
@@ -242,17 +310,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@
|
|||
|
||||
if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).is(Items.BUCKET)) {
|
||||
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
|
||||
@@ -275,6 +370,7 @@
|
||||
@@ -270,6 +365,7 @@
|
||||
}
|
||||
|
||||
private static int getTotalCookTime(WorldServer worldserver, TileEntityFurnace tileentityfurnace) {
|
||||
|
@ -174,7 +174,7 @@
|
|||
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(tileentityfurnace.getItem(0));
|
||||
|
||||
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, worldserver).map((recipeholder) -> {
|
||||
@@ -365,8 +461,8 @@
|
||||
@@ -360,8 +456,8 @@
|
||||
@Override
|
||||
public void awardUsedRecipes(EntityHuman entityhuman, List<ItemStack> list) {}
|
||||
|
||||
|
@ -185,7 +185,7 @@
|
|||
|
||||
entityplayer.awardRecipes(list);
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -383,22 +479,28 @@
|
||||
@@ -378,22 +474,28 @@
|
||||
}
|
||||
|
||||
public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d) {
|
||||
|
@ -217,7 +217,7 @@
|
|||
int j = MathHelper.floor((float) i * f);
|
||||
float f1 = MathHelper.frac((float) i * f);
|
||||
|
||||
@@ -406,6 +508,17 @@
|
||||
@@ -401,6 +503,17 @@
|
||||
++j;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
|
||||
@@ -133,7 +177,7 @@
|
||||
@@ -137,7 +181,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
|
@ -66,7 +66,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -152,12 +196,17 @@
|
||||
@@ -156,12 +200,17 @@
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -241,7 +339,7 @@
|
||||
@@ -236,7 +334,7 @@
|
||||
|
||||
@Override
|
||||
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
public TileEntityShulkerBox(@Nullable EnumColor enumcolor, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.SHULKER_BOX, blockposition, iblockdata);
|
||||
this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
@@ -173,6 +209,7 @@
|
||||
@@ -184,6 +220,7 @@
|
||||
}
|
||||
|
||||
++this.openCount;
|
||||
|
@ -58,7 +58,7 @@
|
|||
this.level.blockEvent(this.worldPosition, this.getBlockState().getBlock(), 1, this.openCount);
|
||||
if (this.openCount == 1) {
|
||||
this.level.gameEvent((Entity) entityhuman, (Holder) GameEvent.CONTAINER_OPEN, this.worldPosition);
|
||||
@@ -186,6 +223,7 @@
|
||||
@@ -197,6 +234,7 @@
|
||||
public void stopOpen(EntityHuman entityhuman) {
|
||||
if (!this.remove && !entityhuman.isSpectator()) {
|
||||
--this.openCount;
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -278,12 +342,17 @@
|
||||
@@ -273,12 +337,17 @@
|
||||
|
||||
@Nullable
|
||||
public UUID getPlayerWhoMayEdit() {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/world/level/block/entity/TileEntityTypes.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityTypes.java
|
||||
@@ -66,7 +66,7 @@
|
||||
public static final TileEntityTypes<CrafterBlockEntity> CRAFTER = register("crafter", CrafterBlockEntity::new, Blocks.CRAFTER);
|
||||
public static final TileEntityTypes<TrialSpawnerBlockEntity> TRIAL_SPAWNER = register("trial_spawner", TrialSpawnerBlockEntity::new, Blocks.TRIAL_SPAWNER);
|
||||
public static final TileEntityTypes<VaultBlockEntity> VAULT = register("vault", VaultBlockEntity::new, Blocks.VAULT);
|
||||
- private static final Set<TileEntityTypes<?>> OP_ONLY_CUSTOM_DATA = Set.of(TileEntityTypes.COMMAND_BLOCK, TileEntityTypes.LECTERN, TileEntityTypes.SIGN, TileEntityTypes.HANGING_SIGN, TileEntityTypes.MOB_SPAWNER, TileEntityTypes.TRIAL_SPAWNER);
|
||||
+ private static final Set<TileEntityTypes<?>> OP_ONLY_CUSTOM_DATA = Set.of(TileEntityTypes.COMMAND_BLOCK, TileEntityTypes.LECTERN, TileEntityTypes.SIGN, TileEntityTypes.HANGING_SIGN, TileEntityTypes.MOB_SPAWNER, TileEntityTypes.TRIAL_SPAWNER, TileEntityTypes.CHEST); // CraftBukkit
|
||||
private final TileEntityTypes.a<? extends T> factory;
|
||||
private final Set<Block> validBlocks;
|
||||
private final Holder.c<TileEntityTypes<?>> builtInRegistryHolder;
|
||||
@@ -110,7 +110,7 @@
|
||||
public T getBlockEntity(IBlockAccess iblockaccess, BlockPosition blockposition) {
|
||||
TileEntity tileentity = iblockaccess.getBlockEntity(blockposition);
|
||||
|
||||
- return tileentity != null && tileentity.getType() == this ? tileentity : null;
|
||||
+ return tileentity != null && tileentity.getType() == this ? (T) tileentity : null; // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public boolean onlyOpCanSetNbt() {
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
@@ -211,7 +211,7 @@
|
||||
@@ -210,7 +210,7 @@
|
||||
}
|
||||
|
||||
public void resetAfterBecomingOminous(TrialSpawner trialspawner, WorldServer worldserver) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
Objects.requireNonNull(worldserver);
|
||||
stream.map(worldserver::getEntity).forEach((entity) -> {
|
||||
@@ -223,7 +223,7 @@
|
||||
@@ -222,7 +222,7 @@
|
||||
entityinsentient.dropPreservedEquipment(worldserver);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
}
|
||||
|
||||
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag);
|
||||
@@ -1121,7 +1134,13 @@
|
||||
@@ -1125,7 +1138,13 @@
|
||||
}
|
||||
|
||||
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata, boolean flag) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/chunk/Chunk.java
|
||||
+++ b/net/minecraft/world/level/chunk/Chunk.java
|
||||
@@ -78,7 +78,7 @@
|
||||
@@ -79,7 +79,7 @@
|
||||
};
|
||||
private final Map<BlockPosition, Chunk.d> tickersInLevel;
|
||||
public boolean loaded;
|
||||
|
@ -9,7 +9,7 @@
|
|||
@Nullable
|
||||
private Supplier<FullChunkStatus> fullStatus;
|
||||
@Nullable
|
||||
@@ -97,7 +97,7 @@
|
||||
@@ -98,7 +98,7 @@
|
||||
this.tickersInLevel = Maps.newHashMap();
|
||||
this.unsavedListener = (chunkcoordintpair1) -> {
|
||||
};
|
||||
|
@ -18,7 +18,7 @@
|
|||
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap();
|
||||
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
|
||||
int j = aheightmap_type.length;
|
||||
@@ -115,6 +115,11 @@
|
||||
@@ -116,6 +116,11 @@
|
||||
this.fluidTicks = levelchunkticks1;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@
|
|||
+
|
||||
public Chunk(WorldServer worldserver, ProtoChunk protochunk, @Nullable Chunk.c chunk_c) {
|
||||
this(worldserver, protochunk.getPos(), protochunk.getUpgradeData(), protochunk.unpackBlockTicks(), protochunk.unpackFluidTicks(), protochunk.getInhabitedTime(), protochunk.getSections(), chunk_c, protochunk.getBlendingData());
|
||||
Iterator iterator = protochunk.getBlockEntities().values().iterator();
|
||||
@@ -146,6 +151,10 @@
|
||||
if (!Collections.disjoint(protochunk.pendingBlockEntities.keySet(), protochunk.blockEntities.keySet())) {
|
||||
@@ -151,6 +156,10 @@
|
||||
this.skyLightSources = protochunk.skyLightSources;
|
||||
this.setLightCorrect(protochunk.isLightCorrect());
|
||||
this.markUnsaved();
|
||||
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
|
||||
public void setUnsavedListener(Chunk.e chunk_e) {
|
||||
@@ -267,9 +276,16 @@
|
||||
@@ -272,9 +281,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
|||
int i = blockposition.getY();
|
||||
ChunkSection chunksection = this.getSection(this.getSectionIndex(i));
|
||||
boolean flag1 = chunksection.hasOnlyAir();
|
||||
@@ -319,7 +335,8 @@
|
||||
@@ -324,7 +340,8 @@
|
||||
if (!chunksection.getBlockState(j, k, l).is(block)) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -68,7 +68,7 @@
|
|||
iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
|
||||
}
|
||||
|
||||
@@ -370,7 +387,12 @@
|
||||
@@ -375,7 +392,12 @@
|
||||
|
||||
@Nullable
|
||||
public TileEntity getBlockEntity(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
|
@ -82,7 +82,7 @@
|
|||
|
||||
if (tileentity == null) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.pendingBlockEntities.remove(blockposition);
|
||||
@@ -442,6 +464,7 @@
|
||||
@@ -447,6 +469,7 @@
|
||||
|
||||
if (!iblockdata.hasBlockEntity()) {
|
||||
Chunk.LOGGER.warn("Trying to set block entity {} at position {}, but state {} does not allow it", new Object[]{tileentity, blockposition, iblockdata});
|
||||
|
@ -90,7 +90,7 @@
|
|||
} else {
|
||||
IBlockData iblockdata1 = tileentity.getBlockState();
|
||||
|
||||
@@ -495,6 +518,12 @@
|
||||
@@ -500,6 +523,12 @@
|
||||
if (this.isInLevel()) {
|
||||
TileEntity tileentity = (TileEntity) this.blockEntities.remove(blockposition);
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
if (tileentity != null) {
|
||||
World world = this.level;
|
||||
|
||||
@@ -548,6 +577,57 @@
|
||||
@@ -553,6 +582,57 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@
|
|||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
@@ -745,7 +825,7 @@
|
||||
@@ -750,7 +830,7 @@
|
||||
|
||||
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
|
||||
IBlockData iblockdata = t0.getBlockState();
|
||||
|
@ -170,7 +170,7 @@
|
|||
|
||||
if (blockentityticker == null) {
|
||||
this.removeBlockEntityTicker(t0.getBlockPos());
|
||||
@@ -836,7 +916,7 @@
|
||||
@@ -841,7 +921,7 @@
|
||||
private boolean loggedInvalidBlockState;
|
||||
|
||||
a(final TileEntity tileentity, final BlockEntityTicker blockentityticker) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
|
||||
@@ -311,7 +311,7 @@
|
||||
@@ -312,7 +312,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
|
||||
if (!SharedConstants.debugVoidTerrain(chunkcoordintpair)) {
|
||||
@@ -333,7 +333,7 @@
|
||||
@@ -334,7 +334,7 @@
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
ChunkSection chunksection = achunksection[k];
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
Objects.requireNonNull(set);
|
||||
palettedcontainerro.getAll(set::add);
|
||||
@@ -444,6 +444,33 @@
|
||||
@@ -445,6 +445,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@
|
|||
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
int i = chunkcoordintpair.getMinBlockX();
|
||||
@@ -581,6 +608,14 @@
|
||||
StructureStart structurestart = structure.generate(iregistrycustom, this, this.biomeSource, randomstate, structuretemplatemanager, i, chunkcoordintpair, j, ichunkaccess, predicate);
|
||||
@@ -582,6 +609,14 @@
|
||||
StructureStart structurestart = structure.generate(structureset_a.structure(), resourcekey, iregistrycustom, this, this.biomeSource, randomstate, structuretemplatemanager, i, chunkcoordintpair, j, ichunkaccess, predicate);
|
||||
|
||||
if (structurestart.isValid()) {
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
|
||||
public abstract ChunkStatus getPersistedStatus();
|
||||
@@ -458,6 +468,27 @@
|
||||
@@ -463,6 +473,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
|
||||
+ if (worldserver.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
||||
worldgencontext.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, worldgencontext.structureManager());
|
||||
worldgencontext.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, worldgencontext.structureManager(), worldserver.dimension());
|
||||
}
|
||||
|
||||
@@ -170,7 +170,17 @@
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.21.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<name>CraftBukkit</name>
|
||||
<url>https://www.spigotmc.org/</url>
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<api.version>unknown</api.version>
|
||||
<bt.name>git</bt.name>
|
||||
<minecraft_version>1_21_R2</minecraft_version>
|
||||
<minecraft_version>1_21_R3</minecraft_version>
|
||||
<maven.compiler.release>21</maven.compiler.release>
|
||||
</properties>
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-iostreams</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<version>2.24.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -79,7 +79,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.oshi</groupId>
|
||||
<artifactId>oshi-core</artifactId>
|
||||
<version>6.4.10</version>
|
||||
<version>6.6.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -91,13 +91,13 @@
|
|||
<dependency>
|
||||
<groupId>com.microsoft.azure</groupId>
|
||||
<artifactId>msal4j</artifactId>
|
||||
<version>1.15.0</version>
|
||||
<version>1.17.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>6.0.55</version>
|
||||
<version>6.0.57</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -121,7 +121,7 @@
|
|||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>logging</artifactId>
|
||||
<version>1.4.9</version>
|
||||
<version>1.5.10</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -139,111 +139,111 @@
|
|||
<dependency>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
<artifactId>nimbus-jose-jwt</artifactId>
|
||||
<version>9.37.3</version>
|
||||
<version>9.40</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nimbusds</groupId>
|
||||
<artifactId>oauth2-oidc-sdk</artifactId>
|
||||
<version>11.9.1</version>
|
||||
<version>11.18</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.15.1</version>
|
||||
<version>2.17.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-buffer</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-codec</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-common</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-handler</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-resolver</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport-classes-epoll</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport-native-epoll</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<classifier>linux-x86_64</classifier>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport-native-epoll</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<classifier>linux-aarch_64</classifier>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-transport-native-unix-common</artifactId>
|
||||
<version>4.1.97.Final</version>
|
||||
<version>4.1.115.Final</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>it.unimi.dsi</groupId>
|
||||
<artifactId>fastutil</artifactId>
|
||||
<version>8.5.12</version>
|
||||
<version>8.5.15</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna</artifactId>
|
||||
<version>5.14.0</version>
|
||||
<version>5.15.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jna</groupId>
|
||||
<artifactId>jna-platform</artifactId>
|
||||
<version>5.14.0</version>
|
||||
<version>5.15.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minidev</groupId>
|
||||
<artifactId>accessors-smart</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.5.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.minidev</groupId>
|
||||
<artifactId>json-smart</artifactId>
|
||||
<version>2.5.0</version>
|
||||
<version>2.5.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -255,25 +255,25 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<version>3.17.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<version>2.24.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<version>2.24.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j2-impl</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<version>2.24.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -285,7 +285,7 @@
|
|||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>2.0.9</version>
|
||||
<version>2.0.16</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!-- End Mojang depends -->
|
||||
|
@ -312,7 +312,7 @@
|
|||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.46.1.3</version>
|
||||
<version>3.47.0.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.core.particles.ParticleParamRedstone;
|
|||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.core.particles.SculkChargeParticleOptions;
|
||||
import net.minecraft.core.particles.ShriekParticleOption;
|
||||
import net.minecraft.core.particles.TargetColorParticleOption;
|
||||
import net.minecraft.core.particles.TrailParticleOption;
|
||||
import net.minecraft.core.particles.VibrationParticleOption;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
@ -190,10 +190,10 @@ public abstract class CraftParticle<D> implements Keyed {
|
|||
}
|
||||
};
|
||||
|
||||
BiFunction<NamespacedKey, net.minecraft.core.particles.Particle<?>, CraftParticle<?>> targetColorFunction = (name, particle) -> new CraftParticle<>(name, particle, Particle.TargetColor.class) {
|
||||
BiFunction<NamespacedKey, net.minecraft.core.particles.Particle<?>, CraftParticle<?>> trailFunction = (name, particle) -> new CraftParticle<>(name, particle, Particle.Trail.class) {
|
||||
@Override
|
||||
public ParticleParam createParticleParam(Particle.TargetColor data) {
|
||||
return new TargetColorParticleOption(CraftLocation.toVec3D(data.getTarget()), data.getColor().asRGB());
|
||||
public ParticleParam createParticleParam(Particle.Trail data) {
|
||||
return new TrailParticleOption(CraftLocation.toVec3D(data.getTarget()), data.getColor().asRGB(), data.getDuration());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -209,7 +209,7 @@ public abstract class CraftParticle<D> implements Keyed {
|
|||
add("entity_effect", colorFunction);
|
||||
add("dust_pillar", blockDataFunction);
|
||||
add("block_crumble", blockDataFunction);
|
||||
add("trail", targetColorFunction);
|
||||
add("trail", trailFunction);
|
||||
}
|
||||
|
||||
private static void add(String name, BiFunction<NamespacedKey, net.minecraft.core.particles.Particle<?>, CraftParticle<?>> function) {
|
||||
|
|
|
@ -1905,14 +1905,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
|||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
|
||||
getHandle().sendParticles(
|
||||
getHandle().sendParticlesSource(
|
||||
null, // Sender
|
||||
CraftParticle.createParticleParam(particle, data), // Particle
|
||||
false, force,
|
||||
x, y, z, // Position
|
||||
count, // Count
|
||||
offsetX, offsetY, offsetZ, // Random offset
|
||||
extra, // Speed?
|
||||
force
|
||||
extra // Speed?
|
||||
);
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue