13
0
geforkt von Mirrors/Paper

Update to Minecraft 1.18.2

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2022-03-01 02:00:00 +11:00
Ursprung bd40300a4f
Commit 9ee989ea81
184 geänderte Dateien mit 1785 neuen und 1785 gelöschten Zeilen

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/commands/CommandDispatcher.java
+++ b/net/minecraft/commands/CommandDispatcher.java
@@ -106,6 +106,14 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -107,6 +107,14 @@
import net.minecraft.util.profiling.jfr.JvmProfiler;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.google.common.base.Joiner;
@ -14,8 +14,8 @@
+
public class CommandDispatcher {
private static final Logger LOGGER = LogManager.getLogger();
@@ -117,6 +125,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -118,6 +126,7 @@
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher();
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype) {
@ -23,12 +23,12 @@
CommandAdvancement.register(this.dispatcher);
CommandAttribute.register(this.dispatcher);
CommandExecute.register(this.dispatcher);
@@ -202,17 +211,63 @@
@@ -204,17 +213,63 @@
}
this.dispatcher.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection);
+ // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection); // CraftBukkit
- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", new Object[]{this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection});
+ // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", new Object[]{this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection}); // CraftBukkit
});
+ // CraftBukkit start
+ }
@ -89,7 +89,7 @@
stringreader.skip();
}
@@ -236,7 +291,7 @@
@@ -238,7 +293,7 @@
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
@ -98,7 +98,7 @@
});
if (j > 10) {
@@ -286,11 +341,36 @@
@@ -288,11 +343,36 @@
}
public void sendCommands(EntityPlayer entityplayer) {
@ -136,7 +136,7 @@
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
}
@@ -301,7 +381,7 @@
@@ -303,7 +383,7 @@
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
if (commandnode2.canUse(commandlistenerwrapper)) {
@ -145,7 +145,7 @@
argumentbuilder.requires((icompletionprovider) -> {
return true;
@@ -324,7 +404,7 @@
@@ -326,7 +406,7 @@
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
}

Datei anzeigen

@ -50,7 +50,7 @@
entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.NIL_UUID);
}
}
@@ -279,4 +296,10 @@
@@ -287,4 +304,10 @@
public IRegistryCustom registryAccess() {
return this.server.registryAccess();
}

Datei anzeigen

@ -9,7 +9,7 @@
private final Map<String, String> vagueProperties = Maps.newHashMap();
private MinecraftKey id = new MinecraftKey("");
private BlockStateList<Block, IBlockData> definition;
@@ -237,7 +237,7 @@
@@ -230,7 +230,7 @@
Iterator iterator = iblockstate.getPossibleValues().iterator();
while (iterator.hasNext()) {
@ -18,7 +18,7 @@
if (t0 instanceof Integer) {
suggestionsbuilder.suggest((Integer) t0);
@@ -506,7 +506,7 @@
@@ -493,7 +493,7 @@
Optional<T> optional = iblockstate.getValue(s);
if (optional.isPresent()) {
@ -27,7 +27,7 @@
this.properties.put(iblockstate, (Comparable) optional.get());
} else {
this.reader.setCursor(i);
@@ -540,7 +540,7 @@
@@ -527,7 +527,7 @@
private static <T extends Comparable<T>> void appendProperty(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
stringbuilder.append(iblockstate.getName());
stringbuilder.append('=');
@ -35,4 +35,4 @@
+ stringbuilder.append(iblockstate.getName((T) comparable)); // CraftBukkit - decompile error
}
public CompletableFuture<Suggestions> fillSuggestions(SuggestionsBuilder suggestionsbuilder, Tags<Block> tags) {
public CompletableFuture<Suggestions> fillSuggestions(SuggestionsBuilder suggestionsbuilder, IRegistry<Block> iregistry) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
@@ -10,6 +10,11 @@
@@ -9,6 +9,11 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.BlockDispenser;
@ -12,7 +12,7 @@
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
private final DispenseBehaviorItem defaultDispenseItemBehavior = new DispenseBehaviorItem();
@@ -39,12 +44,40 @@
@@ -38,12 +43,40 @@
d3 = 0.0D;
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/DispenseBehaviorShears.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorShears.java
@@ -24,6 +24,12 @@
@@ -23,6 +23,12 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.AxisAlignedBB;
@ -13,7 +13,7 @@
public class DispenseBehaviorShears extends DispenseBehaviorMaybe {
public DispenseBehaviorShears() {}
@@ -31,11 +37,34 @@
@@ -30,11 +36,34 @@
@Override
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getLevel();
@ -49,7 +49,7 @@
if (this.isSuccess() && itemstack.hurt(1, worldserver.getRandom(), (EntityPlayer) null)) {
itemstack.setCount(0);
}
@@ -62,7 +91,7 @@
@@ -63,7 +92,7 @@
return false;
}
@ -58,7 +58,7 @@
List<EntityLiving> list = worldserver.getEntitiesOfClass(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.NO_SPECTATORS);
Iterator iterator = list.iterator();
@@ -73,6 +102,11 @@
@@ -74,6 +103,11 @@
IShearable ishearable = (IShearable) entityliving;
if (ishearable.readyForShearing()) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/core/dispenser/DispenseBehaviorShulkerBox.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorShulkerBox.java
@@ -11,6 +11,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.block.BlockDispenser;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -11,7 +11,7 @@
+
public class DispenseBehaviorShulkerBox extends DispenseBehaviorMaybe {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -27,6 +32,30 @@
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
EnumDirection enumdirection1 = isourceblock.getLevel().isEmptyBlock(blockposition.below()) ? enumdirection : EnumDirection.UP;

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
@@ -76,6 +76,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -75,6 +75,21 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.item.ItemBucket;
@ -21,8 +21,8 @@
+
public interface IDispenseBehavior {
Logger LOGGER = LogManager.getLogger();
@@ -200,14 +215,42 @@
Logger LOGGER = LogUtils.getLogger();
@@ -199,14 +214,42 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
@ -67,7 +67,7 @@
isourceblock.getLevel().gameEvent(GameEvent.ENTITY_PLACE, isourceblock.getPos());
return itemstack;
}
@@ -226,12 +269,40 @@
@@ -225,12 +268,40 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
WorldServer worldserver = isourceblock.getLevel();
@ -109,7 +109,7 @@
return itemstack;
}
});
@@ -250,8 +321,35 @@
@@ -249,8 +320,35 @@
});
if (!list.isEmpty()) {
@ -146,7 +146,7 @@
this.setSuccess(true);
return itemstack;
} else {
@@ -278,7 +376,35 @@
@@ -277,7 +375,35 @@
entityhorseabstract = (EntityHorseAbstract) iterator1.next();
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
@ -183,7 +183,7 @@
this.setSuccess(true);
return itemstack;
}
@@ -321,9 +447,35 @@
@@ -320,9 +446,35 @@
}
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
@ -221,7 +221,7 @@
this.setSuccess(true);
return itemstack;
}
@@ -332,12 +484,41 @@
@@ -331,12 +483,41 @@
@Override
public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
@ -264,7 +264,7 @@
return itemstack;
}
@@ -359,12 +540,40 @@
@@ -358,12 +539,40 @@
double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepX();
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepY();
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getStepZ();
@ -310,7 +310,7 @@
return itemstack;
}
@@ -388,9 +597,52 @@
@@ -387,9 +596,52 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
WorldServer worldserver = isourceblock.getLevel();
@ -364,7 +364,7 @@
} else {
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
}
@@ -416,7 +668,7 @@
@@ -415,7 +667,7 @@
Block block = iblockdata.getBlock();
if (block instanceof IFluidSource) {
@ -373,7 +373,7 @@
if (itemstack1.isEmpty()) {
return super.execute(isourceblock, itemstack);
@@ -424,6 +676,32 @@
@@ -423,6 +675,32 @@
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
Item item = itemstack1.getItem();
@ -406,7 +406,7 @@
itemstack.shrink(1);
if (itemstack.isEmpty()) {
return new ItemStack(item);
@@ -445,14 +723,42 @@
@@ -444,14 +722,42 @@
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getLevel();
@ -451,7 +451,7 @@
} else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
if (iblockdata.getBlock() instanceof BlockTNT) {
BlockTNT.explode(worldserver, blockposition);
@@ -478,12 +784,62 @@
@@ -477,12 +783,62 @@
this.setSuccess(true);
WorldServer worldserver = isourceblock.getLevel();
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
@ -514,7 +514,7 @@
return itemstack;
}
@@ -493,12 +849,41 @@
@@ -492,12 +848,41 @@
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getLevel();
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
@ -558,7 +558,7 @@
return itemstack;
}
});
@@ -522,6 +907,30 @@
@@ -521,6 +906,30 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
@ -589,7 +589,7 @@
if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, enumdirection.getAxis() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.getOpposite().get2DDataValue() * 4), 3);
worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
@@ -547,6 +956,30 @@
@@ -546,6 +955,30 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
@ -620,7 +620,7 @@
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
if (!worldserver.isClientSide) {
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
@@ -596,6 +1029,30 @@
@@ -595,6 +1028,30 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
IBlockData iblockdata = worldserver.getBlockState(blockposition);
@ -649,5 +649,5 @@
+ // CraftBukkit end
+
if (iblockdata.is(TagsBlock.BEEHIVES, (blockbase_blockdata) -> {
return blockbase_blockdata.hasProperty(BlockBeehive.HONEY_LEVEL);
return blockbase_blockdata.hasProperty(BlockBeehive.HONEY_LEVEL) && blockbase_blockdata.getBlock() instanceof BlockBeehive;
}) && (Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL) >= 5) {

Datei anzeigen

@ -4,4 +4,4 @@
+// mc-dev import
package net.minecraft.nbt;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/network/NetworkManager.java
+++ b/net/minecraft/network/NetworkManager.java
@@ -156,7 +156,7 @@
@@ -168,7 +168,7 @@
}
private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener packetlistener) {
@ -9,7 +9,7 @@
}
public void setListener(PacketListener packetlistener) {
@@ -268,7 +268,7 @@
@@ -280,7 +280,7 @@
public void disconnect(IChatBaseComponent ichatbasecomponent) {
if (this.channel.isOpen()) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
+++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
@@ -7,6 +7,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.util.thread.IAsyncTaskHandler;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
@ -11,16 +11,16 @@
+
public class PlayerConnectionUtils {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -20,6 +25,7 @@
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
if (!iasynctaskhandler.isSameThread()) {
iasynctaskhandler.execute(() -> {
iasynctaskhandler.executeIfPossible(() -> {
+ if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590
if (t0.getConnection().isConnected()) {
packet.handle(t0);
} else {
@@ -28,6 +34,10 @@
try {
packet.handle(t0);
@@ -36,6 +42,10 @@
});
throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/DispenserRegistry.java
+++ b/net/minecraft/server/DispenserRegistry.java
@@ -34,6 +34,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -33,6 +33,12 @@
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.util.datafix.fixes.DataConverterFlattenData;
@ -13,7 +13,7 @@
public class DispenserRegistry {
public static final PrintStream STDOUT = System.out;
@@ -44,6 +50,23 @@
@@ -43,6 +49,23 @@
public static void bootStrap() {
if (!DispenserRegistry.isBootstrapped) {
@ -37,8 +37,8 @@
DispenserRegistry.isBootstrapped = true;
if (IRegistry.REGISTRY.keySet().isEmpty()) {
throw new IllegalStateException("Unable to load registries");
@@ -61,6 +84,69 @@
TagStatic.bootStrap();
@@ -60,6 +83,69 @@
IRegistry.freezeBuiltins();
wrapStreams();
}
+ // CraftBukkit start - easier than fixing the decompile

Datei anzeigen

@ -1,19 +1,19 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -56,6 +56,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -57,6 +57,12 @@
import net.minecraft.world.level.storage.WorldInfo;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.concurrent.atomic.AtomicReference;
+import net.minecraft.SharedConstants;
+import net.minecraft.world.level.dimension.DimensionManager;
+import net.minecraft.world.level.dimension.WorldDimension;
+// CraftBukkit end
+
public class Main {
private static final Logger LOGGER;
@@ -63,8 +69,9 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -64,8 +70,9 @@
public Main() {}
@DontObfuscate
@ -24,7 +24,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");
@@ -89,9 +96,12 @@
@@ -90,9 +97,12 @@
optionparser.printHelpOn(System.err);
return;
}
@ -39,8 +39,8 @@
}
@@ -100,13 +110,13 @@
DispenserRegistry.validate();
SystemUtils.startTimerHackThread();
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.builtin();
Path path = Paths.get("server.properties");
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path);
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
@ -73,10 +73,10 @@
WorldInfo worldinfo = convertable_conversionsession.getSummary();
if (worldinfo != null) {
@@ -139,13 +150,30 @@
@@ -138,13 +149,32 @@
}
}
DataPackConfiguration datapackconfiguration = convertable_conversionsession.getDataPacks();
- boolean flag = optionset.has(optionspec6);
+ boolean flag = optionset.has("safeMode");
@ -101,26 +101,49 @@
+ } catch (java.io.IOException ex) {
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
+ }
+ AtomicReference<DataPackConfiguration> config = new AtomicReference<>();
+ AtomicReference<DynamicOps<NBTBase>> ops = new AtomicReference<>();
+ // CraftBukkit end
DataPackConfiguration datapackconfiguration1 = MinecraftServer.configurePackRepository(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.DEFAULT : datapackconfiguration, flag);
CompletableFuture completablefuture = DataPackResources.loadResources(resourcepackrepository.openAllSelected(), iregistrycustom_dimension, CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.backgroundExecutor(), Runnable::run);
@@ -160,6 +188,7 @@
WorldStem worldstem;
@@ -158,6 +188,12 @@
}, (iresourcemanager, datapackconfiguration) -> {
IRegistryCustom.e iregistrycustom_e = IRegistryCustom.builtinCopy();
DynamicOps<NBTBase> dynamicops = RegistryOps.createAndLoad(DynamicOpsNBT.INSTANCE, iregistrycustom_e, iresourcemanager);
+ // CraftBukkit start
+ config.set(datapackconfiguration);
+ ops.set(dynamicops);
+ return Pair.of(null, iregistrycustom_e.freeze());
+ // CraftBukkit end
+ /*
SaveData savedata = convertable_conversionsession.getDataTag(dynamicops, datapackconfiguration, iregistrycustom_e.allElementsLifecycle());
if (savedata != null) {
@@ -180,6 +216,7 @@
return Pair.of(worlddataserver, iregistrycustom_e.freeze());
}
+ */
}, SystemUtils.backgroundExecutor(), Runnable::run).get();
} catch (Exception exception) {
Main.LOGGER.warn("Failed to load datapacks, can't proceed with server load. You can either fix your datapacks or reset to vanilla with --safeMode", exception);
@@ -188,6 +225,7 @@
}
datapackresources.updateGlobals();
worldstem.updateGlobals();
+ /*
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.createAndLoad(DynamicOpsNBT.INSTANCE, datapackresources.getResourceManager(), iregistrycustom_dimension);
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registryAccess();
dedicatedserversettings.getProperties().getWorldGenSettings(iregistrycustom_dimension);
@@ -189,21 +218,32 @@
@@ -200,21 +238,32 @@
}
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, (SaveData) object);
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
+ */
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.spin((thread) -> {
- DedicatedServer dedicatedserver1 = new DedicatedServer(thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, object, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
- DedicatedServer dedicatedserver1 = new DedicatedServer(thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, config.get(), ops.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new);
+ /*
dedicatedserver1.setSingleplayerName((String) optionset.valueOf(optionspec8));
@ -148,15 +171,15 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.halt(true);
@@ -212,6 +252,7 @@
@@ -223,6 +272,7 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);
+ */ // CraftBukkit end
} catch (Exception exception1) {
Main.LOGGER.fatal("Failed to start the minecraft server", exception1);
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
}
@@ -219,7 +260,7 @@
@@ -230,7 +280,7 @@
}
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, GeneratorSettings generatorsettings) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -160,6 +160,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -163,6 +163,26 @@
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.serialization.DynamicOps;
@ -11,7 +11,6 @@
+import joptsimple.OptionSet;
+import net.minecraft.nbt.DynamicOpsNBT;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.resources.RegistryReadOps;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.dedicated.DedicatedServerProperties;
+import net.minecraft.util.datafix.DataConverterRegistry;
@ -27,14 +26,14 @@
+
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable {
public static final Logger LOGGER = LogManager.getLogger();
@@ -252,6 +273,21 @@
public static final Logger LOGGER = LogUtils.getLogger();
@@ -255,6 +275,21 @@
protected SaveData worldData;
private volatile boolean isSaving;
+ // CraftBukkit start
+ public final DataPackConfiguration datapackconfiguration;
+ public final RegistryReadOps<NBTBase> registryreadops;
+ public final DynamicOps<NBTBase> registryreadops;
+ public org.bukkit.craftbukkit.CraftServer server;
+ public OptionSet options;
+ public org.bukkit.command.ConsoleCommandSender console;
@ -50,7 +49,7 @@
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> {
@@ -265,14 +301,14 @@
@@ -268,14 +303,14 @@
thread.setPriority(8);
}
@ -62,12 +61,12 @@
return s0;
}
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- public MinecraftServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, DynamicOps<NBTBase> registryreadops, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
super("Server");
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
this.profiler = this.metricsRecorder.getProfiler();
@@ -284,7 +320,7 @@
@@ -287,7 +322,7 @@
this.status = new ServerPing();
this.random = new Random();
this.port = -1;
@ -76,15 +75,15 @@
this.running = true;
this.tickTimes = new long[100];
this.resourcePack = "";
@@ -314,13 +350,41 @@
this.structureManager = new DefinedStructureManager(datapackresources.getResourceManager(), convertable_conversionsession, datafixer);
@@ -317,13 +352,41 @@
this.structureManager = new DefinedStructureManager(worldstem.resourceManager(), convertable_conversionsession, datafixer);
this.serverThread = thread;
this.executor = SystemUtils.backgroundExecutor();
+ // CraftBukkit start
+ this.options = options;
+ this.datapackconfiguration = datapackconfiguration;
+ this.registryreadops = RegistryReadOps.createAndLoad(DynamicOpsNBT.INSTANCE, datapackresources.getResourceManager(), iregistrycustom_dimension);
+ this.vanillaCommandDispatcher = datapackresources.commands; // CraftBukkit
+ this.registryreadops = registryreadops;
+ this.vanillaCommandDispatcher = worldstem.dataPackResources().commands; // CraftBukkit
+ // Try to see if we're actually running in a terminal, disable jline if not
+ if (System.console() == null && System.getProperty("jline.terminal") == null) {
+ System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
@ -119,7 +118,7 @@
ScoreboardServer scoreboardserver1 = this.getScoreboard();
Objects.requireNonNull(scoreboardserver1);
@@ -329,7 +393,7 @@
@@ -332,7 +395,7 @@
protected abstract boolean initServer() throws IOException;
@ -128,7 +127,7 @@
if (!JvmProfiler.INSTANCE.isRunning()) {
;
}
@@ -337,13 +401,8 @@
@@ -340,13 +403,8 @@
boolean flag = false;
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
@ -143,7 +142,7 @@
if (profiledduration != null) {
profiledduration.finish();
}
@@ -358,36 +417,206 @@
@@ -361,36 +419,206 @@
}
@ -152,7 +151,7 @@
+ private void loadWorld0(String s) {
+ Convertable.ConversionSession worldSession = this.storageSource;
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.registryHolder;
+ WorldDataServer overworldData = (WorldDataServer) worldSession.getDataTag(registryreadops, datapackconfiguration);
+ WorldDataServer overworldData = (WorldDataServer) worldSession.getDataTag(registryreadops, datapackconfiguration, iregistrycustom_dimension.allElementsLifecycle());
+ if (overworldData == null) {
+ WorldSettings worldsettings;
+ GeneratorSettings generatorsettings;
@ -170,16 +169,16 @@
- long i = generatorsettings.seed();
- long j = BiomeManager.obfuscateSeed(i);
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
- RegistryMaterials<WorldDimension> registrymaterials = generatorsettings.dimensions();
- WorldDimension worlddimension = (WorldDimension) registrymaterials.get(WorldDimension.OVERWORLD);
- DimensionManager dimensionmanager;
- IRegistry<WorldDimension> iregistry = generatorsettings.dimensions();
- WorldDimension worlddimension = (WorldDimension) iregistry.get(WorldDimension.OVERWORLD);
- Holder holder;
- Object object;
-
- if (worlddimension == null) {
- dimensionmanager = (DimensionManager) this.registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionManager.OVERWORLD_LOCATION);
- object = GeneratorSettings.makeDefaultOverworld(this.registryHolder, (new Random()).nextLong());
- holder = this.registryAccess().registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrCreateHolder(DimensionManager.OVERWORLD_LOCATION);
- object = GeneratorSettings.makeDefaultOverworld(this.registryAccess(), (new Random()).nextLong());
- } else {
- dimensionmanager = worlddimension.type();
- holder = worlddimension.typeHolder();
- object = worlddimension.generator();
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension).withBonusChest() : dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension);
@ -189,9 +188,9 @@
+ }
+
+ GeneratorSettings overworldSettings = overworldData.worldGenSettings();
+ RegistryMaterials<WorldDimension> registrymaterials = overworldSettings.dimensions();
+ for (Entry<ResourceKey<WorldDimension>, WorldDimension> entry : registrymaterials.entrySet()) {
+ ResourceKey<WorldDimension> dimensionKey = entry.getKey();
+ IRegistry<WorldDimension> iregistry = overworldSettings.dimensions();
+ for (WorldDimension worldDimension : iregistry) {
+ ResourceKey<WorldDimension> dimensionKey = iregistry.getResourceKey(worldDimension).get();
+
+ WorldServer world;
+ int dimension = 0;
@ -259,7 +258,7 @@
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
+
+ WorldDataServer worlddata = (WorldDataServer) worldSession.getDataTag((DynamicOps) registryreadops, datapackconfiguration);
+ WorldDataServer worlddata = (WorldDataServer) worldSession.getDataTag((DynamicOps) registryreadops, datapackconfiguration, iregistrycustom_dimension.allElementsLifecycle());
+ if (worlddata == null) {
+ WorldSettings worldsettings;
+ GeneratorSettings generatorsettings;
@ -289,27 +288,27 @@
+ long i = generatorsettings.seed();
+ long j = BiomeManager.obfuscateSeed(i);
+ List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
+ WorldDimension worlddimension = (WorldDimension) registrymaterials.get(dimensionKey);
+ DimensionManager dimensionmanager;
+ WorldDimension worlddimension = (WorldDimension) iregistry.get(dimensionKey);
+ Holder<DimensionManager> holder;
+ ChunkGenerator chunkgenerator;
+
+ if (worlddimension == null) {
+ dimensionmanager = (DimensionManager) this.registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrThrow(DimensionManager.OVERWORLD_LOCATION);
+ holder = this.registryAccess().registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getOrCreateHolder(DimensionManager.OVERWORLD_LOCATION);
+ chunkgenerator = GeneratorSettings.makeDefaultOverworld(this.registryHolder, (new Random()).nextLong());
+ } else {
+ dimensionmanager = worlddimension.type();
+ holder = worlddimension.typeHolder();
+ chunkgenerator = worlddimension.generator();
+ }
+
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), dimensionmanager);
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), holder.value());
+ if (biomeProvider == null && gen != null) {
+ biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
+ }
+
+ if (biomeProvider != null) {
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(worldInfo, biomeProvider, registryHolder.ownedRegistryOrThrow(IRegistry.BIOME_REGISTRY));
+ if (chunkgenerator instanceof ChunkGeneratorAbstract) {
+ chunkgenerator = new ChunkGeneratorAbstract(((ChunkGeneratorAbstract) chunkgenerator).noises, worldChunkManager, chunkgenerator.strongholdSeed, ((ChunkGeneratorAbstract) chunkgenerator).settings);
+ if (chunkgenerator instanceof ChunkGeneratorAbstract cga) {
+ chunkgenerator = new ChunkGeneratorAbstract(cga.structureSets, cga.noises, worldChunkManager, chunkgenerator.ringPlacementSeed, cga.settings);
+ }
+ }
+
@ -321,14 +320,14 @@
+
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
+
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, holder, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ WorldPersistentData worldpersistentdata = world.getDataStorage();
+ this.readScoreboard(worldpersistentdata);
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
+ } else {
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, holder, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ }
+
+ worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
@ -348,7 +347,7 @@
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, holder, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
+ this.connection.acceptConnections();
@ -374,7 +373,7 @@
if (!iworlddataserver.isInitialized()) {
try {
@@ -411,31 +640,8 @@
@@ -414,31 +642,8 @@
iworlddataserver.setInitialized(true);
}
@ -383,7 +382,7 @@
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents());
- }
-
- Iterator iterator = registrymaterials.entrySet().iterator();
- Iterator iterator = iregistry.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Entry<ResourceKey<WorldDimension>, WorldDimension> entry = (Entry) iterator.next();
@ -391,10 +390,10 @@
-
- if (resourcekey != WorldDimension.OVERWORLD) {
- ResourceKey<World> resourcekey1 = ResourceKey.create(IRegistry.DIMENSION_REGISTRY, resourcekey.location());
- DimensionManager dimensionmanager1 = ((WorldDimension) entry.getValue()).type();
- Holder<DimensionManager> holder1 = ((WorldDimension) entry.getValue()).typeHolder();
- ChunkGenerator chunkgenerator = ((WorldDimension) entry.getValue()).generator();
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, dimensionmanager1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, holder1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
-
- worldborder.addListener(new IWorldBorderListener.a(worldserver1.getWorldBorder()));
- this.levels.put(resourcekey1, worldserver1);
@ -407,7 +406,7 @@
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
if (flag1) {
@@ -443,6 +649,21 @@
@@ -446,6 +651,21 @@
} else {
ChunkGenerator chunkgenerator = worldserver.getChunkSource().getGenerator();
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkgenerator.climateSampler().findSpawnPosition());
@ -429,7 +428,7 @@
int i = chunkgenerator.getSpawnHeight(worldserver);
if (i < worldserver.getMinBuildHeight()) {
@@ -500,8 +721,15 @@
@@ -503,8 +723,15 @@
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
}
@ -447,7 +446,7 @@
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
BlockPosition blockposition = worldserver.getSharedSpawnPos();
@@ -514,16 +742,20 @@
@@ -517,16 +744,20 @@
chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
while (chunkproviderserver.getTickingGenerated() != 441) {
@ -476,7 +475,7 @@
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks");
if (forcedchunk != null) {
@@ -538,11 +770,18 @@
@@ -541,11 +772,18 @@
}
}
@ -498,7 +497,7 @@
}
protected void detectBundledResources() {
@@ -587,12 +826,16 @@
@@ -590,12 +828,16 @@
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
}
@ -509,13 +508,13 @@
iworlddataserver.setWorldBorder(worldserver1.getWorldBorder().createSettings());
this.worldData.setCustomBossEvents(this.getCustomBossEvents().save());
this.storageSource.saveDataTag(this.registryHolder, this.worldData, this.getPlayerList().getSingleplayerData());
this.storageSource.saveDataTag(this.registryAccess(), this.worldData, this.getPlayerList().getSingleplayerData());
+ */
+ // CraftBukkit end
if (flag1) {
Iterator iterator1 = this.getAllLevels().iterator();
@@ -627,8 +870,29 @@
@@ -630,8 +872,29 @@
this.stopServer();
}
@ -545,7 +544,7 @@
if (this.getConnection() != null) {
this.getConnection().stop();
}
@@ -638,6 +902,7 @@
@@ -641,6 +904,7 @@
MinecraftServer.LOGGER.info("Saving players");
this.playerList.saveAll();
this.playerList.removeAll();
@ -553,7 +552,7 @@
}
MinecraftServer.LOGGER.info("Saving worlds");
@@ -712,9 +977,10 @@
@@ -732,9 +996,10 @@
while (this.running) {
long i = SystemUtils.getMillis() - this.nextTickTime;
@ -565,15 +564,15 @@
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
this.nextTickTime += j * 50L;
this.lastOverloadWarning = this.nextTickTime;
@@ -725,6 +991,7 @@
this.debugCommandProfiler = new MinecraftServer.a(SystemUtils.getNanos(), this.tickCount);
@@ -745,6 +1010,7 @@
this.debugCommandProfiler = new MinecraftServer.b(SystemUtils.getNanos(), this.tickCount);
}
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
this.nextTickTime += 50L;
this.startMetricsRecordingTick();
this.profiler.push("tick");
@@ -775,6 +1042,12 @@
@@ -789,6 +1055,12 @@
this.profileCache.clearExecutor();
}
@ -586,7 +585,7 @@
this.onServerExit();
}
@@ -783,8 +1056,15 @@
@@ -822,8 +1094,15 @@
}
private boolean haveTime() {
@ -603,7 +602,7 @@
protected void waitUntilNextTick() {
this.runAllTasks();
@@ -830,7 +1110,7 @@
@@ -869,7 +1148,7 @@
}
}
@ -612,7 +611,7 @@
this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -901,7 +1181,7 @@
@@ -940,7 +1219,7 @@
}
}
@ -621,7 +620,7 @@
MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save");
this.saveEverything(true, false, false);
@@ -920,22 +1200,39 @@
@@ -959,22 +1238,39 @@
}
public void tickChildren(BooleanSupplier booleansupplier) {
@ -661,7 +660,7 @@
this.profiler.push("tick");
@@ -1024,7 +1321,7 @@
@@ -1063,7 +1359,7 @@
@DontObfuscate
public String getServerModName() {
@ -670,9 +669,9 @@
}
public SystemReport fillSystemReport(SystemReport systemreport) {
@@ -1354,16 +1651,17 @@
@@ -1406,11 +1702,11 @@
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
IRegistryCustom.Dimension iregistrycustom_dimension = this.registryAccess();
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
- Stream stream = collection.stream();
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
@ -682,15 +681,17 @@
- return (ImmutableList) stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(ResourcePackLoader::open).collect(ImmutableList.toImmutableList());
+ return stream.map(resourcepackrepository::getPack).filter(Objects::nonNull).map(ResourcePackLoader::open).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
}, this).thenCompose((immutablelist) -> {
return DataPackResources.loadResources(immutablelist, this.registryHolder, this.isDedicatedServer() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.getFunctionCompilationLevel(), this.executor, this);
}).thenAcceptAsync((datapackresources) -> {
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
@@ -1425,6 +1721,7 @@
}).thenAcceptAsync((minecraftserver_a) -> {
this.resources.close();
this.resources = datapackresources;
this.resources = minecraftserver_a;
+ this.server.syncCommands(); // SPIGOT-5884: Lost on reload
this.packRepository.setSelected(collection);
this.worldData.setDataPackConfig(getSelectedPacks(this.packRepository));
datapackresources.updateGlobals();
@@ -1717,7 +2015,7 @@
this.resources.managers.updateRegistryTags(this.registryAccess());
@@ -1774,7 +2071,7 @@
try {
label51:
{
@ -699,7 +700,7 @@
try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -1767,6 +2065,22 @@
@@ -1824,6 +2121,22 @@
}
@ -722,3 +723,24 @@
private void startMetricsRecordingTick() {
if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
@@ -1935,8 +2248,10 @@
}
}
- private static record a(IReloadableResourceManager a, DataPackResources b) implements AutoCloseable {
+ // CraftBukkit start - decompile error
+ public static record a(IReloadableResourceManager resourceManager, DataPackResources managers) implements AutoCloseable {
+ /*
final IReloadableResourceManager resourceManager;
final DataPackResources managers;
@@ -1944,6 +2259,8 @@
this.resourceManager = ireloadableresourcemanager;
this.managers = datapackresources;
}
+ */
+ // CraftBukkit end
public void close() {
this.resourceManager.close();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
@@ -79,7 +79,7 @@
@@ -90,7 +90,7 @@
if (entity instanceof EntityHuman) {
set.add(entity.getTeam());
} else {
@ -9,7 +9,7 @@
}
}
@@ -288,7 +288,7 @@
@@ -299,7 +299,7 @@
for (boolean flag2 = iblockaccess.getBlockState(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > iblockaccess.getMinBuildHeight(); flag2 = flag1) {
blockposition_mutableblockposition.move(EnumDirection.DOWN);
@ -18,7 +18,7 @@
if (!flag1 && flag2 && flag) {
return blockposition_mutableblockposition.getY() + 1;
}
@@ -301,7 +301,7 @@
@@ -312,7 +312,7 @@
public boolean isSafe(IBlockAccess iblockaccess, int i) {
BlockPosition blockposition = new BlockPosition(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
@ -27,7 +27,7 @@
Material material = iblockdata.getMaterial();
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
@@ -311,5 +311,12 @@
@@ -322,5 +322,12 @@
this.x = MathHelper.nextDouble(random, d0, d2);
this.z = MathHelper.nextDouble(random, d1, d3);
}

Datei anzeigen

@ -1,12 +1,15 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -61,6 +61,15 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -59,6 +59,18 @@
import net.minecraft.world.level.storage.Convertable;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.serialization.DynamicOps;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.world.level.DataPackConfiguration;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.io.IoBuilder;
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.server.ServerCommandEvent;
@ -15,21 +18,21 @@
+
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
static final Logger LOGGER = LogManager.getLogger();
@@ -81,8 +90,10 @@
static final Logger LOGGER = LogUtils.getLogger();
@@ -79,8 +91,10 @@
@Nullable
private final IChatBaseComponent resourcePackPrompt;
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
- public DedicatedServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
- super(thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ // CraftBukkit start - Signature changed
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ super(options, datapackconfiguration, thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, DynamicOps<NBTBase> registryreadops, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
+ super(options, datapackconfiguration, registryreadops, thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
+ // CraftBukkit end
this.settings = dedicatedserversettings;
this.rconConsoleSource = new RemoteControlCommandListener(this);
this.textFilterClient = TextFilter.createFromConfig(dedicatedserversettings.getProperties().textFilteringConfig);
@@ -93,13 +104,44 @@
@@ -91,13 +105,44 @@
public boolean initServer() throws IOException {
Thread thread = new Thread("Server console handler") {
public void run() {
@ -77,7 +80,7 @@
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -108,6 +150,27 @@
@@ -106,6 +151,27 @@
}
};
@ -105,7 +108,7 @@
thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start();
@@ -133,7 +196,7 @@
@@ -131,7 +197,7 @@
this.setMotd(dedicatedserverproperties.motd);
super.setPlayerIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
@ -114,7 +117,7 @@
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null;
@@ -157,6 +220,12 @@
@@ -155,6 +221,12 @@
return false;
}
@ -127,12 +130,12 @@
if (!this.usesAuthentication()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -171,13 +240,13 @@
@@ -169,13 +241,13 @@
if (!NameReferencingFileConverter.serverReadyAfterUserconversion(this)) {
return false;
} else {
- this.setPlayerList(new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage));
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage)); // CraftBukkit - moved up
- this.setPlayerList(new DedicatedPlayerList(this, this.registryAccess(), this.playerDataStorage));
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registryAccess(), this.playerDataStorage)); // CraftBukkit - moved up
long i = SystemUtils.getNanos();
TileEntitySkull.setup(this.getProfileCache(), this.getSessionService(), this);
@ -143,7 +146,7 @@
long j = SystemUtils.getNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@@ -194,6 +263,7 @@
@@ -192,6 +264,7 @@
if (dedicatedserverproperties.enableRcon) {
DedicatedServer.LOGGER.info("Starting remote control listener");
this.rconThread = RemoteControlListener.create(this);
@ -151,7 +154,7 @@
}
if (this.getMaxTickLength() > 0L) {
@@ -337,6 +407,7 @@
@@ -335,6 +408,7 @@
this.queryThreadGs4.stop();
}
@ -159,7 +162,7 @@
}
@Override
@@ -358,7 +429,15 @@
@@ -356,7 +430,15 @@
while (!this.consoleInput.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0);
@ -176,7 +179,7 @@
}
}
@@ -568,14 +647,45 @@
@@ -566,14 +648,45 @@
@Override
public String getPluginNames() {
@ -224,7 +227,7 @@
});
return this.rconConsoleSource.getCommandResponse();
}
@@ -649,4 +759,15 @@
@@ -647,4 +760,15 @@
public IChatBaseComponent getResourcePackPrompt() {
return this.resourcePackPrompt;
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -10,8 +10,14 @@
@@ -13,8 +13,14 @@
import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.level.levelgen.GeneratorSettings;
@ -15,7 +15,7 @@
public final boolean onlineMode = this.get("online-mode", true);
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
public final String serverIp = this.get("server-ip", "");
@@ -67,8 +73,10 @@
@@ -71,8 +77,10 @@
@Nullable
private GeneratorSettings worldGenSettings;
@ -28,8 +28,8 @@
this.difficulty = (EnumDifficulty) this.get("difficulty", dispatchNumberOrString(EnumDifficulty::byId, EnumDifficulty::byName), EnumDifficulty::getKey, EnumDifficulty.EASY);
this.gamemode = (EnumGamemode) this.get("gamemode", dispatchNumberOrString(EnumGamemode::byId, EnumGamemode::byName), EnumGamemode::getName, EnumGamemode.SURVIVAL);
this.levelName = this.get("level-name", "world");
@@ -112,13 +120,15 @@
this.whiteList = this.getMutable("white-list", false);
@@ -121,13 +129,15 @@
}, "default"));
}
- public static DedicatedServerProperties fromFile(Path path) {
@ -48,3 +48,24 @@
dedicatedserverproperties.getWorldGenSettings(iregistrycustom);
return dedicatedserverproperties;
@@ -141,8 +151,10 @@
return this.worldGenSettings;
}
- public static record a(String a, JsonObject b, boolean c, String d) {
+ // CraftBukkit start - decompile error
+ public static record a(String levelSeed, JsonObject generatorSettings, boolean generateStructures, String levelType) {
+ /*
private final String levelSeed;
private final JsonObject generatorSettings;
private final boolean generateStructures;
@@ -154,6 +166,8 @@
this.generateStructures = flag;
this.levelType = s1;
}
+ */
+ // CraftBukkit end
public String levelSeed() {
return this.levelSeed;

Datei anzeigen

@ -1,14 +1,14 @@
--- a/net/minecraft/server/dedicated/PropertyManager.java
+++ b/net/minecraft/server/dedicated/PropertyManager.java
@@ -17,15 +17,30 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.core.IRegistryCustom;
import org.slf4j.Logger;
+import joptsimple.OptionSet; // CraftBukkit
+
public abstract class PropertyManager<T extends PropertyManager<T>> {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
public final Properties properties;
+ // CraftBukkit start
+ private OptionSet options = null;

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkMapDistance.java
+++ b/net/minecraft/server/level/ChunkMapDistance.java
@@ -125,10 +125,25 @@
@@ -126,10 +126,25 @@
}
if (!this.chunksToUpdateFutures.isEmpty()) {
@ -29,7 +29,7 @@
return true;
} else {
if (!this.ticketsToRelease.isEmpty()) {
@@ -164,7 +179,7 @@
@@ -165,7 +180,7 @@
}
}
@ -38,7 +38,7 @@
ArraySetSorted<Ticket<?>> arraysetsorted = this.getTickets(i);
int j = getTicketLevelAt(arraysetsorted);
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket);
@@ -174,13 +189,15 @@
@@ -175,13 +190,15 @@
this.ticketTracker.update(i, ticket.getTicketLevel(), true);
}
@ -56,7 +56,7 @@
}
if (arraysetsorted.isEmpty()) {
@@ -188,6 +205,7 @@
@@ -189,6 +206,7 @@
}
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
@ -64,7 +64,7 @@
}
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
@@ -201,19 +219,33 @@
@@ -202,19 +220,33 @@
}
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
@ -100,7 +100,7 @@
}
private ArraySetSorted<Ticket<?>> getTickets(long i) {
@@ -252,6 +284,7 @@
@@ -253,6 +285,7 @@
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
long i = chunkcoordintpair.toLong();
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
@ -108,8 +108,8 @@
objectset.remove(entityplayer);
if (objectset.isEmpty()) {
@@ -347,6 +380,26 @@
return this.tickingTicketsTracker;
@@ -382,6 +415,26 @@
return !this.tickets.isEmpty();
}
+ // CraftBukkit start

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -86,6 +86,24 @@
@@ -83,6 +83,24 @@
this.clearCache();
}
@ -18,14 +18,14 @@
+ if (chunk == null) {
+ return null;
+ }
+ return chunk.getFullChunkUnchecked();
+ return chunk.getFullChunk();
+ }
+ // CraftBukkit end
+
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -130,7 +148,7 @@
@@ -127,7 +145,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
ichunkaccess = this.lastChunk[l];
@ -34,7 +34,7 @@
return ichunkaccess;
}
}
@@ -178,12 +196,12 @@
@@ -175,12 +193,12 @@
if (playerchunk == null) {
return null;
} else {
@ -49,7 +49,7 @@
if (ichunkaccess1 != null) {
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
@@ -231,7 +249,15 @@
@@ -228,7 +246,15 @@
int l = 33 + ChunkStatus.getDistance(chunkstatus);
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
@ -66,7 +66,7 @@
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.chunkAbsent(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -250,7 +276,7 @@
@@ -247,7 +273,7 @@
}
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
@ -75,7 +75,7 @@
}
@Override
@@ -317,7 +343,7 @@
@@ -314,7 +340,7 @@
} else if (!this.level.shouldTickBlocksAt(i)) {
return false;
} else {
@ -84,7 +84,7 @@
return either != null && either.left().isPresent();
}
@@ -330,11 +356,31 @@
@@ -327,11 +353,31 @@
@Override
public void close() throws IOException {
@ -115,7 +115,7 @@
+ // CraftBukkit end
+
@Override
public void tick(BooleanSupplier booleansupplier) {
public void tick(BooleanSupplier booleansupplier, boolean flag) {
this.level.getProfiler().push("purge");
@@ -363,7 +409,7 @@
@ -135,7 +135,7 @@
Collections.shuffle(list);
Iterator iterator1 = list.iterator();
@@ -579,18 +625,26 @@
@@ -581,18 +627,26 @@
}
@Override
@ -164,7 +164,7 @@
final Chunk chunk;
final PlayerChunk holder;
@@ -606,5 +660,7 @@
@@ -608,5 +662,7 @@
public PlayerChunk holder() {
return this.holder;
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -140,6 +140,33 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
@ -33,7 +33,7 @@
+
public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -194,6 +221,20 @@
public int latency;
public boolean wonGame;
@ -113,7 +113,7 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -319,11 +404,20 @@
@@ -319,17 +404,26 @@
if (nbttagcompound.contains("recipeBook", 10)) {
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
}
@ -134,6 +134,13 @@
if (nbttagcompound.contains("SpawnX", 99) && nbttagcompound.contains("SpawnY", 99) && nbttagcompound.contains("SpawnZ", 99)) {
this.respawnPosition = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.respawnForced = nbttagcompound.getBoolean("SpawnForced");
this.respawnAngle = nbttagcompound.getFloat("SpawnAngle");
if (nbttagcompound.contains("SpawnDimension")) {
- DataResult dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension"));
+ DataResult<ResourceKey<World>> dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension")); // CraftBukkit - decompile error
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -356,7 +450,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@ -414,7 +421,7 @@
+ /*
WorldData worlddata = worldserver.getLevelData();
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionType(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeRegistration(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
@@ -780,22 +993,52 @@
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
@ -454,7 +461,7 @@
+ if (true) { // CraftBukkit
+ this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
+
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionType(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeRegistration(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked()));
+ PlayerList playerlist = this.server.getPlayerList();
+

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/EntityTrackerEntry.java
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
@@ -40,6 +40,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.server.network.ServerPlayerConnection;
@ -12,7 +12,7 @@
+
public class EntityTrackerEntry {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -61,8 +67,12 @@
private List<Entity> lastPassengers;
private boolean wasRiding;

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/PlayerChunk.java
+++ b/net/minecraft/server/level/PlayerChunk.java
@@ -35,6 +35,10 @@
@@ -37,6 +37,10 @@
import net.minecraft.world.level.chunk.ProtoChunkExtension;
import net.minecraft.world.level.lighting.LightEngine;
@ -11,7 +11,7 @@
public class PlayerChunk {
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK = Either.right(PlayerChunk.Failure.UNLOADED);
@@ -72,11 +76,11 @@
@@ -75,11 +79,11 @@
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
@ -25,27 +25,7 @@
this.pos = chunkcoordintpair;
this.levelHeightAccessor = levelheightaccessor;
this.lightEngine = lightengine;
@@ -89,6 +93,19 @@
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
}
+ // CraftBukkit start
+ public Chunk getFullChunk() {
+ if (!getFullChunkStatus(this.oldTicketLevel).isOrAfter(PlayerChunk.State.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks
+ return this.getFullChunkUnchecked();
+ }
+
+ public Chunk getFullChunkUnchecked() {
+ CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL);
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either<IChunkAccess, PlayerChunk.Failure>) statusFuture.getNow(null);
+ return (either == null) ? null : (Chunk) either.left().orElse(null);
+ }
+ // CraftBukkit end
+
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getFutureIfPresentUnchecked(ChunkStatus chunkstatus) {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.getIndex());
@@ -114,9 +131,9 @@
@@ -117,17 +121,17 @@
@Nullable
public Chunk getTickingChunk() {
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getTickingChunkFuture();
@ -57,7 +37,17 @@
}
@Nullable
@@ -161,6 +178,7 @@
public Chunk getFullChunk() {
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getFullChunkFuture();
- Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
+ Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
- return either == null ? null : (Chunk) either.left().orElse((Object) null);
+ return either == null ? null : (Chunk) either.left().orElse(null); // CraftBukkit - decompile error
}
@Nullable
@@ -172,6 +176,7 @@
if (chunk != null) {
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
@ -65,16 +55,7 @@
if (this.changedBlocksPerSection[i] == null) {
this.hasChangedSections = true;
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
@@ -271,7 +289,7 @@
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(i);
if (completablefuture != null) {
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
boolean flag = either != null && either.right().isPresent();
if (!flag) {
@@ -348,7 +366,7 @@
@@ -368,7 +373,7 @@
this.pendingFullStateConfirmation = completablefuture1;
completablefuture.thenAccept((either) -> {
either.ifLeft((chunk) -> {
@ -83,7 +64,7 @@
});
});
}
@@ -365,6 +383,30 @@
@@ -385,6 +390,30 @@
boolean flag1 = this.ticketLevel <= PlayerChunkMap.MAX_CHUNK_DISTANCE;
PlayerChunk.State playerchunk_state = getFullChunkStatus(this.oldTicketLevel);
PlayerChunk.State playerchunk_state1 = getFullChunkStatus(this.ticketLevel);
@ -103,7 +84,7 @@
+ }
+ }).exceptionally((throwable) -> {
+ // ensure exceptions are printed, by default this is not the case
+ MinecraftServer.LOGGER.fatal("Failed to schedule unload callback for chunk " + PlayerChunk.this.pos, throwable);
+ MinecraftServer.LOGGER.error("Failed to schedule unload callback for chunk " + PlayerChunk.this.pos, throwable);
+ return null;
+ });
+
@ -114,7 +95,7 @@
if (flag) {
Either<IChunkAccess, PlayerChunk.Failure> either = Either.right(new PlayerChunk.Failure() {
@@ -435,6 +477,26 @@
@@ -455,6 +484,26 @@
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
this.oldTicketLevel = this.ticketLevel;
@ -130,7 +111,7 @@
+ }
+ }).exceptionally((throwable) -> {
+ // ensure exceptions are printed, by default this is not the case
+ MinecraftServer.LOGGER.fatal("Failed to schedule load callback for chunk " + PlayerChunk.this.pos, throwable);
+ MinecraftServer.LOGGER.error("Failed to schedule load callback for chunk " + PlayerChunk.this.pos, throwable);
+ return null;
+ });
+

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/PlayerChunkMap.java
+++ b/net/minecraft/server/level/PlayerChunkMap.java
@@ -96,6 +96,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -98,6 +98,11 @@
import org.apache.commons.lang3.mutable.MutableObject;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.levelgen.GeneratorSettings;
@ -12,7 +12,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
@@ -135,6 +140,27 @@
@@ -139,6 +144,27 @@
private final Queue<Runnable> unloadQueue;
int viewDistance;
@ -40,7 +40,7 @@
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -291,9 +317,12 @@
@@ -296,9 +322,12 @@
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
List<IChunkAccess> list3 = Lists.newArrayList();
@ -53,9 +53,9 @@
+ final int l1 = cnt;
+ // CraftBukkit end
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
Optional<IChunkAccess> optional = either.left();
@@ -463,7 +492,7 @@
if (either == null) {
@@ -503,7 +532,7 @@
private void scheduleUnload(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
@ -64,7 +64,7 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
if (completablefuture1 != completablefuture) {
@@ -642,7 +671,21 @@
@@ -683,7 +712,21 @@
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
if (!list.isEmpty()) {
@ -87,7 +87,7 @@
}
}
@@ -740,7 +783,7 @@
@@ -782,7 +825,7 @@
if (!playerchunk.wasAccessibleSinceLastSave()) {
return false;
} else {
@ -96,7 +96,7 @@
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
return false;
@@ -890,7 +933,8 @@
@@ -944,7 +987,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@ -106,7 +106,7 @@
return chunk.getBlockEntities().size();
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
return chunk.getBlockTicks().count();
@@ -903,7 +947,7 @@
@@ -957,7 +1001,7 @@
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@ -115,7 +115,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -921,7 +965,7 @@
@@ -975,7 +1019,7 @@
private NBTTagCompound readChunk(ChunkCoordIntPair chunkcoordintpair) throws IOException {
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
@ -124,7 +124,7 @@
}
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
@@ -1342,7 +1386,7 @@
@@ -1396,7 +1440,7 @@
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@ -133,7 +133,7 @@
this.entity = entity;
this.range = i;
this.lastSectionPos = SectionPosition.of(entity);
@@ -1395,12 +1439,17 @@
@@ -1449,12 +1493,17 @@
public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.entity) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/PlayerInteractManager.java
+++ b/net/minecraft/server/level/PlayerInteractManager.java
@@ -24,6 +24,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -26,6 +26,27 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.ArrayList;
@ -27,8 +27,8 @@
+
public class PlayerInteractManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -54,6 +75,13 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -56,6 +77,13 @@
if (enumgamemode == this.gameModeForPlayer) {
return false;
} else {
@ -42,7 +42,7 @@
this.setGameModeForPlayer(enumgamemode, this.gameModeForPlayer);
return true;
}
@@ -64,7 +92,7 @@
@@ -66,7 +94,7 @@
this.gameModeForPlayer = enumgamemode;
enumgamemode.updatePlayerAbilities(this.player.getAbilities());
this.player.onUpdateAbilities();
@ -51,7 +51,7 @@
this.level.updateSleepingPlayerList();
}
@@ -86,7 +114,7 @@
@@ -88,7 +116,7 @@
}
public void tick() {
@ -60,7 +60,7 @@
IBlockData iblockdata;
if (this.hasDelayedDestroy) {
@@ -142,10 +170,32 @@
@@ -152,10 +180,32 @@
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.level.mayInteract(this.player, blockposition)) {
@ -93,11 +93,11 @@
if (this.isCreative()) {
this.destroyAndAck(blockposition, packetplayinblockdig_enumplayerdigtype, "creative destroy");
return;
@@ -160,11 +210,43 @@
@@ -170,11 +220,43 @@
float f = 1.0F;
iblockdata = this.level.getBlockState(blockposition);
- if (!iblockdata.isAir()) {
iblockdata1 = this.level.getBlockState(blockposition);
- if (!iblockdata1.isAir()) {
+ // CraftBukkit start - Swings at air do *NOT* exist.
+ if (event.useInteractedBlock() == Event.Result.DENY) {
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
@ -110,9 +110,9 @@
+ } else if (data.getBlock() instanceof BlockTrapdoor) {
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
+ }
+ } else if (!iblockdata.isAir()) {
iblockdata.attack(this.level, blockposition, this.player);
f = iblockdata.getDestroyProgress(this.player, this.player.level, blockposition);
+ } else if (!iblockdata1.isAir()) {
iblockdata1.attack(this.level, blockposition, this.player);
f = iblockdata1.getDestroyProgress(this.player, this.player.level, blockposition);
}
+ if (event.useItemInHand() == Event.Result.DENY) {
@ -135,10 +135,10 @@
+ }
+ // CraftBukkit end
+
if (!iblockdata.isAir() && f >= 1.0F) {
if (!iblockdata1.isAir() && f >= 1.0F) {
this.destroyAndAck(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
} else {
@@ -208,13 +290,15 @@
@@ -218,13 +300,15 @@
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
if (!Objects.equals(this.destroyPos, blockposition)) {
@ -155,7 +155,7 @@
}
}
@@ -224,17 +308,72 @@
@@ -234,17 +318,72 @@
if (this.destroyBlock(blockposition)) {
this.player.connection.send(new PacketPlayOutBlockBreak(blockposition, this.level.getBlockState(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
} else {
@ -230,7 +230,7 @@
TileEntity tileentity = this.level.getBlockEntity(blockposition);
Block block = iblockdata.getBlock();
@@ -244,6 +383,10 @@
@@ -254,6 +393,10 @@
} else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) {
return false;
} else {
@ -241,7 +241,7 @@
block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
boolean flag = this.level.removeBlock(blockposition, false);
@@ -252,19 +395,32 @@
@@ -262,19 +405,32 @@
}
if (this.isCreative()) {
@ -277,7 +277,7 @@
}
}
}
@@ -306,12 +462,52 @@
@@ -316,12 +472,52 @@
}
}
@ -330,7 +330,7 @@
if (itileinventory != null) {
entityplayer.openMenu(itileinventory);
@@ -325,7 +521,7 @@
@@ -335,7 +531,7 @@
ItemStack itemstack1 = itemstack.copy();
if (!flag1) {
@ -339,7 +339,7 @@
if (enuminteractionresult.consumesAction()) {
CriterionTriggers.ITEM_USED_ON_BLOCK.trigger(entityplayer, blockposition, itemstack1);
@@ -333,17 +529,17 @@
@@ -343,17 +539,17 @@
}
}
@ -360,7 +360,7 @@
}
if (enuminteractionresult1.consumesAction()) {
@@ -351,10 +547,10 @@
@@ -361,10 +557,10 @@
}
return enuminteractionresult1;

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
@@ -200,7 +200,7 @@
@@ -199,7 +199,7 @@
if (iblockdata.isAir()) {
return false;
} else {
@ -9,7 +9,7 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(blockposition) : null;
Block.dropResources(iblockdata, this.level, blockposition, tileentity, entity, ItemStack.EMPTY);
@@ -319,6 +319,13 @@
@@ -318,6 +318,13 @@
@Override
public boolean addFreshEntity(Entity entity) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java
@@ -149,6 +149,20 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -150,6 +150,20 @@
import net.minecraft.world.ticks.TickListServer;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.entity.monster.EntityDrowned;
@ -21,7 +21,7 @@
public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
@@ -166,7 +180,7 @@
@@ -167,7 +181,7 @@
final List<EntityPlayer> players;
private final ChunkProviderServer chunkSource;
private final MinecraftServer server;
@ -30,13 +30,13 @@
final EntityTickList entityTickList;
public final PersistentEntitySectionManager<Entity> entityManager;
public boolean noSave;
@@ -189,9 +203,29 @@
@@ -190,9 +204,29 @@
private final StructureCheck structureCheck;
private final boolean tickTime;
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
- Objects.requireNonNull(minecraftserver);
- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i);
- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i);
+
+ // CraftBukkit start
+ private int tickPosition;
@ -53,9 +53,9 @@
+ }
+
+ // Add env and gen to constructor, WorldData -> WorldDataServer
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env);
+ super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env);
+ this.pvpMode = minecraftserver.isPvpAllowed();
+ convertable = convertable_conversionsession;
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
@ -63,7 +63,7 @@
this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList();
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
@@ -203,7 +237,13 @@
@@ -204,7 +238,13 @@
this.tickTime = flag1;
this.server = minecraftserver;
this.customSpawners = list;
@ -75,10 +75,10 @@
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
+ }
+ // CraftBukkit end
chunkgenerator.ensureStructuresGenerated();
boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
@@ -234,14 +274,15 @@
@@ -236,14 +276,15 @@
long l = minecraftserver.getWorldData().worldGenSettings().seed();
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer);
@ -96,7 +96,7 @@
}
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
@@ -273,12 +314,20 @@
@@ -275,12 +316,20 @@
long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@ -120,7 +120,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle();
}
@@ -304,7 +353,7 @@
@@ -306,7 +355,7 @@
this.runBlockEvents();
this.handlingTick = false;
gameprofilerfiller.pop();
@ -129,7 +129,7 @@
if (flag) {
this.resetEmptyTime();
@@ -320,7 +369,7 @@
@@ -322,7 +371,7 @@
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
@ -138,7 +138,7 @@
entity.discard();
} else {
gameprofilerfiller.push("checkDespawn");
@@ -392,7 +441,7 @@
@@ -394,7 +443,7 @@
private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers();
@ -147,7 +147,7 @@
entityplayer.stopSleepInBed(false, false);
});
}
@@ -419,14 +468,14 @@
@@ -421,14 +470,14 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -164,8 +164,8 @@
}
}
@@ -437,12 +486,12 @@
BiomeBase biomebase = this.getBiome(blockposition);
@@ -439,12 +488,12 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
if (biomebase.shouldFreeze(this, blockposition1)) {
- this.setBlockAndUpdate(blockposition1, Blocks.ICE.defaultBlockState());
@ -179,7 +179,7 @@
}
IBlockData iblockdata = this.getBlockState(blockposition1);
@@ -638,6 +687,7 @@
@@ -640,6 +689,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
}
@ -187,7 +187,7 @@
if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
}
@@ -656,14 +706,47 @@
@@ -658,14 +708,47 @@
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
}
@ -237,7 +237,7 @@
}
public void resetEmptyTime() {
@@ -698,6 +781,7 @@
@@ -700,6 +783,7 @@
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick();
@ -245,7 +245,7 @@
this.getProfiler().pop();
Iterator iterator = entity.getPassengers().iterator();
@@ -721,6 +805,7 @@
@@ -723,6 +807,7 @@
});
gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick();
@ -253,7 +253,7 @@
gameprofilerfiller.pop();
Iterator iterator = entity1.getPassengers().iterator();
@@ -745,6 +830,7 @@
@@ -747,6 +832,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) {
@ -261,7 +261,7 @@
if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(new ChatMessage("menu.savingLevel"));
}
@@ -762,11 +848,19 @@
@@ -764,11 +850,19 @@
}
}
@ -282,7 +282,7 @@
}
this.getChunkSource().getDataStorage().save();
@@ -812,15 +906,34 @@
@@ -814,15 +908,34 @@
@Override
public boolean addFreshEntity(Entity entity) {
@ -320,7 +320,7 @@
}
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
@@ -851,24 +964,36 @@
@@ -853,24 +966,36 @@
this.entityManager.addNewEntity(entityplayer);
}
@ -361,7 +361,7 @@
return true;
}
}
@@ -882,10 +1007,32 @@
@@ -884,10 +1009,32 @@
entityplayer.remove(entity_removalreason);
}
@ -394,7 +394,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -894,6 +1041,12 @@
@@ -896,6 +1043,12 @@
double d1 = (double) blockposition.getY() - entityplayer.getY();
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
@ -407,7 +407,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -948,7 +1101,18 @@
@@ -950,7 +1103,18 @@
Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) {
@ -427,7 +427,7 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -984,10 +1148,20 @@
@@ -986,10 +1150,20 @@
@Override
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
@ -448,7 +448,7 @@
if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearToBlow();
}
@@ -1068,13 +1242,20 @@
@@ -1070,13 +1244,20 @@
}
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@ -471,16 +471,16 @@
++j;
}
}
@@ -1125,7 +1306,7 @@
@@ -1127,7 +1308,7 @@
@Nullable
public BlockPosition findNearestMapFeature(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
- return !this.server.getWorldData().worldGenSettings().generateFeatures() ? null : this.getChunkSource().getGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag);
+ return !this.serverLevelData.worldGenSettings().generateFeatures() ? null : this.getChunkSource().getGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag); // CraftBukkit
}
@Nullable
@@ -1162,11 +1343,21 @@
public BlockPosition findNearestMapFeature(TagKey<StructureFeature<?, ?>> tagkey, BlockPosition blockposition, int i, boolean flag) {
- if (!this.server.getWorldData().worldGenSettings().generateFeatures()) {
+ if (!this.serverLevelData.worldGenSettings().generateFeatures()) { // CraftBukkit
return null;
} else {
Optional<HolderSet.Named<StructureFeature<?, ?>>> optional = this.registryAccess().registryOrThrow(IRegistry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY).getTag(tagkey);
@@ -1169,11 +1350,21 @@
@Nullable
@Override
public WorldMap getMapData(String s) {
@ -503,7 +503,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap);
}
@@ -1478,6 +1669,11 @@
@@ -1485,6 +1676,11 @@
@Override
public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) {
@ -515,7 +515,7 @@
this.updateNeighborsAt(blockposition, block);
}
@@ -1497,12 +1693,12 @@
@@ -1504,12 +1700,12 @@
}
public boolean isFlat() {
@ -530,7 +530,7 @@
}
@Nullable
@@ -1530,7 +1726,7 @@
@@ -1532,7 +1728,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@ -539,7 +539,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1539,7 +1735,7 @@
@@ -1541,7 +1737,7 @@
object2intopenhashmap.addTo(s, 1);
}
@ -548,7 +548,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1550,17 +1746,33 @@
@@ -1552,17 +1748,33 @@
}
public static void makeObsidianPlatform(WorldServer worldserver) {
@ -584,7 +584,7 @@
}
@Override
@@ -1666,6 +1878,7 @@
@@ -1672,6 +1884,7 @@
}
}
@ -592,7 +592,7 @@
}
public void onTrackingEnd(Entity entity) {
@@ -1707,6 +1920,14 @@
@@ -1713,6 +1926,14 @@
gameeventlistenerregistrar.onListenerRemoved(entity.level);
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/network/LoginListener.java
+++ b/net/minecraft/server/network/LoginListener.java
@@ -36,6 +36,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.network.chat.ChatComponentText;
@ -68,7 +68,7 @@
if (entityplayer != null) {
this.state = LoginListener.EnumProtocolState.DELAY_ACCEPT;
@@ -192,6 +216,43 @@
@@ -199,6 +223,43 @@
try {
LoginListener.this.gameProfile = LoginListener.this.server.getSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.getAddress());
if (LoginListener.this.gameProfile != null) {
@ -112,7 +112,7 @@
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.gameProfile.getName(), LoginListener.this.gameProfile.getId());
LoginListener.this.state = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else if (LoginListener.this.server.isSingleplayer()) {
@@ -211,6 +272,11 @@
@@ -218,6 +279,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
@@ -28,6 +28,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.storage.SavedFile;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTCompressedStreamTools;
@ -11,7 +11,7 @@
+
public class NameReferencingFileConverter {
static final Logger LOGGER = LogManager.getLogger();
static final Logger LOGGER = LogUtils.getLogger();
@@ -88,7 +93,7 @@
try {
gameprofilebanlist.load();

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -95,6 +95,26 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.google.common.base.Predicate;
@ -73,7 +73,7 @@
this.server = minecraftserver;
this.registryHolder = iregistrycustom_dimension;
this.maxPlayers = i;
@@ -145,6 +177,12 @@
@@ -145,9 +177,15 @@
usercache.add(gameprofile);
NBTTagCompound nbttagcompound = this.load(entityplayer);
ResourceKey resourcekey;
@ -85,21 +85,25 @@
+ // CraftBukkit end
if (nbttagcompound != null) {
DataResult dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension")));
- DataResult dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension")));
+ DataResult<ResourceKey<World>> dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error
Logger logger = PlayerList.LOGGER;
Objects.requireNonNull(logger);
@@ -174,7 +212,8 @@
s1 = networkmanager.getRemoteAddress().toString();
}
- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ());
- PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", new Object[]{entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ()});
+ // CraftBukkit - Moved message to after join
+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ());
+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", new Object[]{entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ()});
WorldData worlddata = worldserver1.getLevelData();
entityplayer.loadGameTypes(nbttagcompound);
@@ -184,6 +223,7 @@
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat()));
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat()));
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
playerconnection.send(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@ -451,7 +455,7 @@
+ if (worldserver1 != null) {
+ Optional optional;
- if (!iblockdata.is((Tag) TagsBlock.BEDS) && !flag3) {
- if (!iblockdata.is(TagsBlock.BEDS) && !flag3) {
- f1 = f;
- } else {
- Vec3D vec3d1 = Vec3D.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
@ -467,7 +471,7 @@
+ Vec3D vec3d = (Vec3D) optional.get();
+ float f1;
+
+ if (!iblockdata.is((Tag) TagsBlock.BEDS) && !flag3) {
+ if (!iblockdata.is(TagsBlock.BEDS) && !flag3) {
+ f1 = f;
+ } else {
+ Vec3D vec3d1 = Vec3D.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
@ -511,12 +515,12 @@
+ // CraftBukkit end
- while (!worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
+ while (avoidSuffocation && !worldserver1.noCollision(entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
+ while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
+ // CraftBukkit start
+ WorldData worlddata = worldserver1.getLevelData();
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeRegistration(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
+ entityplayer1.spawnIn(worldserver1);
+ entityplayer1.unsetRemoved();
+ entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
@ -524,7 +528,7 @@
- WorldData worlddata = entityplayer1.level.getLevelData();
-
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionType(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), flag));
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionTypeRegistration(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), flag));
- entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
+ // entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
entityplayer1.connection.send(new PacketPlayOutSpawnPosition(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
@ -785,5 +789,5 @@
}
+ // CraftBukkit end
this.broadcastAll(new PacketPlayOutTags(this.server.getTags().serializeToNetwork(this.registryHolder)));
this.broadcastAll(new PacketPlayOutTags(TagNetworkSerialization.serializeTagsToNetwork(this.registryHolder)));
PacketPlayOutRecipeUpdate packetplayoutrecipeupdate = new PacketPlayOutRecipeUpdate(this.server.getRecipeManager().getRecipes());

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/stats/RecipeBookServer.java
+++ b/net/minecraft/stats/RecipeBookServer.java
@@ -20,6 +20,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.item.crafting.IRecipe;
import org.slf4j.Logger;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
@@ -391,6 +391,18 @@
@@ -395,6 +395,18 @@
datafixerbuilder.addFixer(new DataConverterItemFrame(schema46, false));
Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
@ -19,30 +19,30 @@
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema47, false));
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema47, false));
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema47, false));
@@ -704,12 +716,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);
@@ -711,12 +723,14 @@
datafixerbuilder.addFixer(new DataConverterAddChoices(schema131, "Added Glow Squid", DataConverterTypes.ENTITY));
datafixerbuilder.addFixer(new DataConverterAddChoices(schema131, "Added Glow Item Frame", DataConverterTypes.ENTITY));
Schema schema132 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap = ImmutableMap.builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
+ // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap = ImmutableMap.<String, String>builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema131, "Renamed copper block items to new oxidized terms", createRenamer(immutablemap)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema131, "Renamed copper blocks to new oxidized terms", createRenamer(immutablemap)));
Schema schema132 = datafixerbuilder.addSchema(2691, DataConverterRegistry.SAME_NAMESPACED);
datafixerbuilder.addFixer(DataConverterItemName.create(schema132, "Renamed copper block items to new oxidized terms", createRenamer(immutablemap)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema132, "Renamed copper blocks to new oxidized terms", createRenamer(immutablemap)));
Schema schema133 = datafixerbuilder.addSchema(2691, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap1 = ImmutableMap.builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
+ // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap1 = ImmutableMap.<String, String>builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema132, "Rename copper item suffixes", createRenamer(immutablemap1)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema132, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
@@ -717,7 +731,8 @@
datafixerbuilder.addFixer(DataConverterItemName.create(schema133, "Rename copper item suffixes", createRenamer(immutablemap1)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema133, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
@@ -724,7 +738,8 @@
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema133, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
Schema schema134 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema134, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
Schema schema135 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap2 = ImmutableMap.builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
+ // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap2 = ImmutableMap.<String, String>builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema134, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema134, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
datafixerbuilder.addFixer(DataConverterItemName.create(schema135, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema135, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
@@ -38,6 +38,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.storage.WorldPersistentData;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.dimension.WorldDimension;
@ -10,7 +10,7 @@
+
public class WorldUpgrader {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -53,7 +57,7 @@
private volatile int totalChunks;
private volatile int converted;

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -116,8 +116,64 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -119,8 +119,64 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.dimension.WorldDimension;
@ -62,10 +62,10 @@
+ }
+ // CraftBukkit end
+
protected static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -228,6 +284,24 @@
@@ -231,6 +287,24 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@ -90,7 +90,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -365,6 +439,12 @@
@@ -369,6 +443,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@ -103,7 +103,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -381,6 +461,33 @@
@@ -385,6 +465,33 @@
}
protected void setRot(float f, float f1) {
@ -137,7 +137,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -422,6 +529,15 @@
@@ -426,6 +533,15 @@
this.baseTick();
}
@ -153,7 +153,7 @@
public void baseTick() {
this.level.getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -436,7 +552,7 @@
@@ -440,7 +556,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@ -162,7 +162,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -471,6 +587,10 @@
@@ -475,6 +591,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@ -173,7 +173,7 @@
}
this.checkOutOfWorld();
@@ -514,15 +634,48 @@
@@ -518,15 +638,48 @@
public void lavaHurt() {
if (!this.fireImmune()) {
@ -223,7 +223,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -627,6 +780,28 @@
@@ -640,6 +793,28 @@
block.updateEntityAfterFallOn(this.level, this);
}
@ -252,7 +252,7 @@
if (this.onGround && !this.isSteppingCarefully()) {
block.stepOn(this.level, blockposition, iblockdata, this);
}
@@ -1260,6 +1435,7 @@
@@ -1265,6 +1440,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@ -260,7 +260,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1450,6 +1626,12 @@
@@ -1455,6 +1631,12 @@
return false;
}
@ -273,7 +273,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1483,7 +1665,7 @@
@@ -1488,7 +1670,7 @@
} else {
String s = this.getEncodeId();
@ -282,7 +282,7 @@
return false;
} else {
nbttagcompound.putString("id", s);
@@ -1508,6 +1690,18 @@
@@ -1513,6 +1695,18 @@
Vec3D vec3d = this.getDeltaMovement();
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
@ -301,7 +301,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1516,6 +1710,22 @@
@@ -1521,6 +1715,22 @@
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
nbttagcompound.putUUID("UUID", this.getUUID());
@ -324,7 +324,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1583,6 +1793,11 @@
@@ -1588,6 +1798,11 @@
}
}
@ -336,7 +336,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1664,6 +1879,53 @@
@@ -1669,6 +1884,53 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@ -390,7 +390,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1739,9 +2001,22 @@
@@ -1744,9 +2006,22 @@
} else if (this.level.isClientSide) {
return null;
} else {
@ -413,7 +413,7 @@
this.level.addFreshEntity(entityitem);
return entityitem;
}
@@ -1836,7 +2111,7 @@
@@ -1840,7 +2115,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@ -422,7 +422,7 @@
entity.getIndirectPassengersStream().filter((entity2) -> {
return entity2 instanceof EntityPlayer;
}).forEach((entity2) -> {
@@ -1867,7 +2142,7 @@
@@ -1871,7 +2146,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@ -431,7 +431,7 @@
}
}
@@ -1876,10 +2151,31 @@
@@ -1880,10 +2155,31 @@
this.removeVehicle();
}
@ -464,7 +464,7 @@
if (this.passengers.isEmpty()) {
this.passengers = ImmutableList.of(entity);
} else {
@@ -1895,12 +2191,32 @@
@@ -1899,12 +2195,32 @@
}
}
@ -498,7 +498,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -1911,6 +2227,7 @@
@@ -1915,6 +2231,7 @@
entity.boardingCooldown = 60;
}
@ -506,7 +506,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -1961,14 +2278,20 @@
@@ -1977,14 +2294,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@ -530,7 +530,7 @@
this.level.getProfiler().pop();
}
@@ -2086,6 +2409,13 @@
@@ -2102,6 +2425,13 @@
}
public void setSwimming(boolean flag) {
@ -544,7 +544,7 @@
this.setSharedFlag(4, flag);
}
@@ -2134,8 +2464,12 @@
@@ -2150,8 +2480,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@ -558,7 +558,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2154,7 +2488,7 @@
@@ -2170,7 +2504,7 @@
}
public int getMaxAirSupply() {
@ -567,7 +567,7 @@
}
public int getAirSupply() {
@@ -2162,7 +2496,18 @@
@@ -2178,7 +2512,18 @@
}
public void setAirSupply(int i) {
@ -587,7 +587,7 @@
}
public int getTicksFrozen() {
@@ -2189,11 +2534,41 @@
@@ -2205,11 +2550,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@ -631,7 +631,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2349,15 +2724,38 @@
@@ -2365,15 +2740,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@ -672,7 +672,7 @@
this.level.getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2366,9 +2764,17 @@
@@ -2382,9 +2780,17 @@
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
worldserver.addDuringTeleport(entity);
@ -692,7 +692,7 @@
}
this.removeAfterChangingDimensions();
@@ -2389,20 +2795,34 @@
@@ -2405,20 +2811,34 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@ -732,7 +732,7 @@
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2419,8 +2839,8 @@
@@ -2435,8 +2855,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@ -743,7 +743,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2430,8 +2850,15 @@
@@ -2446,8 +2866,15 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
@ -760,7 +760,7 @@
}
}
@@ -2439,8 +2866,23 @@
@@ -2455,8 +2882,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@ -786,7 +786,7 @@
}
public boolean canChangeDimensions() {
@@ -2649,7 +3091,26 @@
@@ -2665,7 +3107,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@ -814,12 +814,12 @@
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -2933,6 +3394,11 @@
@@ -2949,6 +3410,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}
+ // CraftBukkit start - store last lava contact location
+ if (tag == TagsFluid.LAVA) {
+ if (tagkey == TagsFluid.LAVA) {
+ this.lastLavaContact = blockposition_mutableblockposition.immutable();
+ }
+ // CraftBukkit end

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
@@ -32,6 +32,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.level.material.EnumPistonReaction;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.resources.MinecraftKey;
@ -12,7 +12,7 @@
+
public class EntityAreaEffectCloud extends Entity {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -127,6 +133,22 @@
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
@@ -21,6 +21,12 @@
@@ -20,6 +20,12 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@ -13,7 +13,7 @@
public class EntityExperienceOrb extends Entity {
private static final int LIFETIME = 6000;
@@ -59,6 +65,7 @@
@@ -58,6 +64,7 @@
@Override
public void tick() {
super.tick();
@ -21,7 +21,7 @@
this.xo = this.getX();
this.yo = this.getY();
this.zo = this.getZ();
@@ -84,7 +91,22 @@
@@ -83,7 +90,22 @@
this.followingPlayer = null;
}
@ -45,7 +45,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();
@@ -225,7 +247,7 @@
@@ -226,7 +248,7 @@
int i = this.repairPlayerItems(entityhuman, this.value);
if (i > 0) {
@ -54,7 +54,7 @@
}
--this.count;
@@ -243,9 +265,17 @@
@@ -244,9 +266,17 @@
if (entry != null) {
ItemStack itemstack = (ItemStack) entry.getValue();
int j = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue());
@ -72,7 +72,7 @@
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
} else {
@@ -270,6 +300,24 @@
@@ -271,6 +301,24 @@
}
public static int getExperienceValue(int i) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/EntityLiving.java
+++ b/net/minecraft/world/entity/EntityLiving.java
@@ -116,6 +116,30 @@
@@ -117,6 +117,30 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.ArrayList;
@ -30,8 +30,8 @@
+
public abstract class EntityLiving extends Entity {
private static final UUID SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -224,6 +248,20 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -226,6 +250,20 @@
private float swimAmount;
private float swimAmountO;
protected BehaviorController<?> brain;
@ -52,7 +52,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -236,7 +274,9 @@
@@ -238,7 +276,9 @@
this.useItem = ItemStack.EMPTY;
this.lastClimbablePos = Optional.empty();
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
@ -63,7 +63,7 @@
this.blocksBuilding = true;
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.reapplyPosition();
@@ -303,7 +343,13 @@
@@ -305,7 +345,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@ -78,7 +78,7 @@
}
}
@@ -561,7 +607,7 @@
@@ -563,7 +609,7 @@
protected void tickDeath() {
++this.deathTime;
@ -87,7 +87,7 @@
this.level.broadcastEntityEvent(this, (byte) 60);
this.remove(Entity.RemovalReason.KILLED);
}
@@ -653,9 +699,15 @@
@@ -655,9 +701,15 @@
}
protected void equipEventAndSound(ItemStack itemstack) {
@ -104,7 +104,7 @@
this.gameEvent(GameEvent.EQUIP);
this.playSound(soundeffect, 1.0F, 1.0F);
}
@@ -717,6 +769,17 @@
@@ -719,6 +771,17 @@
}
}
@ -122,7 +122,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -754,9 +817,32 @@
@@ -756,9 +819,32 @@
}
@ -155,7 +155,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -766,6 +852,12 @@
@@ -768,6 +854,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level.isClientSide) {
@ -168,7 +168,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -776,6 +868,17 @@
@@ -778,6 +870,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@ -186,7 +186,7 @@
if (this.effectsDirty) {
if (!this.level.isClientSide) {
@@ -902,7 +1005,13 @@
@@ -904,7 +1007,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
}
@ -200,7 +200,7 @@
if (this.level.isClientSide) {
return false;
} else {
@@ -911,7 +1020,14 @@
@@ -913,7 +1022,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@ -216,7 +216,7 @@
iterator.remove();
}
@@ -940,18 +1056,48 @@
@@ -942,18 +1058,48 @@
return this.addEffect(mobeffect, (Entity) null);
}
@ -266,7 +266,7 @@
return true;
} else {
return false;
@@ -988,13 +1134,39 @@
@@ -990,13 +1136,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@ -307,7 +307,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1031,20 +1203,55 @@
@@ -1033,20 +1205,55 @@
}
@ -364,7 +364,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1058,7 +1265,7 @@
@@ -1060,7 +1267,7 @@
return false;
} else if (this.level.isClientSide) {
return false;
@ -373,7 +373,7 @@
return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1069,10 +1276,11 @@
@@ -1071,10 +1278,11 @@
this.noActionTime = 0;
float f1 = f;
@ -387,7 +387,7 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1090,27 +1298,46 @@
@@ -1092,27 +1300,46 @@
this.animationSpeed = 1.5F;
boolean flag1 = true;
@ -439,7 +439,7 @@
this.hurtDir = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -1233,19 +1460,29 @@
@@ -1235,19 +1462,29 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@ -473,7 +473,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1253,14 +1490,16 @@
@@ -1255,14 +1492,16 @@
}
this.setHealth(1.0F);
@ -495,7 +495,7 @@
}
}
@@ -1365,14 +1604,22 @@
@@ -1367,14 +1606,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
@ -520,7 +520,7 @@
this.level.addFreshEntity(entityitem);
}
}
@@ -1392,21 +1639,40 @@
@@ -1394,21 +1641,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@ -564,7 +564,7 @@
}
@@ -1526,9 +1792,14 @@
@@ -1528,9 +1794,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@ -580,7 +580,7 @@
return true;
} else {
return flag;
@@ -1577,7 +1848,7 @@
@@ -1579,7 +1850,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.isBypassArmor()) {
@ -589,7 +589,7 @@
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1590,7 +1861,8 @@
@@ -1592,7 +1863,8 @@
} else {
int i;
@ -599,7 +599,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1621,29 +1893,172 @@
@@ -1623,29 +1895,172 @@
}
}
@ -782,7 +782,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1664,8 +2079,18 @@
@@ -1666,8 +2081,18 @@
}
public final void setArrowCount(int i) {
@ -802,7 +802,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -1961,6 +2386,12 @@
@@ -1963,6 +2388,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@ -815,7 +815,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2204,6 +2635,7 @@
@@ -2206,6 +2637,7 @@
}
if (this.onGround && !this.level.isClientSide) {
@ -823,7 +823,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2734,6 +3166,7 @@
@@ -2736,6 +3168,7 @@
}
if (!this.level.isClientSide) {
@ -831,7 +831,7 @@
this.setSharedFlag(7, flag);
}
@@ -2901,14 +3334,21 @@
@@ -2895,14 +3328,21 @@
@Override
public boolean isPickable() {
@ -853,9 +853,9 @@
+ // CraftBukkit end
+
@Override
protected void markHurt() {
this.hurtMarked = this.random.nextDouble() >= this.getAttributeValue(GenericAttributes.KNOCKBACK_RESISTANCE);
@@ -3107,7 +3547,25 @@
public float getYHeadRot() {
return this.yHeadRot;
@@ -3096,7 +3536,25 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@ -882,7 +882,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3180,6 +3638,12 @@
@@ -3169,6 +3627,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@ -895,7 +895,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3204,16 +3668,41 @@
@@ -3193,16 +3657,41 @@
}
if (flag2) {
@ -940,7 +940,7 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3223,7 +3712,7 @@
@@ -3212,7 +3701,7 @@
((EntityCreature) this).getNavigation().stop();
}
@ -949,7 +949,7 @@
}
}
@@ -3306,7 +3795,7 @@
@@ -3295,7 +3784,7 @@
}
public void stopSleeping() {
@ -958,7 +958,7 @@
World world = this.level;
java.util.Objects.requireNonNull(this.level);
@@ -3338,7 +3827,7 @@
@@ -3327,7 +3816,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@ -967,7 +967,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
}
@@ -3387,7 +3876,7 @@
@@ -3376,7 +3865,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
@ -976,7 +976,7 @@
}
}
}
@@ -3490,8 +3979,10 @@
@@ -3479,8 +3968,10 @@
this.setDeltaMovement((double) ((float) packetplayoutspawnentityliving.getXd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getYd() / 8000.0F), (double) ((float) packetplayoutspawnentityliving.getZd() / 8000.0F));
}
@ -988,7 +988,7 @@
private final SoundEffect small;
private final SoundEffect big;
@@ -3507,5 +3998,7 @@
@@ -3496,5 +3987,7 @@
public SoundEffect big() {
return this.big;
}

Datei anzeigen

@ -1,15 +1,15 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -152,7 +152,7 @@
private static final Logger LOGGER = LogManager.getLogger();
@@ -154,7 +154,7 @@
public static final String ENTITY_TAG = "EntityTag";
private final Holder.c<EntityTypes<?>> builtInRegistryHolder;
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).clientTrackingRange(10));
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20));
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
@@ -282,8 +282,8 @@
@@ -284,8 +284,8 @@
private MinecraftKey lootTable;
private final EntitySize dimensions;
@ -20,7 +20,7 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -314,10 +314,18 @@
@@ -317,10 +317,18 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@ -40,7 +40,7 @@
}
return t0;
@@ -353,7 +361,7 @@
@@ -356,7 +364,7 @@
t0.setCustomName(ichatbasecomponent);
}
@ -49,7 +49,7 @@
return t0;
}
}
@@ -510,7 +518,7 @@
@@ -513,7 +521,7 @@
}
return entity;
@ -58,7 +58,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -567,7 +575,7 @@
@@ -570,7 +578,7 @@
@Nullable
public T tryCast(Entity entity) {
@ -67,7 +67,7 @@
}
@Override
@@ -594,7 +602,7 @@
@@ -603,7 +611,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
@@ -13,6 +13,12 @@
@@ -12,6 +12,12 @@
import net.minecraft.world.entity.npc.EntityVillager;
import net.minecraft.world.entity.npc.VillagerProfession;
@ -13,7 +13,7 @@
public class BehaviorCareer extends Behavior<EntityVillager> {
public BehaviorCareer() {
@@ -29,7 +35,7 @@
@@ -28,7 +34,7 @@
GlobalPos globalpos = (GlobalPos) entityvillager.getBrain().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
entityvillager.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
@ -22,7 +22,7 @@
worldserver.broadcastEntityEvent(entityvillager, (byte) 14);
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
MinecraftServer minecraftserver = worldserver.getServer();
@@ -41,7 +47,14 @@
@@ -40,7 +46,14 @@
return villagerprofession.getJobPoiType() == villageplacetype;
}).findFirst();
}).ifPresent((villagerprofession) -> {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
@@ -80,8 +80,8 @@
@@ -79,8 +79,8 @@
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
@ -11,7 +11,7 @@
}
}
@@ -101,7 +101,11 @@
@@ -100,7 +100,11 @@
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
@ -24,7 +24,7 @@
}
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
@@ -112,19 +116,28 @@
@@ -111,19 +115,28 @@
boolean flag = false;
if (!itemstack.isEmpty()) {
@ -57,7 +57,7 @@
}
if (flag) {
@@ -143,8 +156,8 @@
@@ -142,8 +155,8 @@
this.aboveFarmlandPos = this.getValidFarmland(worldserver);
if (this.aboveFarmlandPos != null) {
this.nextOkStartTime = i + 20L;

Datei anzeigen

@ -14,7 +14,7 @@
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
}
@@ -82,6 +89,13 @@
@@ -84,6 +91,13 @@
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
if (!blockdoor1.isOpen(iblockdata1)) {
@ -28,7 +28,7 @@
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
this.rememberDoorToClose(worldserver, entityliving, blockposition1);
}
@@ -130,7 +144,7 @@
@@ -134,7 +148,7 @@
private static boolean areOtherMobsComingThroughDoor(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
BehaviorController<?> behaviorcontroller = entityliving.getBrain();
@ -36,8 +36,8 @@
+ return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
return entityliving1.getType() == entityliving.getType();
}).filter((entityliving1) -> {
return blockposition.closerThan((IPosition) entityliving1.position(), 2.0D);
@@ -172,7 +186,7 @@
return blockposition.closerToCenterThan(entityliving1.position(), 2.0D);
@@ -176,7 +190,7 @@
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
} else {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalBreakDoor.java
@@ -72,6 +72,12 @@
@@ -71,6 +71,12 @@
}
if (this.breakTime == this.getDoorBreakTime() && this.isValidDifficulty(this.mob.level.getDifficulty())) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalPanic.java
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalPanic.java
@@ -11,6 +11,10 @@
@@ -10,6 +10,10 @@
import net.minecraft.world.level.IBlockAccess;
import net.minecraft.world.phys.Vec3D;
@ -11,7 +11,7 @@
public class PathfinderGoalPanic extends PathfinderGoal {
public static final int WATER_CHECK_DISTANCE_VERTICAL = 1;
@@ -77,6 +81,12 @@
@@ -80,6 +84,12 @@
@Override
public boolean canContinueToUse() {
@ -24,10 +24,10 @@
return !this.mob.getNavigation().isDone();
}
@@ -86,6 +96,6 @@
@@ -89,6 +99,6 @@
return !iblockaccess.getBlockState(blockposition).getCollisionShape(iblockaccess, blockposition).isEmpty() ? null : (BlockPosition) BlockPosition.findClosestMatch(entity.blockPosition(), i, 1, (blockposition1) -> {
return iblockaccess.getFluidState(blockposition1).is((Tag) TagsFluid.WATER);
return iblockaccess.getFluidState(blockposition1).is(TagsFluid.WATER);
- }).orElse((Object) null);
+ }).orElse(null); // CraftBukkit - decompile error
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ambient/EntityBat.java
+++ b/net/minecraft/world/entity/ambient/EntityBat.java
@@ -29,6 +29,8 @@
@@ -28,6 +28,8 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@ -9,7 +9,7 @@
public class EntityBat extends EntityAmbient {
public static final float FLAP_DEGREES_PER_TICK = 74.48451F;
@@ -138,16 +140,24 @@
@@ -137,16 +139,24 @@
}
if (this.level.getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
@ -39,7 +39,7 @@
}
} else {
if (this.targetPosition != null && (!this.level.isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
@@ -171,7 +181,11 @@
@@ -170,7 +180,11 @@
this.zza = 0.5F;
this.setYRot(this.getYRot() + f1);
if (this.random.nextInt(100) == 0 && this.level.getBlockState(blockposition1).isRedstoneConductor(this.level, blockposition1)) {
@ -52,7 +52,7 @@
}
}
@@ -201,7 +215,11 @@
@@ -200,7 +214,11 @@
return false;
} else {
if (!this.level.isClientSide && this.isResting()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
@@ -31,12 +31,19 @@
@@ -30,12 +30,19 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.pathfinder.PathType;
@ -20,7 +20,7 @@
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
super(entitytypes, world);
@@ -73,6 +80,9 @@
@@ -72,6 +79,9 @@
}
@ -30,7 +30,7 @@
@Override
public boolean hurt(DamageSource damagesource, float f) {
if (this.isInvulnerableTo(damagesource)) {
@@ -82,6 +92,7 @@
@@ -81,6 +91,7 @@
return super.hurt(damagesource, f);
}
}
@ -38,7 +38,7 @@
@Override
public float getWalkTargetValue(BlockPosition blockposition, IWorldReader iworldreader) {
@@ -178,10 +189,17 @@
@@ -177,10 +188,17 @@
}
public void setInLove(@Nullable EntityHuman entityhuman) {
@ -57,7 +57,7 @@
this.level.broadcastEntityEvent(this, (byte) 18);
}
@@ -221,11 +239,26 @@
@@ -220,11 +238,26 @@
EntityAgeable entityageable = this.getBreedOffspring(worldserver, entityanimal);
if (entityageable != null) {
@ -84,7 +84,7 @@
if (entityplayer != null) {
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
@@ -236,12 +269,14 @@
@@ -235,12 +268,14 @@
entityanimal.setAge(6000);
this.resetLove();
entityanimal.resetLove();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityBee.java
+++ b/net/minecraft/world/entity/animal/EntityBee.java
@@ -244,7 +244,7 @@
@@ -242,7 +242,7 @@
}
if (b0 > 0) {
@ -9,7 +9,7 @@
}
}
@@ -644,11 +644,15 @@
@@ -642,11 +642,15 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@ -27,7 +27,7 @@
}
}
@@ -1224,7 +1228,7 @@
@@ -1222,7 +1226,7 @@
}
}
@ -36,7 +36,7 @@
EntityBee.this.level.levelEvent(2005, blockposition, 0);
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1297,7 +1301,7 @@
@@ -1295,7 +1299,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@ -45,7 +45,7 @@
}
}
@@ -1306,7 +1310,7 @@
@@ -1304,7 +1308,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -434,7 +434,7 @@
@@ -443,7 +443,7 @@
}
} else if (this.isFood(itemstack)) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
@ -9,7 +9,7 @@
this.tame(entityhuman);
this.setOrderedToSit(true);
this.level.broadcastEntityEvent(this, (byte) 7);
@@ -491,7 +491,7 @@
@@ -500,7 +500,7 @@
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable
@ -18,7 +18,7 @@
private final EntityCat cat;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -632,7 +632,15 @@
@@ -641,7 +641,15 @@
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
@ -35,7 +35,7 @@
}
}
@@ -664,10 +672,10 @@
@@ -673,10 +681,10 @@
private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
@@ -65,6 +65,12 @@
@@ -63,6 +63,12 @@
public class EntityDolphin extends EntityWaterAnimal {
@ -13,7 +13,7 @@
private static final DataWatcherObject<BlockPosition> TREASURE_POS = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BLOCK_POS);
private static final DataWatcherObject<Boolean> GOT_FISH = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BOOLEAN);
private static final DataWatcherObject<Integer> MOISTNESS_LEVEL = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.INT);
@@ -192,7 +198,7 @@
@@ -190,7 +196,7 @@
@Override
public int getMaxAirSupply() {
@ -22,7 +22,7 @@
}
@Override
@@ -233,6 +239,12 @@
@@ -231,6 +237,12 @@
ItemStack itemstack = entityitem.getItem();
if (this.canHoldItem(itemstack)) {
@ -35,7 +35,7 @@
this.onItemPickup(entityitem);
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
this.handDropChances[EnumItemSlot.MAINHAND.getIndex()] = 2.0F;
@@ -391,7 +403,7 @@
@@ -389,7 +401,7 @@
@Override
public boolean canUse() {
@ -44,7 +44,7 @@
}
@Override
@@ -501,7 +513,7 @@
@@ -489,7 +501,7 @@
@Override
public void start() {
@ -53,7 +53,7 @@
}
@Override
@@ -520,7 +532,7 @@
@@ -508,7 +520,7 @@
}
if (this.player.isSwimming() && this.player.level.random.nextInt(6) == 0) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -507,7 +507,8 @@
@@ -509,7 +509,8 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@ -10,7 +10,7 @@
int i = itemstack.getCount();
if (i > 1) {
@@ -862,6 +863,16 @@
@@ -864,6 +865,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID());
}
@ -27,7 +27,7 @@
if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -872,12 +883,14 @@
@@ -874,12 +885,14 @@
this.partner.setAge(6000);
this.animal.resetLove();
this.partner.resetLove();
@ -46,7 +46,7 @@
}
}
@@ -1268,13 +1281,18 @@
@@ -1270,13 +1283,18 @@
}
private void pickGlowBerry(IBlockData iblockdata) {
@ -66,7 +66,7 @@
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1431,7 +1449,7 @@
@@ -1433,7 +1451,7 @@
private EntityLiving trustedLastHurt;
private int timestamp;

Datei anzeigen

@ -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 org.apache.commons.lang3.tuple.Pair;
@ -14,7 +14,7 @@
public class EntityMushroomCow extends EntityCow implements IShearable {
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
@@ -117,6 +124,11 @@
@@ -116,6 +123,11 @@
this.playSound(soundeffect, 1.0F, 1.0F);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@ -26,7 +26,7 @@
this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, (Entity) entityhuman);
if (!this.level.isClientSide) {
@@ -164,7 +176,7 @@
@@ -163,7 +175,7 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.MOOSHROOM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) {
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
@ -35,7 +35,7 @@
EntityCow entitycow = (EntityCow) EntityTypes.COW.create(this.level);
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
@@ -180,10 +192,25 @@
@@ -179,10 +191,25 @@
}
entitycow.setInvulnerable(this.isInvulnerable());

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -134,7 +134,7 @@
@@ -133,7 +133,7 @@
@Override
public boolean removeWhenFarAway(double d0) {
@ -9,7 +9,7 @@
}
public static AttributeProvider.Builder createAttributes() {
@@ -183,7 +183,8 @@
@@ -182,7 +182,8 @@
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
this.usePlayerItem(entityhuman, enumhand, itemstack);
if (!this.level.isClientSide) {
@ -19,7 +19,7 @@
this.setTrusting(true);
this.spawnTrustingParticles(true);
this.level.broadcastEntityEvent(this, (byte) 41);
@@ -313,10 +314,10 @@
@@ -312,10 +313,10 @@
private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

Datei anzeigen

@ -18,7 +18,7 @@
this.onItemPickup(entityitem);
ItemStack itemstack = entityitem.getItem();
@@ -882,10 +884,10 @@
@@ -872,10 +874,10 @@
private final EntityPanda panda;
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
@ -32,7 +32,7 @@
this.panda = entitypanda;
}
@@ -1132,7 +1134,7 @@
@@ -1114,7 +1116,7 @@
@Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
@@ -258,7 +258,7 @@
@@ -256,7 +256,7 @@
}
if (!this.level.isClientSide) {
@ -9,7 +9,7 @@
this.tame(entityhuman);
this.level.broadcastEntityEvent(this, (byte) 7);
} else {
@@ -272,7 +272,7 @@
@@ -270,7 +270,7 @@
itemstack.shrink(1);
}
@ -18,7 +18,7 @@
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -384,7 +384,7 @@
@@ -382,7 +382,7 @@
@Override
public boolean isPushable() {
@ -27,12 +27,12 @@
}
@Override
@@ -399,7 +399,7 @@
if (this.isInvulnerableTo(damagesource)) {
@@ -398,7 +398,7 @@
return false;
} else {
- this.setOrderedToSit(false);
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
if (!this.level.isClientSide) {
- this.setOrderedToSit(false);
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
}
return super.hurt(damagesource, f);
}
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
@@ -88,8 +88,14 @@
@@ -89,8 +89,14 @@
super(entitytypes, world);
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
@ -15,7 +15,7 @@
@Override
public void registerGoals() {
@@ -556,9 +562,23 @@
@@ -558,9 +564,23 @@
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
if (i == 0) {

Datei anzeigen

@ -12,7 +12,7 @@
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -103,7 +107,7 @@
BiomeBase biomebase = this.level.getBiome(blockposition);
BiomeBase biomebase = (BiomeBase) this.level.getBiome(blockposition).value();
if (biomebase.shouldSnowGolemBurn(blockposition)) {
- this.hurt(DamageSource.ON_FIRE, 1.0F);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -311,7 +311,9 @@
@@ -309,7 +309,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@ -10,7 +10,7 @@
}
}
@@ -338,7 +340,9 @@
@@ -336,7 +338,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
@ -20,7 +20,7 @@
}
private static class e extends ControllerMove {
@@ -484,8 +488,12 @@
@@ -482,8 +486,12 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level;

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/animal/EntityWolf.java
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
@@ -68,6 +68,11 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -69,6 +69,11 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
@ -12,7 +12,7 @@
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable {
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
@@ -122,6 +127,24 @@
@@ -126,6 +131,24 @@
return EntityInsentient.createMobAttributes().add(GenericAttributes.MOVEMENT_SPEED, 0.30000001192092896D).add(GenericAttributes.MAX_HEALTH, 8.0D).add(GenericAttributes.ATTACK_DAMAGE, 2.0D);
}
@ -37,16 +37,16 @@
@Override
protected void defineSynchedData() {
super.defineSynchedData();
@@ -293,7 +316,7 @@
} else {
@@ -298,7 +321,7 @@
Entity entity = damagesource.getEntity();
- this.setOrderedToSit(false);
+ // this.setWillSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
f = (f + 1.0F) / 2.0F;
if (!this.level.isClientSide) {
- this.setOrderedToSit(false);
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
}
@@ -318,7 +341,7 @@
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
@@ -325,7 +348,7 @@
super.setTame(flag);
if (flag) {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(20.0D);
@ -55,7 +55,7 @@
} else {
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
}
@@ -342,7 +365,7 @@
@@ -349,7 +372,7 @@
itemstack.shrink(1);
}
@ -64,7 +64,7 @@
this.gameEvent(GameEvent.MOB_INTERACT, this.eyeBlockPosition());
return EnumInteractionResult.SUCCESS;
}
@@ -354,7 +377,7 @@
@@ -361,7 +384,7 @@
this.setOrderedToSit(!this.isOrderedToSit());
this.jumping = false;
this.navigation.stop();
@ -73,7 +73,7 @@
return EnumInteractionResult.SUCCESS;
}
@@ -376,7 +399,8 @@
@@ -383,7 +406,8 @@
itemstack.shrink(1);
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -67,9 +67,16 @@
@@ -68,10 +68,17 @@
public class Axolotl extends EntityAnimal implements LerpingModel, Bucketable {
@ -10,6 +10,7 @@
+ return AXOLOTL_TOTAL_AIR_SUPPLY;
+ }
+ // CraftBukkit end
private static final Logger LOGGER = LogUtils.getLogger();
public static final int TOTAL_PLAYDEAD_TIME = 200;
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super Axolotl>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.AXOLOTL_ATTACKABLES, SensorType.AXOLOTL_TEMPTATIONS);
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN});
@ -18,7 +19,7 @@
private static final DataWatcherObject<Integer> DATA_VARIANT = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.INT);
private static final DataWatcherObject<Boolean> DATA_PLAYING_DEAD = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
private static final DataWatcherObject<Boolean> FROM_BUCKET = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
@@ -185,7 +192,7 @@
@@ -187,7 +194,7 @@
@Override
public int getMaxAirSupply() {
@ -27,7 +28,7 @@
}
public Axolotl.Variant getVariant() {
@@ -236,6 +243,7 @@
@@ -238,6 +245,7 @@
@Override
public void setFromBucket(boolean flag) {
this.entityData.set(Axolotl.FROM_BUCKET, flag);
@ -35,7 +36,7 @@
}
@Nullable
@@ -419,7 +427,7 @@
@@ -428,7 +436,7 @@
if (i < 2400) {
i = Math.min(2400, 100 + i);
@ -44,7 +45,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -469,7 +477,7 @@
@@ -478,7 +486,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {
@ -53,7 +54,7 @@
}
@Override
@@ -502,7 +510,7 @@
@@ -511,7 +519,7 @@
@Override
public boolean removeWhenFarAway(double d0) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -52,6 +52,11 @@
import net.minecraft.world.level.pathfinder.Pathfinder;
import net.minecraft.world.level.pathfinder.PathfinderNormal;
@@ -45,6 +45,11 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.pathfinder.PathType;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -12,7 +12,7 @@
public class Goat extends EntityAnimal {
public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.scalable(0.9F, 1.3F).scale(0.7F);
@@ -139,7 +144,7 @@
@@ -134,7 +139,7 @@
@Override
public BehaviorController<Goat> getBrain() {
@ -21,7 +21,7 @@
}
@Override
@@ -177,8 +182,15 @@
@@ -172,8 +177,15 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/horse/EntityLlama.java
+++ b/net/minecraft/world/entity/animal/horse/EntityLlama.java
@@ -78,6 +78,12 @@
@@ -77,6 +77,12 @@
return false;
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -53,6 +53,18 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -51,6 +51,18 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.item.ItemStack;
@ -18,8 +18,8 @@
+
public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogManager.getLogger();
@@ -89,6 +101,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -87,6 +99,7 @@
private final PathPoint[] nodes = new PathPoint[24];
private final int[] nodeAdjacency = new int[24];
private final Path openSet = new Path();
@ -27,7 +27,7 @@
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world);
@@ -236,7 +249,7 @@
@@ -234,7 +247,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
@ -36,7 +36,7 @@
d0 = vec3d1.x - this.getX();
d1 = vec3d1.y - this.getY();
d2 = vec3d1.z - this.getZ();
@@ -378,7 +391,14 @@
@@ -375,7 +388,14 @@
if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@ -52,7 +52,7 @@
}
}
@@ -453,6 +473,9 @@
@@ -450,6 +470,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false;
boolean flag1 = false;
@ -62,10 +62,10 @@
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
@@ -462,7 +485,11 @@
@@ -459,7 +482,11 @@
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is((Tag) TagsBlock.DRAGON_IMMUNE)) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
- flag1 = this.level.removeBlock(blockposition, false) || flag1;
+ // CraftBukkit start - Add blocks to list rather than destroying them
+ // flag1 = this.level.removeBlock(blockposition, false) || flag1;
@ -75,7 +75,7 @@
} else {
flag = true;
}
@@ -471,6 +498,51 @@
@@ -468,6 +495,51 @@
}
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
+++ b/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerManager.java
@@ -5,6 +5,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftEnderDragon;
@ -11,7 +11,7 @@
+
public class DragonControllerManager {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -24,6 +29,19 @@
this.currentPhase.end();
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
@@ -56,6 +56,17 @@
@@ -55,6 +55,17 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@ -18,7 +18,7 @@
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
@@ -250,16 +261,40 @@
@@ -249,16 +260,40 @@
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
if (i <= 0) {
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
@ -62,7 +62,7 @@
}
} else {
@@ -304,6 +339,7 @@
@@ -303,6 +338,7 @@
if (!list.isEmpty()) {
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
@ -70,7 +70,7 @@
this.setAlternativeTarget(i, entityliving1.getId());
}
}
@@ -334,6 +370,11 @@
@@ -333,6 +369,11 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
if (canDestroy(iblockdata)) {
@ -82,7 +82,7 @@
flag = this.level.destroyBlock(blockposition, true, this) || flag;
}
}
@@ -347,7 +388,7 @@
@@ -346,7 +387,7 @@
}
if (this.tickCount % 20 == 0) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
@@ -25,6 +25,12 @@
@@ -24,6 +24,12 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@ -13,7 +13,7 @@
public class EntityLeash extends EntityHanging {
public static final double OFFSET_Y = 0.375D;
@@ -96,22 +102,42 @@
@@ -95,22 +101,42 @@
while (iterator.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.getLeashHolder() == entityhuman) {

Datei anzeigen

@ -1,24 +1,15 @@
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
@@ -45,6 +45,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
@@ -46,6 +46,8 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class EntityFallingBlock extends Entity {
private static final int REMOVAL_DELAY_MILLIS = 50;
@@ -122,7 +124,7 @@
if (this.time++ == 0) {
blockposition = this.blockPosition();
- if (this.level.getBlockState(blockposition).is(block)) {
+ if (this.level.getBlockState(blockposition).is(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
this.level.removeBlock(blockposition, false);
} else if (!this.level.isClientSide) {
this.discard();
@@ -173,6 +175,12 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -166,6 +168,12 @@
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
}
@ -31,7 +22,7 @@
if (this.level.setBlock(blockposition, this.blockState, 3)) {
((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
this.discard();
@@ -252,7 +260,7 @@
@@ -236,7 +244,7 @@
if (i < 0) {
return false;
} else {
@ -40,7 +31,7 @@
DamageSource damagesource1;
if (this.blockState.getBlock() instanceof Fallable) {
@@ -268,7 +276,9 @@
@@ -252,7 +260,9 @@
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {
@ -48,5 +39,5 @@
entity.hurt(damagesource1, f2);
+ CraftEventFactory.entityDamage = null; // CraftBukkit
});
boolean flag = this.blockState.is((Tag) TagsBlock.ANVIL);
boolean flag = this.blockState.is(TagsBlock.ANVIL);

Datei anzeigen

@ -75,9 +75,9 @@
merge(entityitem, itemstack, itemstack1);
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
entityitem.age = Math.min(entityitem.age, entityitem1.age);
@@ -263,6 +282,11 @@
} else if (!this.getItem().getItem().canBeHurtBy(damagesource)) {
return false;
@@ -265,6 +284,11 @@
} else if (this.level.isClientSide) {
return true;
} else {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
@ -87,7 +87,7 @@
this.markHurt();
this.health = (int) ((float) this.health - f);
this.gameEvent(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
@@ -326,6 +350,46 @@
@@ -328,6 +352,46 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();
@ -134,7 +134,7 @@
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
entityhuman.take(this, i);
if (itemstack.isEmpty()) {
@@ -369,7 +433,9 @@
@@ -371,7 +435,9 @@
}
public void setItem(ItemStack itemstack) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
@@ -110,7 +110,17 @@
@@ -109,7 +109,17 @@
@Override
public void setTarget(@Nullable EntityLiving entityliving) {
@ -19,7 +19,7 @@
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
@@ -125,6 +135,7 @@
@@ -124,6 +134,7 @@
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
}
}
@ -27,7 +27,7 @@
}
@@ -471,9 +482,13 @@
@@ -470,9 +481,13 @@
if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
@ -41,10 +41,10 @@
}
}
@@ -512,9 +527,13 @@
@@ -511,9 +526,13 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
- world.removeBlock(blockposition, false);
- world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
- this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySilverfish.java
+++ b/net/minecraft/world/entity/monster/EntitySilverfish.java
@@ -173,6 +173,11 @@
@@ -175,6 +175,11 @@
Block block = iblockdata.getBlock();
if (block instanceof BlockMonsterEggs) {
@ -12,7 +12,7 @@
if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
world.destroyBlock(blockposition1, true, this.silverfish);
} else {
@@ -242,6 +247,11 @@
@@ -244,6 +249,11 @@
IBlockData iblockdata = world.getBlockState(blockposition);
if (BlockMonsterEggs.isCompatibleHostBlock(iblockdata)) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySlime.java
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
@@ -45,6 +45,14 @@
@@ -43,6 +43,14 @@
import net.minecraft.world.level.storage.loot.LootTables;
import net.minecraft.world.phys.Vec3D;
@ -15,7 +15,7 @@
public class EntitySlime extends EntityInsentient implements IMonster {
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
@@ -186,7 +194,7 @@
@@ -184,7 +192,7 @@
@Override
public EntityTypes<? extends EntitySlime> getType() {
@ -24,7 +24,7 @@
}
@Override
@@ -200,6 +208,19 @@
@@ -198,6 +206,19 @@
int j = i / 2;
int k = 2 + this.random.nextInt(3);
@ -44,7 +44,7 @@
for (int l = 0; l < k; ++l) {
float f1 = ((float) (l % 2) - 0.5F) * f;
float f2 = ((float) (l / 2) - 0.5F) * f;
@@ -214,8 +235,18 @@
@@ -212,8 +233,18 @@
entityslime.setInvulnerable(this.isInvulnerable());
entityslime.setSize(j, true);
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
@@ -321,7 +321,13 @@
@@ -320,7 +320,13 @@
IBlockData iblockdata1 = this.getBlockStateOn();
boolean flag = iblockdata.is((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
boolean flag = iblockdata.is(TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is(TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
- this.setSuffocating(!flag);
+ // CraftBukkit start

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
@@ -47,6 +47,13 @@
@@ -48,6 +48,13 @@
import net.minecraft.world.level.gameevent.GameEvent;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
@ -13,8 +13,8 @@
+
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
public static final DataWatcherObject<Boolean> DATA_CONVERTING_ID = DataWatcher.defineId(EntityZombieVillager.class, DataWatcherRegistry.BOOLEAN);
@@ -63,6 +70,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -65,6 +72,7 @@
@Nullable
private NBTTagCompound tradeOffers;
private int villagerXp;
@ -22,7 +22,7 @@
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
super(entitytypes, world);
@@ -79,7 +87,7 @@
@@ -83,7 +91,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@ -31,7 +31,7 @@
Logger logger = EntityZombieVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -135,6 +143,10 @@
@@ -139,6 +147,10 @@
public void tick() {
if (!this.level.isClientSide && this.isAlive() && this.isConverting()) {
int i = this.getConversionProgress();
@ -42,7 +42,7 @@
this.villagerConversionTime -= i;
if (this.villagerConversionTime <= 0) {
@@ -143,6 +155,7 @@
@@ -147,6 +159,7 @@
}
super.tick();
@ -50,7 +50,7 @@
}
@Override
@@ -187,8 +200,11 @@
@@ -191,8 +204,11 @@
this.conversionStarter = uuid;
this.villagerConversionTime = i;
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
@ -64,7 +64,7 @@
this.level.broadcastEntityEvent(this, (byte) 16);
}
@@ -205,7 +221,13 @@
@@ -209,7 +225,13 @@
}
private void finishConversion(WorldServer worldserver) {
@ -79,7 +79,7 @@
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
int i = aenumitemslot.length;
@@ -220,7 +242,9 @@
@@ -224,7 +246,9 @@
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
if (d0 > 1.0D) {
@ -89,7 +89,7 @@
}
}
}
@@ -246,7 +270,7 @@
@@ -250,7 +274,7 @@
}
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/PiglinAI.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAI.java
@@ -72,6 +72,13 @@
@@ -71,6 +71,13 @@
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
import net.minecraft.world.phys.Vec3D;
@ -14,7 +14,7 @@
public class PiglinAI {
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL = 8;
@@ -187,13 +194,13 @@
@@ -186,13 +193,13 @@
protected static void updateActivity(EntityPiglin entitypiglin) {
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBrain();
@ -31,7 +31,7 @@
Objects.requireNonNull(entitypiglin);
optional.ifPresent(entitypiglin::playSound);
@@ -225,23 +232,27 @@
@@ -224,23 +231,27 @@
stopWalking(entitypiglin);
ItemStack itemstack;
@ -63,7 +63,7 @@
if (!flag) {
putInInventory(entitypiglin, itemstack);
@@ -277,9 +288,14 @@
@@ -276,9 +287,14 @@
boolean flag1;
if (entitypiglin.isAdult()) {
@ -80,7 +80,7 @@
} else if (!flag1) {
boolean flag2 = entitypiglin.equipItemIfPossible(itemstack);
@@ -292,7 +308,7 @@
@@ -291,7 +307,7 @@
if (!flag1) {
ItemStack itemstack1 = entitypiglin.getMainHandItem();
@ -89,7 +89,7 @@
putInInventory(entitypiglin, itemstack1);
} else {
throwItems(entitypiglin, Collections.singletonList(itemstack1));
@@ -369,7 +385,7 @@
@@ -368,7 +384,7 @@
return false;
} else if (isAdmiringDisabled(entitypiglin) && entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) {
return false;
@ -98,7 +98,7 @@
return isNotHoldingLovedItemInOffHand(entitypiglin);
} else {
boolean flag = entitypiglin.canAddToInventory(itemstack);
@@ -378,6 +394,12 @@
@@ -377,6 +393,12 @@
}
}
@ -109,9 +109,9 @@
+ // CraftBukkit end
+
protected static boolean isLovedItem(ItemStack itemstack) {
return itemstack.is((Tag) TagsItem.PIGLIN_LOVED);
return itemstack.is(TagsItem.PIGLIN_LOVED);
}
@@ -473,7 +495,7 @@
@@ -472,7 +494,7 @@
}
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
@ -120,7 +120,7 @@
}
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
@@ -740,6 +762,12 @@
@@ -739,6 +761,12 @@
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
}
@ -133,7 +133,7 @@
private static boolean isBarterCurrency(ItemStack itemstack) {
return itemstack.is(PiglinAI.BARTERING_ITEM);
}
@@ -777,7 +805,7 @@
@@ -776,7 +804,7 @@
}
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/npc/EntityVillager.java
+++ b/net/minecraft/world/entity/npc/EntityVillager.java
@@ -89,6 +89,14 @@
@@ -90,6 +90,14 @@
import net.minecraft.world.phys.AxisAlignedBB;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@ -14,8 +14,8 @@
+
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
private static final DataWatcherObject<VillagerData> DATA_VILLAGER_DATA = DataWatcher.defineId(EntityVillager.class, DataWatcherRegistry.VILLAGER_DATA);
@@ -146,7 +154,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -148,7 +156,7 @@
@Override
public BehaviorController<EntityVillager> getBrain() {
@ -24,7 +24,7 @@
}
@Override
@@ -229,7 +237,7 @@
@@ -231,7 +239,7 @@
this.increaseProfessionLevelOnUpdate = false;
}
@ -33,7 +33,7 @@
}
}
@@ -357,7 +365,13 @@
@@ -359,7 +367,13 @@
while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@ -48,7 +48,7 @@
}
this.lastRestockGameTime = this.level.getGameTime();
@@ -415,7 +429,13 @@
@@ -417,7 +431,13 @@
while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@ -63,7 +63,7 @@
}
}
@@ -474,7 +494,7 @@
@@ -476,7 +496,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@ -72,7 +72,7 @@
Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger);
@@ -816,7 +836,12 @@
@@ -818,7 +838,12 @@
}
entitywitch.setPersistenceRequired();
@ -86,7 +86,7 @@
this.releaseAllPois();
this.discard();
} else {
@@ -837,6 +862,13 @@
@@ -839,6 +864,13 @@
return;
}
@ -100,7 +100,7 @@
this.onItemPickup(entityitem);
this.take(entityitem, itemstack.getCount());
ItemStack itemstack1 = inventorysubcontainer.addItem(itemstack);
@@ -949,7 +981,7 @@
@@ -951,7 +983,7 @@
if (entityirongolem != null) {
if (entityirongolem.checkSpawnRules(worldserver, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.checkSpawnObstruction(worldserver)) {
@ -109,7 +109,7 @@
return entityirongolem;
}
@@ -1027,7 +1059,7 @@
@@ -1029,7 +1061,7 @@
@Override
public void startSleeping(BlockPosition blockposition) {
super.startSleeping(blockposition);
@ -118,7 +118,7 @@
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
}
@@ -1035,7 +1067,7 @@
@@ -1037,7 +1069,7 @@
@Override
public void stopSleeping() {
super.stopSleeping();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
@@ -45,6 +45,13 @@
@@ -44,6 +44,13 @@
import net.minecraft.world.level.World;
import net.minecraft.world.phys.Vec3D;
@ -14,7 +14,7 @@
public class EntityVillagerTrader extends EntityVillagerAbstract {
private static final int NUMBER_OF_TRADE_OFFERS = 5;
@@ -54,6 +61,7 @@
@@ -53,6 +60,7 @@
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
super(entitytypes, world);
@ -22,7 +22,7 @@
}
@Override
@@ -131,7 +139,16 @@
@@ -130,7 +138,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
if (merchantrecipe != null) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -111,6 +111,19 @@
@@ -112,6 +112,19 @@
import net.minecraft.world.scores.ScoreboardTeam;
import net.minecraft.world.scores.ScoreboardTeamBase;
@ -20,7 +20,7 @@
public abstract class EntityHuman extends EntityLiving {
public static final String UUID_PREFIX_OFFLINE_PLAYER = "OfflinePlayer:";
@@ -124,7 +137,8 @@
@@ -125,7 +138,8 @@
public static final float SWIMMING_BB_HEIGHT = 0.6F;
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F);
@ -30,7 +30,7 @@
private static final int FLY_ACHIEVEMENT_SPEED = 25;
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);
@@ -134,10 +148,10 @@
@@ -135,10 +149,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this);
@ -43,7 +43,7 @@
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -164,6 +178,16 @@
@@ -165,6 +179,16 @@
@Nullable
public EntityFishingHook fishing;
@ -60,7 +60,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -302,7 +326,7 @@
@@ -303,7 +327,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@ -69,7 +69,7 @@
}
}
@@ -494,7 +518,8 @@
@@ -495,7 +519,8 @@
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@ -79,7 +79,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -682,6 +707,30 @@
@@ -692,6 +717,30 @@
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
}
@ -110,12 +110,14 @@
return entityitem;
}
}
@@ -814,10 +863,10 @@
if (this.isDeadOrDying()) {
@@ -825,12 +874,12 @@
return false;
} else {
- this.removeEntitiesOnShoulder();
+ // this.releaseShoulderEntities(); // CraftBukkit - moved down
if (!this.level.isClientSide) {
- this.removeEntitiesOnShoulder();
+ // this.removeEntitiesOnShoulder(); // CraftBukkit - moved down
}
if (damagesource.scalesWithDifficulty()) {
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL) {
- f = 0.0F;
@ -123,7 +125,7 @@
}
if (this.level.getDifficulty() == EnumDifficulty.EASY) {
@@ -829,7 +878,13 @@
@@ -842,7 +891,13 @@
}
}
@ -138,7 +140,7 @@
}
}
}
@@ -849,10 +904,29 @@
@@ -862,10 +917,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
@ -171,7 +173,7 @@
}
@Override
@@ -894,8 +968,13 @@
@@ -907,8 +981,13 @@
}
}
@ -186,7 +188,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -910,7 +989,7 @@
@@ -923,7 +1002,7 @@
}
if (f != 0.0F) {
@ -195,7 +197,7 @@
float f3 = this.getHealth();
this.setHealth(this.getHealth() - f);
@@ -921,6 +1000,7 @@
@@ -934,6 +1013,7 @@
}
}
@ -203,7 +205,7 @@
}
@Override
@@ -1080,7 +1160,7 @@
@@ -1093,7 +1173,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@ -212,7 +214,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1119,8 +1199,15 @@
@@ -1132,8 +1212,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@ -230,7 +232,7 @@
}
}
@@ -1148,8 +1235,11 @@
@@ -1161,8 +1248,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
@ -243,7 +245,7 @@
}
}
@@ -1158,9 +1248,26 @@
@@ -1171,9 +1261,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@ -270,7 +272,7 @@
}
if (flag2) {
@@ -1205,7 +1312,14 @@
@@ -1218,7 +1325,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@ -286,7 +288,7 @@
}
if (this.level instanceof WorldServer && f5 > 2.0F) {
@@ -1215,12 +1329,17 @@
@@ -1228,12 +1342,17 @@
}
}
@ -305,7 +307,7 @@
}
}
@@ -1293,6 +1412,12 @@
@@ -1306,6 +1425,12 @@
public void updateTutorialInventoryAction(ItemStack itemstack, ItemStack itemstack1, ClickAction clickaction) {}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@ -318,7 +320,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1377,9 +1502,9 @@
@@ -1390,9 +1515,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@ -330,7 +332,7 @@
}
}
@@ -1413,7 +1538,11 @@
@@ -1426,7 +1551,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.flyingSpeed = f;
this.resetFallDistance();
@ -343,7 +345,7 @@
} else {
super.travel(vec3d);
}
@@ -1448,19 +1577,19 @@
@@ -1461,19 +1590,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);
@ -366,7 +368,7 @@
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1471,13 +1600,13 @@
@@ -1484,13 +1613,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@ -383,7 +385,7 @@
}
}
} else if (this.isFallFlying()) {
@@ -1543,12 +1672,24 @@
@@ -1556,12 +1685,24 @@
}
public void startFallFlying() {
@ -409,7 +411,7 @@
}
@Override
@@ -1638,10 +1779,21 @@
@@ -1651,10 +1792,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@ -432,7 +434,7 @@
}
}
@@ -1718,15 +1870,22 @@
@@ -1731,15 +1883,22 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@ -458,7 +460,7 @@
this.inventory.armor.set(enumitemslot.getIndex(), itemstack);
}
@@ -1767,26 +1926,31 @@
@@ -1780,26 +1939,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {

Datei anzeigen

@ -44,15 +44,15 @@
}
this.checkInsideBlocks();
@@ -159,6 +175,11 @@
Entity entity = damagesource.getEntity();
@@ -160,6 +176,11 @@
if (entity != null) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3D vec3d = entity.getLookAngle();
if (!this.level.isClientSide) {
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
+ return false;
+ }
+ // CraftBukkit end
Vec3D vec3d = entity.getLookAngle();
this.setDeltaMovement(vec3d);
this.setDeltaMovement(vec3d);

Datei anzeigen

@ -9,7 +9,7 @@
public class EntityFireworks extends IProjectile implements ItemSupplier {
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
@@ -141,7 +143,7 @@
@@ -144,7 +146,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (!this.noPhysics) {
@ -18,7 +18,7 @@
this.hasImpulse = true;
}
@@ -156,7 +158,11 @@
@@ -159,7 +161,11 @@
}
if (!this.level.isClientSide && this.life > this.lifetime) {
@ -31,7 +31,7 @@
}
}
@@ -172,7 +178,11 @@
@@ -175,7 +181,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {
super.onHitEntity(movingobjectpositionentity);
if (!this.level.isClientSide) {
@ -44,7 +44,7 @@
}
}
@@ -182,7 +192,11 @@
@@ -185,7 +195,11 @@
this.level.getBlockState(blockposition).entityInside(this.level, blockposition, this);
if (!this.level.isClientSide() && this.hasExplosion()) {
@ -57,7 +57,7 @@
}
super.onHitBlock(movingobjectpositionblock);
@@ -208,7 +222,9 @@
@@ -211,7 +225,9 @@
if (f > 0.0F) {
if (this.attachedToEntity != null) {
@ -67,7 +67,7 @@
}
double d0 = 5.0D;
@@ -235,7 +251,9 @@
@@ -238,7 +254,9 @@
if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D);

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/projectile/EntityFishingHook.java
+++ b/net/minecraft/world/entity/projectile/EntityFishingHook.java
@@ -44,6 +44,12 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -45,6 +45,12 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.entity.Player;
@ -12,8 +12,8 @@
+
public class EntityFishingHook extends IProjectile {
private final Random syncronizedRandom;
@@ -64,6 +70,12 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -66,6 +72,12 @@
private final int luck;
private final int lureSpeed;
@ -26,7 +26,7 @@
private EntityFishingHook(EntityTypes<? extends EntityFishingHook> entitytypes, World world, int i, int j) {
super(entitytypes, world);
this.syncronizedRandom = new Random();
@@ -258,7 +270,7 @@
@@ -260,7 +272,7 @@
private void checkCollision() {
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
@ -35,7 +35,7 @@
}
@Override
@@ -305,6 +317,10 @@
@@ -307,6 +319,10 @@
this.timeUntilLured = 0;
this.timeUntilHooked = 0;
this.getEntityData().set(EntityFishingHook.DATA_BITING, false);
@ -46,7 +46,7 @@
}
} else {
float f;
@@ -338,6 +354,13 @@
@@ -340,6 +356,13 @@
worldserver.sendParticles(Particles.FISHING, d0, d1, d2, 0, (double) (-f4), 0.01D, (double) f3, 1.0D);
}
} else {
@ -60,7 +60,7 @@
this.playSound(SoundEffects.FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
double d3 = this.getY() + 0.5D;
@@ -374,8 +397,10 @@
@@ -376,8 +399,10 @@
this.timeUntilHooked = MathHelper.nextInt(this.random, 20, 80);
}
} else {
@ -73,7 +73,7 @@
}
}
@@ -442,6 +467,14 @@
@@ -444,6 +469,14 @@
int i = 0;
if (this.hookedIn != null) {
@ -88,7 +88,7 @@
this.pullEntity(this.hookedIn);
CriterionTriggers.FISHING_ROD_HOOKED.trigger((EntityPlayer) entityhuman, itemstack, this, Collections.emptyList());
this.level.broadcastEntityEvent(this, (byte) 31);
@@ -457,6 +490,15 @@
@@ -459,6 +492,15 @@
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(), this.getZ(), itemstack1);
@ -104,7 +104,7 @@
double d0 = entityhuman.getX() - this.getX();
double d1 = entityhuman.getY() - this.getY();
double d2 = entityhuman.getZ() - this.getZ();
@@ -464,7 +506,11 @@
@@ -466,7 +508,11 @@
entityitem.setDeltaMovement(d0 * 0.1D, d1 * 0.1D + Math.sqrt(Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2)) * 0.08D, d2 * 0.1D);
this.level.addFreshEntity(entityitem);
@ -114,10 +114,10 @@
+ entityhuman.level.addFreshEntity(new EntityExperienceOrb(entityhuman.level, entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop()));
+ }
+ // CraftBukkit end
if (itemstack1.is((Tag) TagsItem.FISHES)) {
if (itemstack1.is(TagsItem.FISHES)) {
entityhuman.awardStat(StatisticList.FISH_CAUGHT, 1);
}
@@ -474,8 +520,25 @@
@@ -476,8 +522,25 @@
}
if (this.onGround) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityPotion.java
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java
@@ -33,6 +33,16 @@
@@ -32,6 +32,16 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@ -17,7 +17,7 @@
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
public static final double SPLASH_RANGE = 4.0D;
@@ -99,7 +109,7 @@
@@ -98,7 +108,7 @@
if (flag) {
this.applyWater();
@ -26,7 +26,7 @@
if (this.isLingering()) {
this.makeAreaOfEffectCloud(itemstack, potionregistry);
} else {
@@ -145,6 +155,7 @@
@@ -144,6 +154,7 @@
private void applySplash(List<MobEffect> list, @Nullable Entity entity) {
AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<EntityLiving> list1 = this.level.getEntitiesOfClass(EntityLiving.class, axisalignedbb);
@ -34,7 +34,7 @@
if (!list1.isEmpty()) {
Entity entity1 = this.getEffectSource();
@@ -163,21 +174,47 @@
@@ -162,21 +173,47 @@
d1 = 1.0D;
}
@ -96,7 +96,7 @@
}
}
}
@@ -213,7 +250,14 @@
@@ -212,7 +249,14 @@
entityareaeffectcloud.setFixedColor(nbttagcompound.getInt("CustomPotionColor"));
}
@ -112,10 +112,10 @@
}
public boolean isLingering() {
@@ -224,13 +268,25 @@
@@ -223,13 +267,25 @@
IBlockData iblockdata = this.level.getBlockState(blockposition);
if (iblockdata.is((Tag) TagsBlock.FIRE)) {
if (iblockdata.is(TagsBlock.FIRE)) {
- this.level.removeBlock(blockposition, false);
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
@@ -60,8 +60,21 @@
@@ -59,8 +59,21 @@
this.finalTarget = entity;
this.currentMoveDirection = EnumDirection.UP;
this.selectNextMoveDirection(enumdirection_enumaxis);
@ -22,7 +22,7 @@
@Override
public SoundCategory getSoundSource() {
return SoundCategory.HOSTILE;
@@ -225,7 +238,7 @@
@@ -224,7 +237,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
@ -31,7 +31,7 @@
}
}
@@ -292,7 +305,7 @@
@@ -291,7 +304,7 @@
if (flag) {
this.doEnchantDamageEffects(entityliving, entity);
if (entity instanceof EntityLiving) {
@ -40,7 +40,7 @@
}
}
@@ -318,6 +331,11 @@
@@ -317,6 +330,11 @@
@Override
public boolean hurt(DamageSource damagesource, float f) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/raid/EntityRaider.java
+++ b/net/minecraft/world/entity/raid/EntityRaider.java
@@ -166,7 +166,7 @@
@@ -165,7 +165,7 @@
MobEffect mobeffect1 = new MobEffect(MobEffects.BAD_OMEN, 120000, i, false, false, true);
if (!this.level.getGameRules().getBoolean(GameRules.RULE_DISABLE_RAIDS)) {
@ -9,7 +9,7 @@
}
}
}
@@ -306,7 +306,7 @@
@@ -305,7 +305,7 @@
private final T mob;
@ -18,7 +18,7 @@
this.mob = entityraider;
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
}
@@ -522,7 +522,7 @@
@@ -521,7 +521,7 @@
while (iterator.hasNext()) {
EntityRaider entityraider = (EntityRaider) iterator.next();
@ -27,7 +27,7 @@
}
}
@@ -539,7 +539,7 @@
@@ -538,7 +538,7 @@
while (iterator.hasNext()) {
EntityRaider entityraider = (EntityRaider) iterator.next();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/raid/PersistentRaid.java
+++ b/net/minecraft/world/entity/raid/PersistentRaid.java
@@ -109,19 +109,33 @@
@@ -110,19 +110,33 @@
boolean flag = false;
if (!raid.isStarted()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
@@ -52,6 +52,15 @@
@@ -51,6 +51,15 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@ -16,7 +16,7 @@
public class EntityBoat extends Entity {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -92,6 +101,14 @@
@@ -91,6 +100,14 @@
private float bubbleAngle;
private float bubbleAngleO;
@ -31,7 +31,7 @@
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.paddlePositions = new float[2];
@@ -161,6 +178,19 @@
@@ -160,6 +177,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else if (!this.level.isClientSide && !this.isRemoved()) {
@ -51,7 +51,7 @@
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.setDamage(this.getDamage() + f * 10.0F);
@@ -169,6 +199,15 @@
@@ -168,6 +198,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
@ -67,7 +67,7 @@
if (!flag && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.spawnAtLocation((IMaterial) this.getDropItem());
}
@@ -204,9 +243,29 @@
@@ -203,9 +242,29 @@
public void push(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@ -97,7 +97,7 @@
super.push(entity);
}
@@ -257,6 +316,7 @@
@@ -256,6 +315,7 @@
return this.getDirection().getClockWise();
}
@ -105,7 +105,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -297,6 +357,22 @@
@@ -296,6 +356,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@ -128,7 +128,7 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -801,6 +877,11 @@
@@ -800,6 +876,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, DamageSource.FALL);
if (!this.level.isClientSide && !this.isRemoved()) {
@ -140,7 +140,7 @@
this.kill();
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -814,6 +895,7 @@
@@ -813,6 +894,7 @@
}
}
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
@@ -49,6 +49,15 @@
@@ -48,6 +48,15 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@ -16,7 +16,7 @@
public abstract class EntityMinecartAbstract extends Entity {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityMinecartAbstract.class, DataWatcherRegistry.INT);
@@ -91,6 +100,17 @@
@@ -90,6 +99,17 @@
private double lyd;
private double lzd;
@ -34,7 +34,7 @@
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
this.blocksBuilding = true;
@@ -217,6 +237,19 @@
@@ -216,6 +236,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
@ -54,7 +54,7 @@
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.markHurt();
@@ -225,6 +258,15 @@
@@ -224,6 +257,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
@ -70,7 +70,7 @@
this.ejectPassengers();
if (flag && !this.hasCustomName()) {
this.discard();
@@ -284,6 +326,14 @@
@@ -283,6 +325,14 @@
@Override
public void tick() {
@ -85,7 +85,7 @@
if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1);
}
@@ -293,7 +343,7 @@
@@ -292,7 +342,7 @@
}
this.checkOutOfWorld();
@ -94,7 +94,7 @@
double d0;
if (this.level.isClientSide) {
@@ -359,6 +409,18 @@
@@ -358,6 +408,18 @@
}
this.setRot(this.getYRot(), this.getXRot());
@ -113,7 +113,7 @@
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.pushableBy(this));
@@ -367,8 +429,26 @@
@@ -366,8 +428,26 @@
Entity entity = (Entity) list.get(l);
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
@ -140,7 +140,7 @@
entity.push(this);
}
}
@@ -380,6 +460,14 @@
@@ -379,6 +459,14 @@
Entity entity1 = (Entity) iterator.next();
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
@ -155,7 +155,7 @@
entity1.push(this);
}
}
@@ -396,7 +484,7 @@
@@ -395,7 +483,7 @@
}
protected double getMaxSpeed() {
@ -164,7 +164,7 @@
}
public void activateMinecart(int i, int j, int k, boolean flag) {}
@@ -407,12 +495,16 @@
@@ -406,12 +494,16 @@
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
if (this.onGround) {
@ -183,7 +183,7 @@
}
}
@@ -603,7 +695,7 @@
@@ -602,7 +694,7 @@
}
protected void applyNaturalSlowdown() {
@ -192,7 +192,7 @@
Vec3D vec3d = this.getDeltaMovement();
vec3d = vec3d.multiply(d0, 0.0D, d0);
@@ -742,6 +834,14 @@
@@ -741,6 +833,14 @@
if (!this.level.isClientSide) {
if (!entity.noPhysics && !this.noPhysics) {
if (!this.hasPassenger(entity)) {
@ -207,7 +207,7 @@
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1;
@@ -921,4 +1021,26 @@
@@ -920,4 +1020,26 @@
private EnumMinecartType() {}
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/inventory/Container.java
+++ b/net/minecraft/world/inventory/Container.java
@@ -30,6 +30,20 @@
import net.minecraft.world.level.block.Block;
@@ -32,6 +32,20 @@
import net.minecraft.world.level.block.entity.TileEntity;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.google.common.base.Preconditions;
@ -20,8 +20,8 @@
+
public abstract class Container {
public static final int SLOT_CLICKED_OUTSIDE = -999;
@@ -59,6 +73,27 @@
private static Logger LOGGER = LogUtils.getLogger();
@@ -62,6 +76,27 @@
private ContainerSynchronizer synchronizer;
private boolean suppressRemoteUpdates;
@ -49,7 +49,7 @@
protected Container(@Nullable Containers<?> containers, int i) {
this.carried = ItemStack.EMPTY;
this.remoteSlots = NonNullList.create();
@@ -156,6 +191,15 @@
@@ -163,6 +198,15 @@
}
@ -65,7 +65,7 @@
public void removeSlotListener(ICrafting icrafting) {
this.containerListeners.remove(icrafting);
}
@@ -370,7 +414,7 @@
@@ -381,7 +425,7 @@
}
} else if (this.quickcraftStatus == 2) {
if (!this.quickcraftSlots.isEmpty()) {
@ -74,7 +74,7 @@
k = ((Slot) this.quickcraftSlots.iterator().next()).index;
this.resetQuickCraft();
this.doClick(k, this.quickcraftType, InventoryClickType.PICKUP, entityhuman);
@@ -381,6 +425,7 @@
@@ -392,6 +436,7 @@
l = this.getCarried().getCount();
Iterator iterator = this.quickcraftSlots.iterator();
@ -82,7 +82,7 @@
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
ItemStack itemstack2 = this.getCarried();
@@ -397,12 +442,48 @@
@@ -408,12 +453,48 @@
}
l -= itemstack3.getCount() - j1;
@ -134,7 +134,7 @@
}
this.resetQuickCraft();
@@ -420,8 +501,11 @@
@@ -431,8 +512,11 @@
if (i == -999) {
if (!this.getCarried().isEmpty()) {
if (clickaction == ClickAction.PRIMARY) {
@ -147,7 +147,7 @@
} else {
entityhuman.drop(this.getCarried().split(1), true);
}
@@ -484,6 +568,15 @@
@@ -495,6 +579,15 @@
}
slot.setChanged();
@ -163,7 +163,7 @@
}
} else {
Slot slot2;
@@ -591,13 +684,14 @@
@@ -602,13 +695,14 @@
ItemStack itemstack = this.getCarried();
if (!itemstack.isEmpty()) {
@ -179,7 +179,7 @@
}
}
@@ -811,6 +905,11 @@
@@ -822,6 +916,11 @@
}
public ItemStack getCarried() {

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/inventory/ContainerAnvil.java
+++ b/net/minecraft/world/inventory/ContainerAnvil.java
@@ -18,12 +18,16 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -17,12 +17,16 @@
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
@ -10,7 +10,7 @@
+
public class ContainerAnvil extends ContainerAnvilAbstract {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
private static final boolean DEBUG_COST = false;
public static final int MAX_NAME_LENGTH = 50;
- private int repairItemCountCost;
@ -18,7 +18,7 @@
public String itemName;
public final ContainerProperty cost;
private static final int COST_FAIL = 0;
@@ -33,6 +37,10 @@
@@ -32,6 +36,10 @@
private static final int COST_REPAIR_SACRIFICE = 2;
private static final int COST_INCOMPATIBLE_PENALTY = 1;
private static final int COST_RENAME = 1;
@ -29,7 +29,7 @@
public ContainerAnvil(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL);
@@ -105,7 +113,7 @@
@@ -104,7 +112,7 @@
byte b1 = 0;
if (itemstack.isEmpty()) {
@ -38,7 +38,7 @@
this.cost.set(0);
} else {
ItemStack itemstack1 = itemstack.copy();
@@ -123,7 +131,7 @@
@@ -122,7 +130,7 @@
if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) {
k = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4);
if (k <= 0) {
@ -47,7 +47,7 @@
this.cost.set(0);
return;
}
@@ -138,7 +146,7 @@
@@ -137,7 +145,7 @@
this.repairItemCountCost = i1;
} else {
if (!flag && (!itemstack1.is(itemstack2.getItem()) || !itemstack1.isDamageableItem())) {
@ -56,7 +56,7 @@
this.cost.set(0);
return;
}
@@ -228,7 +236,7 @@
@@ -227,7 +235,7 @@
}
if (flag2 && !flag1) {
@ -65,7 +65,7 @@
this.cost.set(0);
return;
}
@@ -252,11 +260,11 @@
@@ -251,11 +259,11 @@
itemstack1 = ItemStack.EMPTY;
}
@ -80,7 +80,7 @@
itemstack1 = ItemStack.EMPTY;
}
@@ -275,7 +283,8 @@
@@ -274,7 +282,8 @@
EnchantmentManager.setEnchantments(map, itemstack1);
}
@ -90,7 +90,7 @@
this.broadcastChanges();
}
}
@@ -302,4 +311,18 @@
@@ -301,4 +310,18 @@
public int getCost() {
return this.cost.get();
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerBeacon.java
+++ b/net/minecraft/world/inventory/ContainerBeacon.java
@@ -11,6 +11,11 @@
@@ -10,6 +10,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Blocks;
@ -12,7 +12,7 @@
public class ContainerBeacon extends Container {
private static final int PAYMENT_SLOT = 0;
@@ -24,6 +29,10 @@
@@ -23,6 +28,10 @@
private final ContainerBeacon.SlotBeacon paymentSlot;
private final ContainerAccess access;
private final IContainerProperties beaconData;
@ -23,7 +23,7 @@
public ContainerBeacon(int i, IInventory iinventory) {
this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL);
@@ -31,6 +40,7 @@
@@ -30,6 +39,7 @@
public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) {
super(Containers.BEACON, i);
@ -31,7 +31,7 @@
this.beacon = new InventorySubcontainer(1) {
@Override
public boolean canPlaceItem(int j, ItemStack itemstack) {
@@ -80,6 +90,7 @@
@@ -79,6 +89,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
@ -39,7 +39,7 @@
return stillValid(this.access, entityhuman, Blocks.BEACON);
}
@@ -180,4 +191,17 @@
@@ -179,4 +190,17 @@
return 1;
}
}

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/world/inventory/ContainerEnchantTable.java
+++ b/net/minecraft/world/inventory/ContainerEnchantTable.java
@@ -20,6 +20,21 @@
import net.minecraft.world.item.enchantment.WeightedRandomEnchant;
@@ -25,6 +25,21 @@
import net.minecraft.world.level.block.BlockEnchantmentTable;
import net.minecraft.world.level.block.Blocks;
+// CraftBukkit start
@ -22,7 +22,7 @@
public class ContainerEnchantTable extends Container {
private final IInventory enchantSlots;
@@ -29,6 +44,10 @@
@@ -34,6 +49,10 @@
public final int[] costs;
public final int[] enchantClue;
public final int[] levelClue;
@ -33,7 +33,7 @@
public ContainerEnchantTable(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL);
@@ -42,6 +61,13 @@
@@ -47,6 +66,13 @@
super.setChanged();
ContainerEnchantTable.this.slotsChanged(this);
}
@ -47,7 +47,7 @@
};
this.random = new Random();
this.enchantmentSeed = ContainerProperty.standalone();
@@ -89,6 +115,9 @@
@@ -94,6 +120,9 @@
this.addDataSlot(ContainerProperty.shared(this.levelClue, 0));
this.addDataSlot(ContainerProperty.shared(this.levelClue, 1));
this.addDataSlot(ContainerProperty.shared(this.levelClue, 2));
@ -57,7 +57,7 @@
}
@Override
@@ -96,7 +125,7 @@
@@ -101,7 +130,7 @@
if (iinventory == this.enchantSlots) {
ItemStack itemstack = iinventory.getItem(0);
@ -65,8 +65,8 @@
+ if (!itemstack.isEmpty()) { // CraftBukkit - relax condition
this.access.execute((world, blockposition) -> {
int i = 0;
@@ -158,6 +187,41 @@
Iterator iterator = BlockEnchantmentTable.BOOKSHELF_OFFSETS.iterator();
@@ -140,6 +169,41 @@
}
}
@ -108,70 +108,71 @@
this.broadcastChanges();
});
} else {
@@ -184,9 +248,24 @@
ItemStack itemstack2 = itemstack;
List<WeightedRandomEnchant> list = this.getEnchantmentList(itemstack, i, this.costs[i]);
@@ -167,9 +231,24 @@
ItemStack itemstack2 = itemstack;
List<WeightedRandomEnchant> list = this.getEnchantmentList(itemstack, i, this.costs[i]);
- if (!list.isEmpty()) {
- entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit start
+ if (true || !list.isEmpty()) {
+ // entityhuman.onEnchantmentPerformed(itemstack, j); // Moved down
boolean flag = itemstack.is(Items.BOOK);
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
+ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(instance.enchantment))), instance.level);
+ }
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack2);
- if (!list.isEmpty()) {
- entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit start
+ if (true || !list.isEmpty()) {
+ // entityhuman.onEnchantmentPerformed(itemstack, j); // Moved down
boolean flag = itemstack.is(Items.BOOK);
+ Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new java.util.HashMap<org.bukkit.enchantments.Enchantment, Integer>();
+ for (Object obj : list) {
+ WeightedRandomEnchant instance = (WeightedRandomEnchant) obj;
+ enchants.put(org.bukkit.enchantments.Enchantment.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.ENCHANTMENT.getKey(instance.enchantment))), instance.level);
+ }
+ CraftItemStack item = CraftItemStack.asCraftMirror(itemstack2);
+
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), access.getLocation().getBlock(), item, this.costs[i], enchants, i);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), access.getLocation().getBlock(), item, this.costs[i], enchants, i);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ int level = event.getExpLevelCost();
+ if (event.isCancelled() || (level > entityhuman.experienceLevel && !entityhuman.getAbilities().instabuild) || event.getEnchantsToAdd().isEmpty()) {
+ return;
+ }
+ int level = event.getExpLevelCost();
+ if (event.isCancelled() || (level > entityhuman.experienceLevel && !entityhuman.getAbilities().instabuild) || event.getEnchantsToAdd().isEmpty()) {
+ return;
+ }
if (flag) {
itemstack2 = new ItemStack(Items.ENCHANTED_BOOK);
@@ -199,16 +278,29 @@
this.enchantSlots.setItem(0, itemstack2);
}
- for (int k = 0; k < list.size(); ++k) {
- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k);
+ for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
+ try {
+ if (flag) {
+ NamespacedKey enchantId = entry.getKey().getKey();
+ Enchantment nms = IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
+ if (nms == null) {
+ continue;
+ }
- if (flag) {
- ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
- } else {
- itemstack2.enchant(weightedrandomenchant.enchantment, weightedrandomenchant.level);
+ WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(nms, entry.getValue());
+ ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
+ } else {
+ item.addUnsafeEnchantment(entry.getKey(), entry.getValue());
+ }
+ } catch (IllegalArgumentException e) {
+ /* Just swallow invalid enchantments */
if (flag) {
itemstack2 = new ItemStack(Items.ENCHANTED_BOOK);
@@ -182,16 +261,29 @@
this.enchantSlots.setItem(0, itemstack2);
}
}
+ entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit end
- for (int k = 0; k < list.size(); ++k) {
- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k);
-
- if (flag) {
- ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
- } else {
- itemstack2.enchant(weightedrandomenchant.enchantment, weightedrandomenchant.level);
+ for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
+ try {
+ if (flag) {
+ NamespacedKey enchantId = entry.getKey().getKey();
+ Enchantment nms = IRegistry.ENCHANTMENT.get(CraftNamespacedKey.toMinecraft(enchantId));
+ if (nms == null) {
+ continue;
+ }
+
+ // CraftBukkit - TODO: let plugins change this
if (!entityhuman.getAbilities().instabuild) {
itemstack1.shrink(j);
if (itemstack1.isEmpty()) {
@@ -265,6 +357,7 @@
+ WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(nms, entry.getValue());
+ ItemEnchantedBook.addEnchantment(itemstack2, weightedrandomenchant);
+ } else {
+ item.addUnsafeEnchantment(entry.getKey(), entry.getValue());
+ }
+ } catch (IllegalArgumentException e) {
+ /* Just swallow invalid enchantments */
}
}
+ entityhuman.onEnchantmentPerformed(itemstack, j);
+ // CraftBukkit end
+
+ // CraftBukkit - TODO: let plugins change this
if (!entityhuman.getAbilities().instabuild) {
itemstack1.shrink(j);
if (itemstack1.isEmpty()) {
@@ -254,6 +346,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
@ -179,7 +180,7 @@
return stillValid(this.access, entityhuman, Blocks.ENCHANTING_TABLE);
}
@@ -316,4 +409,17 @@
@@ -305,4 +398,17 @@
return itemstack;
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemBoneMeal.java
+++ b/net/minecraft/world/item/ItemBoneMeal.java
@@ -35,6 +35,12 @@
@@ -33,6 +33,12 @@
@Override
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemEnderEye.java
+++ b/net/minecraft/world/item/ItemEnderEye.java
@@ -85,7 +85,11 @@
@@ -86,7 +86,11 @@
entityendersignal.setItem(itemstack);
entityendersignal.signalTo(blockposition);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemLeash.java
+++ b/net/minecraft/world/item/ItemLeash.java
@@ -14,6 +14,8 @@
@@ -13,6 +13,8 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.AxisAlignedBB;
@ -9,7 +9,7 @@
public class ItemLeash extends Item {
public ItemLeash(Item.Info item_info) {
@@ -55,9 +57,25 @@
@@ -54,9 +56,25 @@
if (entityinsentient.getLeashHolder() == entityhuman) {
if (entityleash == null) {
entityleash = EntityLeash.getOrCreateKnot(world, blockposition);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemMinecart.java
+++ b/net/minecraft/world/item/ItemMinecart.java
@@ -18,6 +18,11 @@
@@ -17,6 +17,11 @@
import net.minecraft.world.level.block.state.properties.BlockPropertyTrackPosition;
import net.minecraft.world.level.gameevent.GameEvent;
@ -12,7 +12,7 @@
public class ItemMinecart extends Item {
private static final IDispenseBehavior DISPENSE_ITEM_BEHAVIOR = new DispenseBehaviorItem() {
@@ -56,14 +61,43 @@
@@ -55,14 +60,43 @@
}
}
@ -59,7 +59,7 @@
return itemstack;
}
@@ -105,7 +139,12 @@
@@ -104,7 +138,12 @@
entityminecartabstract.setCustomName(itemstack.getHoverName());
}

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -72,6 +72,40 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -73,6 +73,40 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.serialization.Dynamic;
@ -41,7 +41,7 @@
public final class ItemStack {
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
@@ -139,16 +173,30 @@
@@ -144,16 +178,30 @@
this.updateEmptyCacheFlag();
}
@ -74,7 +74,7 @@
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -156,6 +204,11 @@
@@ -161,6 +209,11 @@
this.setDamageValue(this.getDamageValue());
}
@ -86,8 +86,8 @@
this.updateEmptyCacheFlag();
}
@@ -193,7 +246,7 @@
return this.getItem() == item;
@@ -202,7 +255,7 @@
return this.getItem().builtInRegistryHolder().tags();
}
- public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
@ -95,8 +95,8 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
BlockPosition blockposition = itemactioncontext.getClickedPos();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
@@ -201,12 +254,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().getTagManager(), shapedetectorblock)) {
@@ -210,12 +263,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(IRegistry.BLOCK_REGISTRY), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
+ // CraftBukkit start - handle all block place event logic here
@ -254,7 +254,7 @@
return enuminteractionresult;
}
@@ -287,6 +485,21 @@
@@ -296,6 +494,21 @@
}
i -= k;
@ -276,7 +276,7 @@
if (i <= 0) {
return false;
}
@@ -308,6 +521,11 @@
@@ -317,6 +530,11 @@
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0);
Item item = this.getItem();
@ -288,7 +288,7 @@
this.shrink(1);
if (t0 instanceof EntityHuman) {
@@ -463,6 +681,17 @@
@@ -472,6 +690,17 @@
return this.tag;
}
@ -306,7 +306,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -843,6 +1072,12 @@
@@ -850,6 +1079,12 @@
}
public void setRepairCost(int i) {
@ -319,7 +319,7 @@
this.getOrCreateTag().putInt("RepairCost", i);
}
@@ -892,6 +1127,13 @@
@@ -899,6 +1134,13 @@
nbttaglist.add(nbttagcompound);
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemWorldMap.java
+++ b/net/minecraft/world/item/ItemWorldMap.java
@@ -33,6 +33,11 @@
@@ -32,6 +32,11 @@
import net.minecraft.world.level.material.MaterialMapColor;
import net.minecraft.world.level.saveddata.maps.WorldMap;
@ -12,7 +12,7 @@
public class ItemWorldMap extends ItemWorldMapBase {
public static final int IMAGE_WIDTH = 128;
@@ -67,7 +72,7 @@
@@ -66,7 +71,7 @@
public static Integer getMapId(ItemStack itemstack) {
NBTTagCompound nbttagcompound = itemstack.getTag();
@ -21,7 +21,7 @@
}
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
@@ -75,6 +80,10 @@
@@ -74,6 +79,10 @@
int l = world.getFreeMapId();
world.setMapData(makeKey(l), worldmap);

Datei anzeigen

@ -1,21 +1,21 @@
--- a/net/minecraft/world/item/crafting/CraftingManager.java
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
@@ -33,11 +33,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -32,11 +32,13 @@
import net.minecraft.world.level.World;
import org.slf4j.Logger;
+import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; // CraftBukkit
+
public class CraftingManager extends ResourceDataJson {
private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create();
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
- public Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of();
+ public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
private Map<MinecraftKey, IRecipe<?>> byName = ImmutableMap.of();
private boolean hasErrors;
@@ -47,7 +49,12 @@
@@ -46,7 +48,12 @@
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
this.hasErrors = false;
@ -29,7 +29,7 @@
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
Iterator iterator = map.entrySet().iterator();
@@ -58,8 +65,10 @@
@@ -57,8 +64,10 @@
try {
IRecipe<?> irecipe = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
@ -42,7 +42,7 @@
})).put(minecraftkey, irecipe);
builder.put(minecraftkey, irecipe);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
@@ -68,20 +77,37 @@
@@ -67,20 +76,37 @@
}
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
@ -75,7 +75,7 @@
- return this.byType(recipes).values().stream().flatMap((irecipe) -> {
+ // CraftBukkit start
+ Optional<T> recipe = this.byType(recipes).values().stream().flatMap((irecipe) -> {
return SystemUtils.toStream(recipes.tryMatch(irecipe, world, c0));
return recipes.tryMatch(irecipe, world, c0).stream();
}).findFirst();
+ c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
+ // CraftBukkit end
@ -83,7 +83,7 @@
}
public <C extends IInventory, T extends IRecipe<C>> List<T> getAllRecipesFor(Recipes<T> recipes) {
@@ -99,7 +125,7 @@
@@ -98,7 +124,7 @@
}
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> byType(Recipes<T> recipes) {
@ -92,7 +92,7 @@
}
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
@@ -119,7 +145,7 @@
@@ -118,7 +144,7 @@
}
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
@ -101,7 +101,7 @@
}
public Collection<IRecipe<?>> getRecipes() {
@@ -144,12 +170,12 @@
@@ -143,12 +169,12 @@
public void replaceRecipes(Iterable<IRecipe<?>> iterable) {
this.hasErrors = false;
@ -116,7 +116,7 @@
});
MinecraftKey minecraftkey = irecipe.getId();
IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe);
@@ -160,6 +186,26 @@
@@ -159,6 +185,26 @@
}
});
this.recipes = ImmutableMap.copyOf(map);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
+++ b/net/minecraft/world/item/enchantment/EnchantmentFrostWalker.java
@@ -57,8 +57,11 @@
@@ -56,8 +56,11 @@
IBlockData iblockdata2 = world.getBlockState(blockposition1);
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.getValue(BlockFluids.LEVEL) == 0 && iblockdata.canSurvive(world, blockposition1) && world.isUnobstructed(iblockdata, blockposition1, VoxelShapeCollision.empty())) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/RayTrace.java
+++ b/net/minecraft/world/level/RayTrace.java
@@ -24,7 +24,7 @@
@@ -26,7 +26,7 @@
this.to = vec3d1;
this.block = raytrace_blockcollisionoption;
this.fluid = raytrace_fluidcollisionoption;
@ -9,7 +9,7 @@
}
public Vec3D getTo() {
@@ -69,7 +69,7 @@
@@ -75,7 +75,7 @@
private final Predicate<Fluid> canPick;

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/SpawnerCreature.java
+++ b/net/minecraft/world/level/SpawnerCreature.java
@@ -47,6 +47,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.storage.WorldData;
@ -13,7 +13,7 @@
+
public final class SpawnerCreature {
private static final Logger LOGGER = LogManager.getLogger();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -73,7 +80,8 @@
if (entity instanceof EntityInsentient) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
@ -70,7 +70,7 @@
if (j >= entityinsentient.getMaxSpawnClusterSize()) {
return;
}
@@ -377,7 +404,7 @@
@@ -383,7 +410,7 @@
if (entityinsentient.checkSpawnRules(worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.checkSpawnObstruction(worldaccess)) {
groupdataentity = entityinsentient.finalizeSpawn(worldaccess, worldaccess.getCurrentDifficultyAt(entityinsentient.blockPosition()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
@ -79,7 +79,7 @@
flag = true;
}
}
@@ -498,8 +525,10 @@
@@ -504,8 +531,10 @@
return this.unmodifiableMobCategoryCounts;
}

Datei anzeigen

@ -1,7 +0,0 @@
--- a/net/minecraft/world/level/StructureManager.java
+++ b/net/minecraft/world/level/StructureManager.java
@@ -1,3 +1,4 @@
+// mc-dev import
package net.minecraft.world.level;
import com.google.common.collect.ImmutableList;

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/World.java
+++ b/net/minecraft/world/level/World.java
@@ -67,6 +67,31 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -65,6 +65,31 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.scores.Scoreboard;
+// CraftBukkit start
+import java.util.HashMap;
@ -31,12 +31,12 @@
+
public abstract class World implements GeneratorAccess, AutoCloseable {
protected static final Logger LOGGER = LogManager.getLogger();
@@ -104,7 +129,43 @@
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = MinecraftKey.CODEC.xmap(ResourceKey.elementKey(IRegistry.DIMENSION_REGISTRY), ResourceKey::location);
@@ -102,7 +127,43 @@
private final ResourceKey<World> dimension;
private long subTickCount;
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
+ // CraftBukkit start Added the following
+ private final CraftWorld world;
+ public boolean pvpMode;
@ -62,7 +62,7 @@
+
+ public abstract ResourceKey<WorldDimension> getTypeKey();
+
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ this.generator = gen;
+ this.world = new CraftWorld((WorldServer) this, gen, biomeProvider, env);
+
@ -76,23 +76,23 @@
+ // CraftBukkit end
this.profiler = supplier;
this.levelData = worlddatamutable;
this.dimensionType = dimensionmanager;
@@ -114,12 +175,12 @@
this.dimensionTypeRegistration = holder;
@@ -113,12 +174,12 @@
this.worldBorder = new WorldBorder() {
@Override
public double getCenterX() {
- return super.getCenterX() / dimensionmanager.coordinateScale();
- return super.getCenterX() / World.this.dimensionType.coordinateScale();
+ return super.getCenterX(); // CraftBukkit
}
@Override
public double getCenterZ() {
- return super.getCenterZ() / dimensionmanager.coordinateScale();
- return super.getCenterZ() / World.this.dimensionType.coordinateScale();
+ return super.getCenterZ(); // CraftBukkit
}
};
} else {
@@ -129,6 +190,42 @@
@@ -128,6 +189,42 @@
this.thread = Thread.currentThread();
this.biomeManager = new BiomeManager(this, i);
this.isDebug = flag1;
@ -135,7 +135,7 @@
}
@Override
@@ -186,6 +283,17 @@
@@ -185,6 +282,17 @@
@Override
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@ -153,7 +153,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return false;
} else if (!this.isClientSide && this.isDebug()) {
@@ -193,9 +301,24 @@
@@ -192,9 +300,24 @@
} else {
Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock();
@ -179,7 +179,7 @@
return false;
} else {
IBlockData iblockdata2 = this.getBlockState(blockposition);
@@ -206,6 +329,7 @@
@@ -205,6 +328,7 @@
this.getProfiler().pop();
}
@ -187,7 +187,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -232,12 +356,69 @@
@@ -231,12 +355,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
@ -257,7 +257,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override
@@ -327,6 +508,17 @@
@@ -326,6 +507,17 @@
IBlockData iblockdata = this.getBlockState(blockposition);
try {
@ -275,7 +275,7 @@
iblockdata.neighborChanged(this, blockposition, block, blockposition1, false);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception while updating neighbours");
@@ -369,6 +561,14 @@
@@ -368,6 +560,14 @@
@Override
public IBlockData getBlockState(BlockPosition blockposition) {
@ -290,7 +290,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@@ -494,6 +694,16 @@
@@ -493,6 +693,16 @@
@Nullable
@Override
public TileEntity getBlockEntity(BlockPosition blockposition) {
@ -307,7 +307,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
}
@@ -501,6 +711,12 @@
@@ -500,6 +710,12 @@
BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) {
@ -320,7 +320,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
}
}
@@ -605,7 +821,7 @@
@@ -604,7 +820,7 @@
for (int j = 0; j < i; ++j) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[j];
@ -329,7 +329,7 @@
if (t0 != null && predicate.test(t0)) {
list.add(t0);
@@ -931,6 +1147,14 @@
@@ -932,6 +1148,14 @@
public abstract LevelEntityGetter<Entity> getEntities();
protected void postGameEventInRadius(@Nullable Entity entity, GameEvent gameevent, BlockPosition blockposition, int i) {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen