mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 17:07:34 +01:00
Update to Minecraft 1.14.3-pre4
This commit is contained in:
parent
da071ec5a7
commit
fe3930ce00
@ -19,5 +19,5 @@
|
||||
if (!flag1 && advancementprogress.isDone()) {
|
||||
+ this.player.world.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
advancement.d().a(this.player);
|
||||
if (advancement.c() != null && advancement.c().i() && this.player.world.getGameRules().getBoolean("announceAdvancements")) {
|
||||
if (advancement.c() != null && advancement.c().i() && this.player.world.getGameRules().getBoolean(GameRules.ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.d.getPlayerList().sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}));
|
||||
|
@ -8,4 +8,4 @@
|
||||
+ // Advancements.LOGGER.info("Loaded {} advancements", this.advancements.size()); // CraftBukkit - moved to AdvancementDataWorld#reload
|
||||
}
|
||||
|
||||
public void a() {
|
||||
public Iterable<Advancement> b() {
|
||||
|
@ -1,15 +1,6 @@
|
||||
--- a/net/minecraft/server/BehaviorFarm.java
|
||||
+++ b/net/minecraft/server/BehaviorFarm.java
|
||||
@@ -27,7 +27,7 @@
|
||||
} else if (entityvillager.getVillagerData().getProfession() != VillagerProfession.FARMER) {
|
||||
return false;
|
||||
} else {
|
||||
- Set<BlockPosition> set = (Set) ((List) entityvillager.getBehaviorController().getMemory(MemoryModuleType.SECONDARY_JOB_SITE).get()).stream().map(GlobalPos::getBlockPosition).collect(Collectors.toSet());
|
||||
+ Set<BlockPosition> set = (Set) (entityvillager.getBehaviorController().getMemory(MemoryModuleType.SECONDARY_JOB_SITE).get()).stream().map(GlobalPos::getBlockPosition).collect(Collectors.toSet()); // CraftBukkit - decompile error
|
||||
BlockPosition blockposition = new BlockPosition(entityvillager);
|
||||
Stream stream = ImmutableList.of(blockposition.down(), blockposition.south(), blockposition.north(), blockposition.east(), blockposition.west()).stream();
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
@@ -72,8 +72,8 @@
|
||||
|
||||
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
if (i > this.d && this.a != null) {
|
||||
@ -20,8 +11,8 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -76,7 +76,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
@@ -92,7 +92,11 @@
|
||||
Block block1 = worldserver.getType(this.a.down()).getBlock();
|
||||
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata) && this.c) {
|
||||
- worldserver.b(this.a, true);
|
||||
@ -30,10 +21,10 @@
|
||||
+ worldserver.b(this.a, true);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (iblockdata.isAir() && this.b) {
|
||||
InventorySubcontainer inventorysubcontainer = entityvillager.getInventory();
|
||||
}
|
||||
|
||||
@@ -85,19 +89,28 @@
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && this.b) {
|
||||
@@ -103,19 +107,28 @@
|
||||
boolean flag = false;
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
@ -66,3 +57,14 @@
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -134,8 +147,8 @@
|
||||
this.a = this.a(worldserver);
|
||||
if (this.a != null) {
|
||||
this.d = i + 20L;
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(new BehaviorTarget(this.a), 0.5F, 1)));
|
||||
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorTarget(this.a)));
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(new BehaviorTarget(this.a), 0.5F, 1))); // CraftBukkit - decompile error
|
||||
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorTarget(this.a))); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/BehaviorMakeLove.java
|
||||
+++ b/net/minecraft/server/BehaviorMakeLove.java
|
||||
@@ -93,6 +93,11 @@
|
||||
@@ -99,6 +99,11 @@
|
||||
|
||||
private Optional<EntityVillager> a(EntityVillager entityvillager, EntityVillager entityvillager1) {
|
||||
EntityVillager entityvillager2 = entityvillager.createChild(entityvillager1);
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
if (entityvillager2 == null) {
|
||||
return Optional.empty();
|
||||
@@ -101,7 +106,7 @@
|
||||
@@ -107,7 +112,7 @@
|
||||
entityvillager1.setAgeRaw(6000);
|
||||
entityvillager2.setAgeRaw(-24000);
|
||||
entityvillager2.setPositionRotation(entityvillager.locX, entityvillager.locY, entityvillager.locZ, 0.0F, 0.0F);
|
||||
@ -21,7 +21,7 @@
|
||||
entityvillager.world.broadcastEntityEffect(entityvillager2, (byte) 12);
|
||||
return Optional.of(entityvillager2);
|
||||
}
|
||||
@@ -110,6 +115,6 @@
|
||||
@@ -116,6 +121,6 @@
|
||||
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
-
|
||||
- @Override
|
||||
- public IChatBaseComponent getScoreboardDisplayName() {
|
||||
- return new ChatMessage("container.chestDouble", new Object[0]);
|
||||
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0])));
|
||||
- }
|
||||
- };
|
||||
+ return new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest); // CraftBukkit
|
||||
@ -57,7 +57,7 @@
|
||||
+
|
||||
+ @Override
|
||||
+ public IChatBaseComponent getScoreboardDisplayName() {
|
||||
+ return new ChatMessage("container.chestDouble", new Object[0]);
|
||||
+ return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getScoreboardDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getScoreboardDisplayName() : new ChatMessage("container.chestDouble", new Object[0])));
|
||||
+ }
|
||||
+ };
|
||||
+ // CraftBukkit end
|
||||
|
@ -40,7 +40,7 @@
|
||||
@Nullable
|
||||
@@ -82,7 +104,7 @@
|
||||
public void tick(IBlockData iblockdata, World world, BlockPosition blockposition, Random random) {
|
||||
if (world.getGameRules().getBoolean("doFireTick")) {
|
||||
if (world.getGameRules().getBoolean(GameRules.DO_FIRE_TICK)) {
|
||||
if (!iblockdata.canPlace(world, blockposition)) {
|
||||
- world.a(blockposition, false);
|
||||
+ fireExtinguished(world, blockposition); // CraftBukkit - invalid place location
|
||||
|
@ -23,7 +23,7 @@
|
||||
+ Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(world, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
|
||||
|
||||
if (entity != null) {
|
||||
entity.portalCooldown = entity.aW();
|
||||
entity.portalCooldown = entity.aX();
|
||||
@@ -48,8 +56,10 @@
|
||||
BlockPortal.Shape blockportal_shape = this.b(generatoraccess, blockposition);
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
@Override
|
||||
public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) {
|
||||
+ super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean("mobGriefing")) && entity.getWidth() * entity.getWidth() * entity.getHeight() > 0.512F) {
|
||||
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) && entity.getWidth() * entity.getWidth() * entity.getHeight() > 0.512F) {
|
||||
+ // CraftBukkit start - Interact soil
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
|
@ -70,7 +70,7 @@
|
||||
if (tileentity == null) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition);
|
||||
@@ -429,6 +454,13 @@
|
||||
tileentity1.W_();
|
||||
tileentity1.V_();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -81,7 +81,7 @@
|
||||
@@ -79,7 +79,7 @@
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) {
|
||||
ichunkaccess = this.cacheChunk[l];
|
||||
@ -9,7 +9,7 @@
|
||||
return ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,15 @@
|
||||
@@ -123,7 +123,15 @@
|
||||
int l = 33 + ChunkStatus.a(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getChunk(k);
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.a(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
@@ -144,7 +152,7 @@
|
||||
@@ -142,7 +150,7 @@
|
||||
}
|
||||
|
||||
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
|
||||
@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
public boolean isLoaded(int i, int j) {
|
||||
@@ -245,6 +253,18 @@
|
||||
@@ -249,6 +257,18 @@
|
||||
this.playerChunkMap.close();
|
||||
}
|
||||
|
||||
@ -54,16 +54,16 @@
|
||||
public void tick(BooleanSupplier booleansupplier) {
|
||||
this.world.getMethodProfiler().enter("purge");
|
||||
this.chunkMapDistance.purgeTickets();
|
||||
@@ -264,13 +284,13 @@
|
||||
@@ -268,13 +288,13 @@
|
||||
this.lastTickTime = i;
|
||||
WorldData worlddata = this.world.getWorldData();
|
||||
boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES;
|
||||
- boolean flag1 = this.world.getGameRules().getBoolean("doMobSpawning");
|
||||
+ boolean flag1 = this.world.getGameRules().getBoolean("doMobSpawning") && !world.getPlayers().isEmpty(); // CraftBukkit
|
||||
- boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING);
|
||||
+ boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
this.world.getMethodProfiler().enter("pollingChunks");
|
||||
int k = this.world.getGameRules().c("randomTickSpeed");
|
||||
int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
|
||||
BlockPosition blockposition = this.world.getSpawn();
|
||||
- boolean flag2 = worlddata.getTime() % 400L == 0L;
|
||||
+ boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit // PAIL: TODO monster ticks
|
||||
|
@ -1,20 +1,20 @@
|
||||
--- a/net/minecraft/server/CommandGamerule.java
|
||||
+++ b/net/minecraft/server/CommandGamerule.java
|
||||
@@ -27,7 +27,7 @@
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource();
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
t0.b(commandcontext, "value");
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true);
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
|
||||
private static int a(CommandListenerWrapper commandlistenerwrapper, String s, CommandContext<CommandListenerWrapper> commandcontext) {
|
||||
- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().getGameRules().get(s);
|
||||
+ GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getWorld().getGameRules().get(s); // CraftBukkit
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
gamerules_gamerulevalue.getType().a(commandcontext, "value", gamerules_gamerulevalue);
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{s, gamerules_gamerulevalue.getValue()}), true);
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
private static int a(CommandListenerWrapper commandlistenerwrapper, String s) {
|
||||
- GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getServer().getGameRules().get(s);
|
||||
+ GameRules.GameRuleValue gamerules_gamerulevalue = commandlistenerwrapper.getWorld().getGameRules().get(s); // CraftBukkit
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.query", new Object[]{s, gamerules_gamerulevalue.getValue()}), false);
|
||||
return gamerules_gamerulevalue.getIntValue();
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.query", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), false);
|
||||
return t0.getIntValue();
|
||||
|
@ -37,9 +37,9 @@
|
||||
@@ -96,7 +112,7 @@
|
||||
}
|
||||
|
||||
private void j() {
|
||||
private void k() {
|
||||
- if (!this.merchant.getWorld().isClientSide) {
|
||||
+ if (!this.merchant.getWorld().isClientSide && this.merchant instanceof Entity) { // CraftBukkit - SPIGOT-5035
|
||||
Entity entity = (Entity) this.merchant;
|
||||
|
||||
this.merchant.getWorld().a(entity.locX, entity.locY, entity.locZ, this.merchant.eb(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);
|
||||
this.merchant.getWorld().a(entity.locX, entity.locY, entity.locZ, this.merchant.ec(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false);
|
||||
|
@ -15,7 +15,7 @@
|
||||
@@ -18,6 +23,21 @@
|
||||
private Runnable m;
|
||||
public final IInventory inventory;
|
||||
private final InventoryCraftResult n;
|
||||
private final InventoryCraftResult resultInventory;
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private Player player;
|
||||
@ -26,7 +26,7 @@
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+
|
||||
+ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.inventory, this.n);
|
||||
+ CraftInventoryStonecutter inventory = new CraftInventoryStonecutter(this.inventory, this.resultInventory);
|
||||
+ bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
|
@ -1,29 +1,65 @@
|
||||
--- a/net/minecraft/server/CraftingManager.java
|
||||
+++ b/net/minecraft/server/CraftingManager.java
|
||||
@@ -26,7 +26,7 @@
|
||||
@@ -22,11 +22,13 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; // CraftBukkit
|
||||
+
|
||||
public class CraftingManager extends ResourceDataJson {
|
||||
|
||||
private static final Gson a = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create();
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final int a = "recipes/".length();
|
||||
public static final int b = ".json".length();
|
||||
- public Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> recipes = (Map) SystemUtils.a((Object) Maps.newHashMap(), CraftingManager::initializeRecipeMap);
|
||||
+ public Map<Recipes<?>, it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = SystemUtils.a(Maps.newHashMap(), CraftingManager::initializeRecipeMap); // CraftBukkit
|
||||
private boolean e;
|
||||
- public Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of();
|
||||
+ public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
|
||||
private boolean d;
|
||||
|
||||
public CraftingManager() {}
|
||||
@@ -88,19 +88,23 @@
|
||||
}
|
||||
public CraftingManager() {
|
||||
@@ -35,7 +37,7 @@
|
||||
|
||||
public void addRecipe(IRecipe<?> irecipe) {
|
||||
- Map<MinecraftKey, IRecipe<?>> map = (Map) this.recipes.get(irecipe.g());
|
||||
+ it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map = this.recipes.get(irecipe.g()); // CraftBukkit
|
||||
protected void a(Map<MinecraftKey, JsonObject> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
|
||||
this.d = false;
|
||||
- Map<Recipes<?>, Builder<MinecraftKey, IRecipe<?>>> map1 = Maps.newHashMap();
|
||||
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map1 = Maps.newHashMap(); // CraftBukkit
|
||||
Iterator iterator = map.entrySet().iterator();
|
||||
|
||||
if (map.containsKey(irecipe.getKey())) {
|
||||
throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.getKey());
|
||||
} else {
|
||||
- map.put(irecipe.getKey(), irecipe);
|
||||
+ map.putAndMoveToFirst(irecipe.getKey(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
|
||||
while (iterator.hasNext()) {
|
||||
@@ -45,24 +47,42 @@
|
||||
try {
|
||||
IRecipe<?> irecipe = a(minecraftkey, (JsonObject) entry.getValue());
|
||||
|
||||
- ((Builder) map1.computeIfAbsent(irecipe.g(), (recipes) -> {
|
||||
- return ImmutableMap.builder();
|
||||
- })).put(minecraftkey, irecipe);
|
||||
+ // CraftBukkit start - SPIGOT-4638: last recipe gets priority
|
||||
+ (map1.computeIfAbsent(irecipe.g(), (recipes) -> {
|
||||
+ return new Object2ObjectLinkedOpenHashMap<>();
|
||||
+ })).putAndMoveToFirst(minecraftkey, irecipe);
|
||||
+ // CraftBukkit end
|
||||
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
|
||||
CraftingManager.LOGGER.error("Parsing error loading recipe {}", minecraftkey, jsonparseexception);
|
||||
}
|
||||
}
|
||||
|
||||
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
|
||||
- return ((Builder) entry1.getValue()).build();
|
||||
+ return (entry1.getValue()); // CraftBukkit
|
||||
}));
|
||||
CraftingManager.LOGGER.info("Loaded {} recipes", map1.size());
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void addRecipe(IRecipe<?> irecipe) {
|
||||
+ Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map = this.recipes.get(irecipe.g()); // CraftBukkit
|
||||
+
|
||||
+ if (map.containsKey(irecipe.getKey())) {
|
||||
+ throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.getKey());
|
||||
+ } else {
|
||||
+ map.putAndMoveToFirst(irecipe.getKey(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<T> craft(Recipes<T> recipes, C c0, World world) {
|
||||
- return this.a(recipes).values().stream().flatMap((irecipe) -> {
|
||||
+ // CraftBukkit start
|
||||
@ -36,16 +72,16 @@
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> List<T> b(Recipes<T> recipes, C c0, World world) {
|
||||
@@ -112,7 +116,7 @@
|
||||
@@ -74,7 +94,7 @@
|
||||
}
|
||||
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, IRecipe<C>> a(Recipes<T> recipes) {
|
||||
- return (Map) this.recipes.getOrDefault(recipes, Maps.newHashMap());
|
||||
+ return (Map) this.recipes.getOrDefault(recipes, new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
|
||||
- return (Map) this.recipes.getOrDefault(recipes, Collections.emptyMap());
|
||||
+ return (Map) this.recipes.getOrDefault(recipes, new Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> c(Recipes<T> recipes, C c0, World world) {
|
||||
@@ -133,7 +137,7 @@
|
||||
@@ -95,7 +115,7 @@
|
||||
|
||||
public Optional<? extends IRecipe<?>> a(MinecraftKey minecraftkey) {
|
||||
return this.recipes.values().stream().map((map) -> {
|
||||
@ -54,20 +90,22 @@
|
||||
}).filter(Objects::nonNull).findFirst();
|
||||
}
|
||||
|
||||
@@ -157,14 +161,14 @@
|
||||
@@ -118,4 +138,18 @@
|
||||
return new JsonSyntaxException("Invalid or unsupported recipe type '" + s + "'");
|
||||
})).a(minecraftkey, jsonobject);
|
||||
}
|
||||
|
||||
- public static void initializeRecipeMap(Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> map) {
|
||||
+ public static void initializeRecipeMap(Map<Recipes<?>, it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map) { // CraftBukkit
|
||||
map.clear();
|
||||
Iterator iterator = IRegistry.RECIPE_TYPE.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Recipes<?> recipes = (Recipes) iterator.next();
|
||||
|
||||
- map.put(recipes, Maps.newHashMap());
|
||||
+ map.put(recipes, new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public static void initializeRecipeMap(Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map) {
|
||||
+ map.clear();
|
||||
+ Iterator iterator = IRegistry.RECIPE_TYPE.iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ Recipes<?> recipes = (Recipes) iterator.next();
|
||||
+
|
||||
+ map.put(recipes, new Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -4,8 +4,8 @@
|
||||
}
|
||||
|
||||
try {
|
||||
- ParseResults<CommandListenerWrapper> parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(stringreader, customfunctiondata.f());
|
||||
+ ParseResults<CommandListenerWrapper> parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.f()); // CraftBukkit
|
||||
- ParseResults<CommandListenerWrapper> parseresults = customfunctiondata.a().getCommandDispatcher().a().parse(stringreader, customfunctiondata.g());
|
||||
+ ParseResults<CommandListenerWrapper> parseresults = customfunctiondata.d().parse(stringreader, customfunctiondata.g()); // CraftBukkit
|
||||
|
||||
if (parseresults.getReader().canRead()) {
|
||||
if (parseresults.getExceptions().size() == 1) {
|
||||
|
@ -20,7 +20,7 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -38,8 +49,10 @@
|
||||
@Nullable
|
||||
private ServerGUI q;
|
||||
private ServerGUI p;
|
||||
|
||||
- public DedicatedServer(File file, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) {
|
||||
- super(file, Proxy.NO_PROXY, datafixer, new CommandDispatcher(true), yggdrasilauthenticationservice, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory, s);
|
||||
@ -136,7 +136,7 @@
|
||||
|
||||
if (this.getMaxTickTime() > 0L) {
|
||||
@@ -301,6 +362,7 @@
|
||||
this.l.b();
|
||||
this.remoteStatusListener.b();
|
||||
}
|
||||
|
||||
+ System.exit(0); // CraftBukkit
|
||||
@ -160,7 +160,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -529,14 +599,61 @@
|
||||
@@ -529,14 +599,45 @@
|
||||
|
||||
@Override
|
||||
public String getPlugins() {
|
||||
@ -193,40 +193,22 @@
|
||||
|
||||
@Override
|
||||
public String executeRemoteCommand(String s) {
|
||||
- this.remoteControlCommandListener.clearMessages();
|
||||
- this.getCommandDispatcher().a(this.remoteControlCommandListener.f(), s);
|
||||
- return this.remoteControlCommandListener.getMessages();
|
||||
+ // CraftBukkit start - fire RemoteServerCommandEvent
|
||||
+ Waitable<String> waitable = new Waitable<String>() {
|
||||
+ @Override
|
||||
+ protected String evaluate() {
|
||||
+ remoteControlCommandListener.clearMessages();
|
||||
+ // Event changes start
|
||||
+ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return "";
|
||||
+ }
|
||||
+ // Event change end
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.f());
|
||||
+ server.dispatchServerCommand(remoteConsole, serverCommand);
|
||||
+ return remoteControlCommandListener.getMessages();
|
||||
this.remoteControlCommandListener.clearMessages();
|
||||
this.executeSync(() -> {
|
||||
- this.getCommandDispatcher().a(this.remoteControlCommandListener.f(), s);
|
||||
+ // CraftBukkit start - fire RemoteServerCommandEvent
|
||||
+ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ };
|
||||
+ processQueue.add(waitable);
|
||||
+ try {
|
||||
+ return waitable.get();
|
||||
+ } catch (java.util.concurrent.ExecutionException e) {
|
||||
+ throw new RuntimeException("Exception processing rcon command " + s, e.getCause());
|
||||
+ } catch (InterruptedException e) {
|
||||
+ Thread.currentThread().interrupt(); // Maintain interrupted state
|
||||
+ throw new RuntimeException("Interrupted processing rcon command " + s, e);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.f());
|
||||
+ server.dispatchServerCommand(remoteConsole, serverCommand);
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
return this.remoteControlCommandListener.getMessages();
|
||||
}
|
||||
|
||||
public void setHasWhitelist(boolean flag) {
|
||||
@@ -555,4 +672,16 @@
|
||||
@@ -557,4 +658,16 @@
|
||||
public boolean b(GameProfile gameprofile) {
|
||||
return false;
|
||||
}
|
||||
|
@ -40,5 +40,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.dispensed = ((ItemBlock) item).a((BlockActionContext) (new BlockActionContextDirectional(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))) == EnumInteractionResult.SUCCESS;
|
||||
if (this.dispensed) {
|
||||
itemstack.subtract(1);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
public class EnchantmentFrostWalker extends Enchantment {
|
||||
|
||||
@@ -41,8 +45,11 @@
|
||||
@@ -46,8 +50,11 @@
|
||||
IBlockData iblockdata2 = world.getType(blockposition1);
|
||||
|
||||
if (iblockdata2.getMaterial() == Material.WATER && (Integer) iblockdata2.get(BlockFluids.LEVEL) == 0 && iblockdata.canPlace(world, blockposition1) && world.a(iblockdata, blockposition1, VoxelShapeCollision.a())) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EnchantmentThorns.java
|
||||
+++ b/net/minecraft/server/EnchantmentThorns.java
|
||||
@@ -29,7 +29,7 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
Random random = entityliving.getRandom();
|
||||
Entry<EnumItemSlot, ItemStack> entry = EnchantmentManager.b(Enchantments.THORNS, entityliving);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EnchantmentWeaponDamage.java
|
||||
+++ b/net/minecraft/server/EnchantmentWeaponDamage.java
|
||||
@@ -46,7 +46,7 @@
|
||||
@@ -51,7 +51,7 @@
|
||||
if (this.a == 2 && entityliving1.getMonsterType() == EnumMonsterType.ARTHROPOD) {
|
||||
int j = 20 + entityliving.getRandom().nextInt(10 * i);
|
||||
|
||||
|
@ -156,7 +156,7 @@
|
||||
this.lastYaw = this.yaw;
|
||||
- this.doPortalTick();
|
||||
+ if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick
|
||||
this.az();
|
||||
this.aA();
|
||||
this.m();
|
||||
if (this.world.isClientSide) {
|
||||
@@ -300,12 +406,44 @@
|
||||
@ -205,7 +205,7 @@
|
||||
int j = i * 20;
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -401,6 +539,28 @@
|
||||
@@ -409,6 +547,28 @@
|
||||
block1.a((IBlockAccess) this.world, this);
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@
|
||||
if (this.playStepSound() && (!this.onGround || !this.isSneaking() || !(this instanceof EntityHuman)) && !this.isPassenger()) {
|
||||
double d0 = vec3d1.x;
|
||||
double d1 = vec3d1.y;
|
||||
@@ -454,7 +614,14 @@
|
||||
@@ -462,7 +622,14 @@
|
||||
if (!flag) {
|
||||
++this.fireTicks;
|
||||
if (this.fireTicks == 0) {
|
||||
@ -250,16 +250,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -565,7 +732,7 @@
|
||||
VoxelShape voxelshape = this.world.getWorldBorder().a();
|
||||
Stream<VoxelShape> stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape);
|
||||
AxisAlignedBB axisalignedbb1 = axisalignedbb.a(vec3d).g(1.0E-7D);
|
||||
- Stream stream1 = this.world.getEntities(this, axisalignedbb1).stream().filter((entity) -> {
|
||||
+ Stream<AxisAlignedBB> stream1 = this.world.getEntities(this, axisalignedbb1).stream().filter((entity) -> { // CraftBukkit - decompile error
|
||||
return !this.x(entity);
|
||||
}).flatMap((entity) -> {
|
||||
return Stream.of(entity.ap(), this.j(entity));
|
||||
@@ -649,6 +816,7 @@
|
||||
@@ -698,6 +865,7 @@
|
||||
this.locX = (axisalignedbb.minX + axisalignedbb.maxX) / 2.0D;
|
||||
this.locY = axisalignedbb.minY;
|
||||
this.locZ = (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D;
|
||||
@ -267,7 +258,7 @@
|
||||
}
|
||||
|
||||
protected SoundEffect getSoundSwim() {
|
||||
@@ -820,7 +988,7 @@
|
||||
@@ -869,7 +1037,7 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -276,7 +267,7 @@
|
||||
if (!this.isFireProof()) {
|
||||
this.damageEntity(DamageSource.FIRE, (float) i);
|
||||
}
|
||||
@@ -1053,6 +1221,13 @@
|
||||
@@ -1102,6 +1270,13 @@
|
||||
}
|
||||
|
||||
public void spawnIn(World world) {
|
||||
@ -290,7 +281,7 @@
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@@ -1078,6 +1253,7 @@
|
||||
@@ -1127,6 +1302,7 @@
|
||||
this.lastYaw -= 360.0F;
|
||||
}
|
||||
|
||||
@ -298,7 +289,7 @@
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.setYawPitch(f, f1);
|
||||
}
|
||||
@@ -1246,7 +1422,7 @@
|
||||
@@ -1295,7 +1471,7 @@
|
||||
public boolean c(NBTTagCompound nbttagcompound) {
|
||||
String s = this.getSaveID();
|
||||
|
||||
@ -307,7 +298,7 @@
|
||||
nbttagcompound.setString("id", s);
|
||||
this.save(nbttagcompound);
|
||||
return true;
|
||||
@@ -1265,15 +1441,33 @@
|
||||
@@ -1314,15 +1490,33 @@
|
||||
Vec3D vec3d = this.getMot();
|
||||
|
||||
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
|
||||
@ -342,7 +333,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1331,6 +1525,11 @@
|
||||
@@ -1380,6 +1574,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,7 +345,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||
@@ -1371,7 +1570,7 @@
|
||||
@@ -1420,7 +1619,7 @@
|
||||
this.setAirTicks(nbttagcompound.getShort("Air"));
|
||||
this.onGround = nbttagcompound.getBoolean("OnGround");
|
||||
if (nbttagcompound.hasKey("Dimension")) {
|
||||
@ -363,7 +354,7 @@
|
||||
}
|
||||
|
||||
this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
|
||||
@@ -1414,6 +1613,43 @@
|
||||
@@ -1463,6 +1662,43 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@ -407,7 +398,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -1489,9 +1725,22 @@
|
||||
@@ -1538,9 +1774,22 @@
|
||||
} else if (this.world.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@ -430,7 +421,7 @@
|
||||
this.world.addEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1595,7 +1844,7 @@
|
||||
@@ -1644,7 +1893,7 @@
|
||||
}
|
||||
|
||||
this.vehicle = entity;
|
||||
@ -439,7 +430,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1620,15 +1869,36 @@
|
||||
@@ -1669,15 +1918,36 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@ -478,7 +469,7 @@
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
||||
this.passengers.add(0, entity);
|
||||
} else {
|
||||
@@ -1636,15 +1906,33 @@
|
||||
@@ -1685,15 +1955,33 @@
|
||||
}
|
||||
|
||||
}
|
||||
@ -513,7 +504,7 @@
|
||||
}
|
||||
|
||||
protected boolean q(Entity entity) {
|
||||
@@ -1687,11 +1975,17 @@
|
||||
@@ -1736,11 +2024,17 @@
|
||||
int i = this.ab();
|
||||
|
||||
if (this.ai) {
|
||||
@ -521,7 +512,7 @@
|
||||
+ if ((true || this.world.getMinecraftServer().getAllowNether()) && !this.isPassenger() && this.aj++ >= i) { // CraftBukkit
|
||||
this.world.getMethodProfiler().enter("portal");
|
||||
this.aj = i;
|
||||
this.portalCooldown = this.aW();
|
||||
this.portalCooldown = this.aX();
|
||||
- this.a(this.world.worldProvider.getDimensionManager() == DimensionManager.NETHER ? DimensionManager.OVERWORLD : DimensionManager.NETHER);
|
||||
+ // CraftBukkit start
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
@ -533,7 +524,7 @@
|
||||
this.world.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
@@ -1771,6 +2065,13 @@
|
||||
@@ -1820,6 +2114,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@ -547,7 +538,7 @@
|
||||
this.setFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -1831,16 +2132,56 @@
|
||||
@@ -1880,16 +2181,56 @@
|
||||
}
|
||||
|
||||
public void setAirTicks(int i) {
|
||||
@ -607,7 +598,7 @@
|
||||
}
|
||||
|
||||
public void j(boolean flag) {
|
||||
@@ -1988,20 +2329,33 @@
|
||||
@@ -2037,20 +2378,33 @@
|
||||
|
||||
@Nullable
|
||||
public Entity a(DimensionManager dimensionmanager) {
|
||||
@ -644,7 +635,7 @@
|
||||
if (dimensionmanager1 == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) {
|
||||
blockposition = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
|
||||
} else if (dimensionmanager == DimensionManager.THE_END) {
|
||||
@@ -2039,6 +2393,25 @@
|
||||
@@ -2088,6 +2442,25 @@
|
||||
vec3d = shapedetector_shape.velocity;
|
||||
f = (float) shapedetector_shape.yaw;
|
||||
}
|
||||
@ -670,7 +661,7 @@
|
||||
|
||||
this.world.getMethodProfiler().exitEnter("reloading");
|
||||
Entity entity = this.getEntityType().a((World) worldserver1);
|
||||
@@ -2048,6 +2421,14 @@
|
||||
@@ -2097,6 +2470,14 @@
|
||||
entity.setPositionRotation(blockposition, entity.yaw + f, entity.pitch);
|
||||
entity.setMot(vec3d);
|
||||
worldserver1.addEntityTeleport(entity);
|
||||
@ -685,7 +676,7 @@
|
||||
}
|
||||
|
||||
this.dead = true;
|
||||
@@ -2249,7 +2630,26 @@
|
||||
@@ -2298,7 +2679,26 @@
|
||||
}
|
||||
|
||||
public void a(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/EntityAnimal.java
|
||||
+++ b/net/minecraft/server/EntityAnimal.java
|
||||
@@ -8,6 +8,7 @@
|
||||
protected Block bC;
|
||||
|
||||
public int loveTicks;
|
||||
public UUID breedCause;
|
||||
+ public ItemStack breedItem; // CraftBukkit - Add breedItem variable
|
||||
|
||||
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -43,6 +44,9 @@
|
||||
@@ -42,6 +43,9 @@
|
||||
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
@Override
|
||||
public boolean damageEntity(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerable(damagesource)) {
|
||||
@@ -52,6 +56,7 @@
|
||||
@@ -51,6 +55,7 @@
|
||||
return super.damageEntity(damagesource, f);
|
||||
}
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
@Override
|
||||
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
|
||||
@@ -146,6 +151,7 @@
|
||||
@@ -139,6 +144,7 @@
|
||||
if (entityhuman != null) {
|
||||
this.breedCause = entityhuman.getUniqueID();
|
||||
}
|
||||
|
@ -21,8 +21,8 @@
|
||||
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
|
||||
|
||||
if (movingobjectposition_enummovingobjecttype == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
@@ -332,7 +339,13 @@
|
||||
}
|
||||
@@ -334,7 +341,13 @@
|
||||
int j = entity.ad();
|
||||
|
||||
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
|
||||
- entity.setOnFire(5);
|
||||
@ -36,7 +36,7 @@
|
||||
}
|
||||
|
||||
if (entity.damageEntity(damagesource, (float) i)) {
|
||||
@@ -468,6 +481,7 @@
|
||||
@@ -471,6 +484,7 @@
|
||||
|
||||
public void setShooter(@Nullable Entity entity) {
|
||||
this.shooter = entity == null ? null : entity.getUniqueID();
|
||||
@ -44,7 +44,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.fromPlayer = ((EntityHuman) entity).abilities.canInstantlyBuild ? EntityArrow.PickupStatus.CREATIVE_ONLY : EntityArrow.PickupStatus.ALLOWED;
|
||||
}
|
||||
@@ -482,9 +496,23 @@
|
||||
@@ -485,9 +499,23 @@
|
||||
@Override
|
||||
public void pickup(EntityHuman entityhuman) {
|
||||
if (!this.world.isClientSide && (this.inGround || this.v()) && this.shake <= 0) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/EntityBat.java
|
||||
+++ b/net/minecraft/server/EntityBat.java
|
||||
@@ -3,6 +3,7 @@
|
||||
import java.time.LocalDate;
|
||||
@@ -4,6 +4,7 @@
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
|
||||
public class EntityBat extends EntityAmbient {
|
||||
|
||||
@@ -104,12 +105,20 @@
|
||||
@@ -105,12 +106,20 @@
|
||||
}
|
||||
|
||||
if (this.world.a(EntityBat.c, (EntityLiving) this) != null) {
|
||||
@ -32,7 +32,7 @@
|
||||
}
|
||||
} else {
|
||||
if (this.d != null && (!this.world.isEmpty(this.d) || this.d.getY() < 1)) {
|
||||
@@ -133,7 +142,11 @@
|
||||
@@ -134,7 +143,11 @@
|
||||
this.bd = 0.5F;
|
||||
this.yaw += f1;
|
||||
if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).isOccluding(this.world, blockposition1)) {
|
||||
@ -45,7 +45,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +174,11 @@
|
||||
@@ -162,7 +175,11 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.world.isClientSide && this.isAsleep()) {
|
||||
|
@ -64,7 +64,7 @@
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!flag && this.world.getGameRules().getBoolean("doEntityDrops")) {
|
||||
if (!flag && this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
this.a((IMaterial) this.f());
|
||||
}
|
||||
@@ -140,9 +179,25 @@
|
||||
@ -134,7 +134,7 @@
|
||||
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
|
||||
+ if (!destroyEvent.isCancelled()) {
|
||||
this.die();
|
||||
if (this.world.getGameRules().getBoolean("doEntityDrops")) {
|
||||
if (this.world.getGameRules().getBoolean(GameRules.DO_ENTITY_DROPS)) {
|
||||
int i;
|
||||
@@ -753,6 +830,7 @@
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/server/EntityCat.java
|
||||
+++ b/net/minecraft/server/EntityCat.java
|
||||
@@ -16,7 +16,7 @@
|
||||
private static final DataWatcherObject<Boolean> bF = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<Boolean> bG = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<Boolean> bH = DataWatcher.a(EntityCat.class, DataWatcherRegistry.i);
|
||||
private static final DataWatcherObject<Integer> bI = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
|
||||
- public static final Map<Integer, MinecraftKey> bD = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
|
||||
+ public static final Map<Integer, MinecraftKey> bD = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
|
||||
private static final DataWatcherObject<Integer> bH = DataWatcher.a(EntityCat.class, DataWatcherRegistry.b);
|
||||
- public static final Map<Integer, MinecraftKey> bC = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
|
||||
+ public static final Map<Integer, MinecraftKey> bC = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
|
||||
hashmap.put(0, new MinecraftKey("textures/entity/cat/tabby.png"));
|
||||
hashmap.put(1, new MinecraftKey("textures/entity/cat/black.png"));
|
||||
hashmap.put(2, new MinecraftKey("textures/entity/cat/red.png"));
|
||||
|
@ -10,10 +10,10 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
super.movementTick();
|
||||
this.bD = this.bz;
|
||||
this.bC = this.bz;
|
||||
this.bB = this.bA;
|
||||
@@ -62,7 +67,9 @@
|
||||
this.bz += this.bE * 2.0F;
|
||||
this.bz += this.bD * 2.0F;
|
||||
if (!this.world.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggLayTime <= 0) {
|
||||
this.a(SoundEffects.ENTITY_CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
|
@ -32,14 +32,8 @@
|
||||
@Override
|
||||
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
@@ -187,15 +201,23 @@
|
||||
return super.a(entityhuman, enumhand);
|
||||
}
|
||||
|
||||
- private void eb() {
|
||||
+ public void eb() { // PAIL rename explode, private -> public
|
||||
if (!this.world.isClientSide) {
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean("mobGriefing") ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
@@ -192,10 +206,18 @@
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.killed = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityDolphin.java
|
||||
+++ b/net/minecraft/server/EntityDolphin.java
|
||||
@@ -106,7 +106,7 @@
|
||||
@@ -107,7 +107,7 @@
|
||||
this.goalSelector.a(8, new EntityDolphin.d());
|
||||
this.goalSelector.a(8, new PathfinderGoalFollowBoat(this));
|
||||
this.goalSelector.a(9, new PathfinderGoalAvoidTarget<>(this, EntityGuardian.class, 8.0F, 1.0D, 1.0D));
|
||||
@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,6 +178,11 @@
|
||||
@@ -179,6 +179,11 @@
|
||||
ItemStack itemstack = entityitem.getItemStack();
|
||||
|
||||
if (this.g(itemstack)) {
|
||||
|
@ -60,7 +60,7 @@
|
||||
@@ -398,7 +415,11 @@
|
||||
|
||||
if (!iblockdata.isAir() && iblockdata.getMaterial() != Material.FIRE) {
|
||||
if (this.world.getGameRules().getBoolean("mobGriefing") && !TagsBlock.DRAGON_IMMUNE.isTagged(block)) {
|
||||
if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) && !TagsBlock.DRAGON_IMMUNE.isTagged(block)) {
|
||||
- flag1 = this.world.a(blockposition, false) || flag1;
|
||||
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
||||
+ // flag1 = this.world.a(blockposition, false) || flag1;
|
||||
|
@ -17,7 +17,7 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entityliving;
|
||||
|
||||
if (entityplayer.playerConnection.a().isConnected() && entityplayer.world == this.world && !entityplayer.isSleeping()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
|
||||
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world);
|
||||
-
|
||||
- entityendermite.setPlayerSpawned(true);
|
||||
@ -37,7 +37,7 @@
|
||||
+ Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
+
|
||||
+ if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) {
|
||||
+ if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean("doMobSpawning")) {
|
||||
+ if (this.random.nextFloat() < 0.05F && this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING)) {
|
||||
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.a(this.world);
|
||||
+
|
||||
+ entityendermite.setPlayerSpawned(true);
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
this.move(EnumMoveType.SELF, this.getMot());
|
||||
@@ -113,7 +131,7 @@
|
||||
protected void ay() {}
|
||||
protected void az() {}
|
||||
|
||||
@Override
|
||||
- protected void burn(int i) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityFish.java
|
||||
+++ b/net/minecraft/server/EntityFish.java
|
||||
@@ -36,7 +36,7 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isTypeNotPersistent(double d0) {
|
||||
@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,6 +56,7 @@
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
public void setFromBucket(boolean flag) {
|
||||
this.datawatcher.set(EntityFish.FROM_BUCKET, flag);
|
||||
|
@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/server/EntityFox.java
|
||||
+++ b/net/minecraft/server/EntityFox.java
|
||||
@@ -267,8 +267,8 @@
|
||||
private List<UUID> ek() {
|
||||
private List<UUID> el() {
|
||||
List<UUID> list = Lists.newArrayList();
|
||||
|
||||
- list.add(((Optional) this.datawatcher.get(EntityFox.bB)).orElse((Object) null));
|
||||
- list.add(((Optional) this.datawatcher.get(EntityFox.bD)).orElse((Object) null));
|
||||
- list.add(((Optional) this.datawatcher.get(EntityFox.bC)).orElse((Object) null));
|
||||
+ list.add(((Optional<UUID>) this.datawatcher.get(EntityFox.bB)).orElse(null)); // CraftBukkit - decompile error
|
||||
+ list.add(((Optional<UUID>) this.datawatcher.get(EntityFox.bD)).orElse(null)); // CraftBukkit - decompile error
|
||||
+ list.add(((Optional<UUID>) this.datawatcher.get(EntityFox.bC)).orElse(null)); // CraftBukkit - decompile error
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -67,4 +67,4 @@
|
||||
+ EntityFox.this.setGoalTarget(this.j, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit
|
||||
this.c = this.j;
|
||||
if (this.k != null) {
|
||||
this.l = this.k.cs();
|
||||
this.l = this.k.ct();
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityGhast.java
|
||||
+++ b/net/minecraft/server/EntityGhast.java
|
||||
@@ -168,7 +168,8 @@
|
||||
@@ -167,7 +167,8 @@
|
||||
world.a((EntityHuman) null, 1016, new BlockPosition(this.ghast), 0);
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4);
|
||||
|
||||
|
@ -173,21 +173,3 @@
|
||||
this.die();
|
||||
this.a((Entity) null);
|
||||
}
|
||||
@@ -168,7 +228,7 @@
|
||||
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
- nbttagcompound.setByte("Facing", (byte) this.direction.get2DRotationValue());
|
||||
+ if (this.direction != null) nbttagcompound.setByte("Facing", (byte) this.direction.get2DRotationValue()); // CraftBukkit
|
||||
BlockPosition blockposition = this.getBlockPosition();
|
||||
|
||||
nbttagcompound.setInt("TileX", blockposition.getX());
|
||||
@@ -179,7 +239,7 @@
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
this.blockPosition = new BlockPosition(nbttagcompound.getInt("TileX"), nbttagcompound.getInt("TileY"), nbttagcompound.getInt("TileZ"));
|
||||
- this.setDirection(EnumDirection.fromType2(nbttagcompound.getByte("Facing")));
|
||||
+ if (nbttagcompound.hasKeyOfType("Facing", 99)) this.setDirection(EnumDirection.fromType2(nbttagcompound.getByte("Facing"))); // CraftBukkit
|
||||
}
|
||||
|
||||
public abstract int getHangingWidth();
|
||||
|
@ -9,9 +9,9 @@
|
||||
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, IJumpable {
|
||||
|
||||
@@ -33,6 +34,7 @@
|
||||
private float bW;
|
||||
protected boolean bH = true;
|
||||
protected int bI;
|
||||
private float bV;
|
||||
protected boolean bG = true;
|
||||
protected int bH;
|
||||
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value
|
||||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
@ -23,7 +23,7 @@
|
||||
- this.inventoryChest = new InventorySubcontainer(this.getChestSlots());
|
||||
+ this.inventoryChest = new InventorySubcontainer(this.getChestSlots(), (org.bukkit.entity.AbstractHorse) this.getBukkitEntity()); // CraftBukkit
|
||||
if (inventorysubcontainer != null) {
|
||||
inventorysubcontainer.b(this);
|
||||
inventorysubcontainer.b((IInventoryListener) this);
|
||||
int i = Math.min(inventorysubcontainer.getSize(), this.inventoryChest.getSize());
|
||||
@@ -332,7 +334,7 @@
|
||||
}
|
||||
@ -51,7 +51,7 @@
|
||||
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
|
||||
}
|
||||
|
||||
if (this.et()) {
|
||||
if (this.eu()) {
|
||||
@@ -716,6 +718,7 @@
|
||||
if (this.getOwnerUUID() != null) {
|
||||
nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString());
|
||||
@ -89,5 +89,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.canSlide = true;
|
||||
this.eB();
|
||||
this.eC();
|
||||
}
|
||||
|
@ -68,7 +68,7 @@
|
||||
}
|
||||
@@ -352,7 +377,8 @@
|
||||
|
||||
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean("naturalRegeneration")) {
|
||||
if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean(GameRules.NATURAL_REGENERATION)) {
|
||||
if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) {
|
||||
- this.heal(1.0F);
|
||||
+ // CraftBukkit - added regain reason of "REGEN" for filtering purposes.
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/net/minecraft/server/EntityInsentient.java
|
||||
@@ -8,6 +8,18 @@
|
||||
@@ -9,6 +9,18 @@
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
|
||||
@@ -26,7 +38,7 @@
|
||||
@@ -27,7 +39,7 @@
|
||||
public final float[] dropChanceHand;
|
||||
private final NonNullList<ItemStack> bB;
|
||||
public final float[] dropChanceArmor;
|
||||
@ -28,7 +28,7 @@
|
||||
public boolean persistent;
|
||||
private final Map<PathType, Float> bE;
|
||||
public MinecraftKey lootTableKey;
|
||||
@@ -62,6 +74,9 @@
|
||||
@@ -63,6 +75,9 @@
|
||||
this.initPathfinder();
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
protected void initPathfinder() {}
|
||||
@@ -129,7 +144,38 @@
|
||||
@@ -130,7 +145,38 @@
|
||||
}
|
||||
|
||||
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
@ -77,7 +77,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -345,11 +391,20 @@
|
||||
@@ -346,11 +392,20 @@
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
@ -100,7 +100,7 @@
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -403,6 +458,11 @@
|
||||
@@ -404,6 +459,11 @@
|
||||
super.a(damagesource, flag);
|
||||
this.lootTableKey = null;
|
||||
}
|
||||
@ -112,7 +112,7 @@
|
||||
|
||||
@Override
|
||||
protected LootTableInfo.Builder a(boolean flag, DamageSource damagesource) {
|
||||
@@ -462,11 +522,17 @@
|
||||
@@ -463,11 +523,17 @@
|
||||
ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
||||
boolean flag = this.a(itemstack, itemstack1, enumitemslot);
|
||||
|
||||
@ -131,7 +131,7 @@
|
||||
}
|
||||
|
||||
this.setSlot(enumitemslot, itemstack);
|
||||
@@ -544,11 +610,11 @@
|
||||
@@ -545,11 +611,11 @@
|
||||
if (entityhuman != null) {
|
||||
double d0 = entityhuman.h(this);
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
this.die();
|
||||
} else if (d0 < 1024.0D) {
|
||||
this.ticksFarFromPlayer = 0;
|
||||
@@ -944,12 +1010,24 @@
|
||||
@@ -945,12 +1011,24 @@
|
||||
if (!this.isAlive()) {
|
||||
return false;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
@ -170,7 +170,7 @@
|
||||
this.setLeashHolder(entityhuman, true);
|
||||
itemstack.subtract(1);
|
||||
return true;
|
||||
@@ -995,6 +1073,7 @@
|
||||
@@ -996,6 +1074,7 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
@ -178,7 +178,7 @@
|
||||
this.unleash(true, true);
|
||||
}
|
||||
|
||||
@@ -1010,7 +1089,9 @@
|
||||
@@ -1011,7 +1090,9 @@
|
||||
|
||||
this.leashHolder = null;
|
||||
if (!this.world.isClientSide && flag1) {
|
||||
@ -188,7 +188,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
|
||||
@@ -1079,6 +1160,7 @@
|
||||
@@ -1080,6 +1161,7 @@
|
||||
|
||||
this.setLeashHolder(EntityLeash.a(this.world, blockposition), true);
|
||||
} else {
|
||||
@ -196,7 +196,7 @@
|
||||
this.unleash(false, true);
|
||||
}
|
||||
|
||||
@@ -1186,7 +1268,14 @@
|
||||
@@ -1187,7 +1269,14 @@
|
||||
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -45,7 +45,7 @@
|
||||
}
|
||||
+ // Craftbukkit end */
|
||||
|
||||
this.impulse |= this.ax();
|
||||
this.impulse |= this.ay();
|
||||
if (!this.world.isClientSide) {
|
||||
@@ -115,6 +125,12 @@
|
||||
}
|
||||
|
@ -11,18 +11,18 @@
|
||||
|
||||
public EntityLargeFireball(EntityTypes<? extends EntityLargeFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean("mobGriefing"); // CraftBukkit
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
public EntityLargeFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
||||
super(EntityTypes.FIREBALL, entityliving, d0, d1, d2, world);
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean("mobGriefing"); // CraftBukkit
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -24,7 +28,15 @@
|
||||
|
||||
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING);
|
||||
|
||||
- this.world.createExplosion((Entity) null, this.locX, this.locY, this.locZ, (float) this.yield, flag, flag ? Explosion.Effect.DESTROY : Explosion.Effect.NONE);
|
||||
+ // CraftBukkit start - fire ExplosionPrimeEvent
|
||||
|
@ -80,7 +80,7 @@
|
||||
+ public int getExpReward() {
|
||||
+ int exp = this.getExpValue(this.killer);
|
||||
+
|
||||
+ if (!this.world.isClientSide && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.isDropExperience() && this.world.getGameRules().getBoolean("doMobLoot")) {
|
||||
+ if (!this.world.isClientSide && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
+ return exp;
|
||||
+ } else {
|
||||
+ return 0;
|
||||
@ -93,13 +93,13 @@
|
||||
|
||||
@@ -314,19 +366,19 @@
|
||||
|
||||
protected void cn() {
|
||||
protected void co() {
|
||||
++this.deathTicks;
|
||||
- if (this.deathTicks == 20) {
|
||||
+ if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
||||
int i;
|
||||
|
||||
- if (!this.world.isClientSide && (this.alwaysGivesExp() || this.lastDamageByPlayerTime > 0 && this.isDropExperience() && this.world.getGameRules().getBoolean("doMobLoot"))) {
|
||||
- if (!this.world.isClientSide && (this.alwaysGivesExp() || this.lastDamageByPlayerTime > 0 && this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT))) {
|
||||
- i = this.getExpValue(this.killer);
|
||||
-
|
||||
- while (i > 0) {
|
||||
@ -505,7 +505,7 @@
|
||||
}
|
||||
|
||||
@@ -1115,6 +1351,12 @@
|
||||
if (this.isDropExperience() && this.world.getGameRules().getBoolean("doMobLoot")) {
|
||||
if (this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
this.a(damagesource, flag);
|
||||
this.dropDeathLoot(damagesource, i, flag);
|
||||
+ // CraftBukkit start - Call death event
|
||||
@ -516,7 +516,7 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.cE();
|
||||
this.cF();
|
||||
@@ -1218,8 +1460,13 @@
|
||||
int i = MathHelper.f((f - 3.0F - f2) * f1);
|
||||
|
||||
@ -797,7 +797,7 @@
|
||||
+
|
||||
+ this.a(this.getRaisedHand(), itemstack);
|
||||
+ // CraftBukkit end
|
||||
this.dp();
|
||||
this.dq();
|
||||
}
|
||||
|
||||
@@ -2495,10 +2908,18 @@
|
||||
@ -825,7 +825,7 @@
|
||||
@@ -2585,7 +3006,7 @@
|
||||
}
|
||||
|
||||
public void dy() {
|
||||
public void dz() {
|
||||
- Optional optional = this.getBedPosition();
|
||||
+ Optional<BlockPosition> optional = this.getBedPosition(); // CraftBukkit - decompile error
|
||||
World world = this.world;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityLlamaTrader.java
|
||||
+++ b/net/minecraft/server/EntityLlamaTrader.java
|
||||
@@ -126,7 +126,7 @@
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
@Override
|
||||
public void c() {
|
||||
|
@ -86,7 +86,7 @@
|
||||
this.c(this.getType() - 1);
|
||||
}
|
||||
@@ -136,7 +186,7 @@
|
||||
this.ae();
|
||||
this.af();
|
||||
}
|
||||
|
||||
- this.doPortalTick();
|
||||
|
@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/server/EntityMinecartCommandBlock.java
|
||||
@@ -104,5 +104,12 @@
|
||||
public CommandListenerWrapper getWrapper() {
|
||||
return new CommandListenerWrapper(this, new Vec3D(EntityMinecartCommandBlock.this.locX, EntityMinecartCommandBlock.this.locY, EntityMinecartCommandBlock.this.locZ), EntityMinecartCommandBlock.this.aT(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this);
|
||||
return new CommandListenerWrapper(this, new Vec3D(EntityMinecartCommandBlock.this.locX, EntityMinecartCommandBlock.this.locY, EntityMinecartCommandBlock.this.locZ), EntityMinecartCommandBlock.this.aU(), this.d(), 2, this.getName().getString(), EntityMinecartCommandBlock.this.getScoreboardDisplayName(), this.d().getMinecraftServer(), EntityMinecartCommandBlock.this);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/EntityMushroomCow.java
|
||||
+++ b/net/minecraft/server/EntityMushroomCow.java
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
+// CraftBukkit start
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
public class EntityMushroomCow extends EntityCow {
|
||||
|
||||
@@ -72,9 +77,17 @@
|
||||
@@ -81,9 +86,17 @@
|
||||
int i;
|
||||
|
||||
if (itemstack.getItem() == Items.SHEARS && this.getAge() >= 0) {
|
||||
@ -31,7 +31,7 @@
|
||||
EntityCow entitycow = (EntityCow) EntityTypes.COW.a(this.world);
|
||||
|
||||
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
@@ -84,7 +97,14 @@
|
||||
@@ -93,7 +106,14 @@
|
||||
entitycow.setCustomName(this.getCustomName());
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityOcelot.java
|
||||
+++ b/net/minecraft/server/EntityOcelot.java
|
||||
@@ -80,7 +80,7 @@
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isTypeNotPersistent(double d0) {
|
||||
@ -9,8 +9,8 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,7 +131,8 @@
|
||||
if ((this.bD == null || this.bD.h()) && !this.isTrusting() && this.i(itemstack) && entityhuman.h((Entity) this) < 9.0D) {
|
||||
@@ -132,7 +132,8 @@
|
||||
if ((this.bC == null || this.bC.h()) && !this.isTrusting() && this.i(itemstack) && entityhuman.h((Entity) this) < 9.0D) {
|
||||
this.a(entityhuman, itemstack);
|
||||
if (!this.world.isClientSide) {
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
@@ -673,7 +675,7 @@
|
||||
@Override
|
||||
protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).dR()) {
|
||||
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).dS()) {
|
||||
- entityinsentient.setGoalTarget(entityliving);
|
||||
+ entityinsentient.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
|
||||
}
|
||||
@ -40,9 +40,9 @@
|
||||
}
|
||||
|
||||
@@ -808,9 +810,9 @@
|
||||
this.e.r(32);
|
||||
this.e.s(32);
|
||||
this.f = this.e.ticksLived + 600;
|
||||
if (this.e.de()) {
|
||||
if (this.e.df()) {
|
||||
- EntityHuman entityhuman = this.b.a(EntityPanda.d.d, (EntityLiving) this.e);
|
||||
+ EntityHuman entityhuman = this.b.a(d, (EntityLiving) this.e); // CraftBukkit - decompile error
|
||||
|
||||
|
@ -2,10 +2,10 @@
|
||||
+++ b/net/minecraft/server/EntityParrot.java
|
||||
@@ -21,7 +21,7 @@
|
||||
};
|
||||
private static final Item bK = Items.COOKIE;
|
||||
private static final Set<Item> bL = Sets.newHashSet(new Item[]{Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS});
|
||||
- private static final Map<EntityTypes<?>, SoundEffect> bM = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
|
||||
+ private static final Map<EntityTypes<?>, SoundEffect> bM = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
|
||||
private static final Item bJ = Items.COOKIE;
|
||||
private static final Set<Item> bK = Sets.newHashSet(new Item[]{Items.WHEAT_SEEDS, Items.MELON_SEEDS, Items.PUMPKIN_SEEDS, Items.BEETROOT_SEEDS});
|
||||
- private static final Map<EntityTypes<?>, SoundEffect> bL = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> {
|
||||
+ private static final Map<EntityTypes<?>, SoundEffect> bL = (Map) SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // CraftBukkit - decompile error
|
||||
hashmap.put(EntityTypes.BLAZE, SoundEffects.ENTITY_PARROT_IMITATE_BLAZE);
|
||||
hashmap.put(EntityTypes.CAVE_SPIDER, SoundEffects.ENTITY_PARROT_IMITATE_SPIDER);
|
||||
hashmap.put(EntityTypes.CREEPER, SoundEffects.ENTITY_PARROT_IMITATE_CREEPER);
|
||||
@ -27,7 +27,7 @@
|
||||
if (entityhuman.isCreative() || !this.isInvulnerable()) {
|
||||
this.damageEntity(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -334,7 +334,8 @@
|
||||
@@ -329,7 +329,8 @@
|
||||
return false;
|
||||
} else {
|
||||
if (this.goalSit != null) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/EntityPigZombie.java
|
||||
+++ b/net/minecraft/server/EntityPigZombie.java
|
||||
@@ -123,16 +123,27 @@
|
||||
@@ -134,16 +134,27 @@
|
||||
} else {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
- if (entity instanceof EntityHuman && !((EntityHuman) entity).isCreative()) {
|
||||
- if (entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean result = super.damageEntity(damagesource, f);
|
||||
+
|
||||
+ if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative()) {
|
||||
+ if (result && entity instanceof EntityHuman && !((EntityHuman) entity).isCreative() && this.hasLineOfSight(entity)) {
|
||||
this.a(entity);
|
||||
}
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Entity entity) {
|
||||
- this.angerLevel = 400 + this.random.nextInt(400);
|
||||
private boolean a(Entity entity) {
|
||||
- this.angerLevel = this.ef();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), 400 + this.random.nextInt(400));
|
||||
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), this.ef());
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.angerLevel = event.getNewAnger();
|
||||
+ // CraftBukkit end
|
||||
|
@ -9,7 +9,7 @@
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false));
|
||||
this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true));
|
||||
@@ -268,6 +268,6 @@
|
||||
@@ -258,6 +258,6 @@
|
||||
|
||||
@Override
|
||||
public boolean isTypeNotPersistent(double d0) {
|
||||
|
@ -83,7 +83,7 @@
|
||||
+ }
|
||||
+
|
||||
+ int k = (i * 2 + 1) * (i * 2 + 1);
|
||||
+ int l = this.s(k);
|
||||
+ int l = this.t(k);
|
||||
+ int i1 = (new Random()).nextInt(k);
|
||||
+
|
||||
+ for (int j1 = 0; j1 < k; ++j1) {
|
||||
@ -105,15 +105,15 @@
|
||||
private void a(WorldServer worldserver) {
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
|
||||
@@ -131,6 +208,7 @@
|
||||
@@ -133,6 +210,7 @@
|
||||
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
|
||||
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"));
|
||||
}
|
||||
+ this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
|
||||
|
||||
if (this.isSleeping()) {
|
||||
this.dy();
|
||||
@@ -155,7 +233,20 @@
|
||||
this.dz();
|
||||
@@ -157,7 +235,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@ -135,13 +135,13 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -166,7 +257,33 @@
|
||||
@@ -168,8 +259,34 @@
|
||||
}
|
||||
|
||||
nbttagcompound.set("recipeBook", this.recipeBook.save());
|
||||
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
+ public void spawnIn(World world) {
|
||||
+ super.spawnIn(world);
|
||||
@ -164,12 +164,13 @@
|
||||
+ }
|
||||
+ this.dimension = ((WorldServer) this.world).getWorldProvider().getDimensionManager();
|
||||
+ this.playerInteractManager.a((WorldServer) world);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public void a(int i) {
|
||||
float f = (float) this.getExpToLevel();
|
||||
@@ -221,6 +338,11 @@
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -223,6 +340,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@ -181,7 +182,7 @@
|
||||
this.playerInteractManager.a();
|
||||
--this.invulnerableTicks;
|
||||
if (this.noDamageTicks > 0) {
|
||||
@@ -288,7 +410,7 @@
|
||||
@@ -290,7 +412,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) {
|
||||
@ -190,7 +191,7 @@
|
||||
this.lastHealthSent = this.getHealth();
|
||||
this.lastFoodSent = this.foodData.getFoodLevel();
|
||||
this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -319,6 +441,12 @@
|
||||
@@ -321,6 +443,12 @@
|
||||
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored));
|
||||
}
|
||||
|
||||
@ -203,7 +204,7 @@
|
||||
if (this.expLevel != this.lastExpLevelScored) {
|
||||
this.lastExpLevelScored = this.expLevel;
|
||||
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored));
|
||||
@@ -333,6 +461,16 @@
|
||||
@@ -335,6 +463,16 @@
|
||||
CriterionTriggers.p.a(this);
|
||||
}
|
||||
|
||||
@ -220,7 +221,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
|
||||
@@ -343,7 +481,8 @@
|
||||
@@ -345,7 +483,8 @@
|
||||
}
|
||||
|
||||
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
@ -230,16 +231,16 @@
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -351,9 +490,46 @@
|
||||
@@ -353,9 +492,46 @@
|
||||
@Override
|
||||
public void die(DamageSource damagesource) {
|
||||
boolean flag = this.world.getGameRules().getBoolean("showDeathMessages");
|
||||
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
|
||||
+ // CraftBukkit start - fire PlayerDeathEvent
|
||||
+ if (this.dead) {
|
||||
+ return;
|
||||
+ }
|
||||
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.inventory.getSize());
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory") || this.isSpectator();
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY) || this.isSpectator();
|
||||
+
|
||||
+ if (!keepInventory) {
|
||||
+ for (ItemStack item : this.inventory.getContents()) {
|
||||
@ -279,7 +280,7 @@
|
||||
|
||||
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
@@ -384,11 +560,16 @@
|
||||
@@ -386,11 +562,16 @@
|
||||
}
|
||||
|
||||
this.releaseShoulderEntities();
|
||||
@ -299,7 +300,7 @@
|
||||
EntityLiving entityliving = this.getKillingEntity();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -431,10 +612,12 @@
|
||||
@@ -433,10 +614,12 @@
|
||||
String s = this.getName();
|
||||
String s1 = entity.getName();
|
||||
|
||||
@ -314,7 +315,7 @@
|
||||
} else {
|
||||
this.a(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -452,7 +635,8 @@
|
||||
@@ -454,7 +637,8 @@
|
||||
int i = scoreboardteam.getColor().b();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
@ -324,7 +325,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,16 +680,26 @@
|
||||
@@ -498,16 +682,26 @@
|
||||
}
|
||||
|
||||
private boolean canPvP() {
|
||||
@ -354,7 +355,7 @@
|
||||
this.decouple();
|
||||
this.getWorldServer().removePlayer(this);
|
||||
if (!this.viewingCredits) {
|
||||
@@ -518,10 +712,12 @@
|
||||
@@ -520,10 +714,12 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.server.getWorldServer(dimensionmanager1);
|
||||
|
||||
@ -368,7 +369,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutRespawn(dimensionmanager, worlddata.getType(), this.playerInteractManager.getGameMode()));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
@@ -529,6 +725,8 @@
|
||||
@@ -531,6 +727,8 @@
|
||||
playerlist.d(this);
|
||||
worldserver.removePlayer(this);
|
||||
this.dead = false;
|
||||
@ -377,7 +378,7 @@
|
||||
double d0 = this.locX;
|
||||
double d1 = this.locY;
|
||||
double d2 = this.locZ;
|
||||
@@ -538,6 +736,7 @@
|
||||
@@ -540,6 +738,7 @@
|
||||
float f2 = f1;
|
||||
|
||||
worldserver.getMethodProfiler().enter("moving");
|
||||
@ -385,7 +386,7 @@
|
||||
if (dimensionmanager1 == DimensionManager.OVERWORLD && dimensionmanager == DimensionManager.NETHER) {
|
||||
this.cu = new Vec3D(this.locX, this.locY, this.locZ);
|
||||
d0 /= 8.0D;
|
||||
@@ -555,6 +754,52 @@
|
||||
@@ -557,6 +756,52 @@
|
||||
f = 0.0F;
|
||||
}
|
||||
|
||||
@ -438,7 +439,7 @@
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
worldserver.getMethodProfiler().exit();
|
||||
worldserver.getMethodProfiler().enter("placing");
|
||||
@@ -566,12 +811,13 @@
|
||||
@@ -568,12 +813,13 @@
|
||||
d0 = MathHelper.a(d0, d4, d6);
|
||||
d2 = MathHelper.a(d2, d5, d7);
|
||||
this.setPositionRotation(d0, d1, d2, f1, f);
|
||||
@ -453,7 +454,7 @@
|
||||
|
||||
for (int l = -2; l <= 2; ++l) {
|
||||
for (int i1 = -2; i1 <= 2; ++i1) {
|
||||
@@ -581,11 +827,20 @@
|
||||
@@ -583,11 +829,20 @@
|
||||
int i2 = k + i1 * 0 - l * 1;
|
||||
boolean flag2 = j1 < 0;
|
||||
|
||||
@ -475,7 +476,7 @@
|
||||
this.setPositionRotation((double) i, (double) j, (double) k, f1, 0.0F);
|
||||
this.setMot(Vec3D.a);
|
||||
} else if (!worldserver1.getTravelAgent().a(this, f2)) {
|
||||
@@ -614,11 +869,16 @@
|
||||
@@ -616,11 +871,16 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@ -493,7 +494,7 @@
|
||||
DimensionManager dimensionmanager = worldserver.worldProvider.getDimensionManager();
|
||||
DimensionManager dimensionmanager1 = this.world.worldProvider.getDimensionManager();
|
||||
|
||||
@@ -655,9 +915,16 @@
|
||||
@@ -657,9 +917,16 @@
|
||||
this.activeContainer.c();
|
||||
}
|
||||
|
||||
@ -512,7 +513,7 @@
|
||||
this.a(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.q.a(this);
|
||||
});
|
||||
@@ -665,6 +932,7 @@
|
||||
@@ -667,6 +934,7 @@
|
||||
|
||||
@Override
|
||||
public void wakeup(boolean flag, boolean flag1, boolean flag2) {
|
||||
@ -520,7 +521,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -752,8 +1020,9 @@
|
||||
@@ -754,8 +1022,9 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
|
||||
}
|
||||
|
||||
@ -531,7 +532,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -768,6 +1037,17 @@
|
||||
@@ -770,6 +1039,17 @@
|
||||
this.nextContainerCounter();
|
||||
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
|
||||
|
||||
@ -549,7 +550,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.a((new ChatMessage("container.spectatorCantOpen", new Object[0])).a(EnumChatFormat.RED), true);
|
||||
@@ -775,9 +1055,11 @@
|
||||
@@ -777,9 +1057,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@ -563,7 +564,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -790,13 +1072,24 @@
|
||||
@@ -792,13 +1074,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@ -590,7 +591,7 @@
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
@@ -841,6 +1134,11 @@
|
||||
@@ -843,6 +1136,11 @@
|
||||
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
|
||||
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
|
||||
@ -602,7 +603,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -850,6 +1148,7 @@
|
||||
@@ -852,6 +1150,7 @@
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
@ -610,7 +611,7 @@
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
|
||||
this.m();
|
||||
}
|
||||
@@ -884,7 +1183,7 @@
|
||||
@@ -886,7 +1185,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic, int i) {
|
||||
this.serverStatisticManager.b(this, statistic, i);
|
||||
@ -619,7 +620,7 @@
|
||||
scoreboardscore.addScore(i);
|
||||
});
|
||||
}
|
||||
@@ -892,7 +1191,7 @@
|
||||
@@ -894,7 +1193,7 @@
|
||||
@Override
|
||||
public void a(Statistic<?> statistic) {
|
||||
this.serverStatisticManager.setStatistic(this, statistic, 0);
|
||||
@ -628,7 +629,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -941,7 +1240,16 @@
|
||||
@@ -943,7 +1242,16 @@
|
||||
|
||||
public void triggerHealthUpdate() {
|
||||
this.lastHealthSent = -1.0E8F;
|
||||
@ -645,7 +646,7 @@
|
||||
|
||||
@Override
|
||||
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
@@ -996,12 +1304,14 @@
|
||||
@@ -998,12 +1306,14 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastHealthSent = -1.0F;
|
||||
this.lastFoodSent = -1;
|
||||
@ -661,7 +662,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1063,6 +1373,18 @@
|
||||
@@ -1065,6 +1375,18 @@
|
||||
|
||||
@Override
|
||||
public void a(EnumGamemode enumgamemode) {
|
||||
@ -680,7 +681,7 @@
|
||||
this.playerInteractManager.setGameMode(enumgamemode);
|
||||
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
|
||||
if (enumgamemode == EnumGamemode.SPECTATOR) {
|
||||
@@ -1113,6 +1435,17 @@
|
||||
@@ -1115,6 +1437,17 @@
|
||||
}
|
||||
|
||||
public void a(PacketPlayInSettings packetplayinsettings) {
|
||||
@ -698,7 +699,7 @@
|
||||
this.locale = packetplayinsettings.b();
|
||||
this.ck = packetplayinsettings.d();
|
||||
this.cl = packetplayinsettings.e();
|
||||
@@ -1149,13 +1482,13 @@
|
||||
@@ -1151,13 +1484,13 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
|
||||
} else {
|
||||
@ -714,7 +715,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1179,7 +1512,7 @@
|
||||
@@ -1181,7 +1514,7 @@
|
||||
this.spectatedEntity = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.spectatedEntity) {
|
||||
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
|
||||
@ -723,7 +724,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1208,7 +1541,7 @@
|
||||
@@ -1210,7 +1543,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
@ -732,7 +733,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1226,21 +1559,33 @@
|
||||
@@ -1228,21 +1561,33 @@
|
||||
}
|
||||
|
||||
public void J() {
|
||||
@ -766,7 +767,7 @@
|
||||
if (worldserver == this.world) {
|
||||
this.playerConnection.a(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1263,6 +1608,9 @@
|
||||
@@ -1265,6 +1610,9 @@
|
||||
this.server.getPlayerList().a(this, worldserver);
|
||||
this.server.getPlayerList().updateClient(this);
|
||||
}
|
||||
@ -776,7 +777,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1314,4 +1662,144 @@
|
||||
@@ -1316,4 +1664,144 @@
|
||||
return entityitem;
|
||||
}
|
||||
}
|
||||
@ -883,7 +884,7 @@
|
||||
+
|
||||
+ public void reset() {
|
||||
+ float exp = 0;
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory");
|
||||
+ boolean keepInventory = this.world.getGameRules().getBoolean(GameRules.KEEP_INVENTORY);
|
||||
+
|
||||
+ if (this.keepLevel || keepInventory) {
|
||||
+ exp = this.exp;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityRabbit.java
|
||||
+++ b/net/minecraft/server/EntityRabbit.java
|
||||
@@ -16,8 +16,14 @@
|
||||
@@ -17,8 +17,14 @@
|
||||
super(entitytypes, world);
|
||||
this.bt = new EntityRabbit.ControllerJumpRabbit(this);
|
||||
this.moveController = new EntityRabbit.ControllerMoveRabbit(this);
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
@Override
|
||||
protected void initPathfinder() {
|
||||
@@ -285,7 +291,7 @@
|
||||
@@ -286,7 +292,7 @@
|
||||
if (i == 99) {
|
||||
this.getAttributeInstance(GenericAttributes.ARMOR).setValue(8.0D);
|
||||
this.goalSelector.a(4, new EntityRabbit.PathfinderGoalKillerRabbitMeleeAttack(this));
|
||||
@ -24,7 +24,7 @@
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityWolf.class, true));
|
||||
if (!this.hasCustomName()) {
|
||||
@@ -413,9 +419,23 @@
|
||||
@@ -409,9 +415,23 @@
|
||||
Integer integer = (Integer) iblockdata.get(BlockCarrots.AGE);
|
||||
|
||||
if (integer == 0) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityRaider.java
|
||||
+++ b/net/minecraft/server/EntityRaider.java
|
||||
@@ -396,7 +396,7 @@
|
||||
@@ -397,7 +397,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityRaider entityraider = (EntityRaider) iterator.next();
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -413,7 +413,7 @@
|
||||
@@ -414,7 +414,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityRaider entityraider = (EntityRaider) iterator.next();
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
entityraider.q(true);
|
||||
}
|
||||
|
||||
@@ -487,7 +487,7 @@
|
||||
@@ -488,7 +488,7 @@
|
||||
|
||||
private final T b;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true));
|
||||
}
|
||||
|
||||
@@ -167,6 +167,11 @@
|
||||
@@ -161,6 +161,11 @@
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
|
||||
if (BlockMonsterEggs.j(iblockdata)) {
|
||||
@ -21,7 +21,7 @@
|
||||
world.setTypeAndData(blockposition, BlockMonsterEggs.e(iblockdata.getBlock()), 3);
|
||||
this.a.doSpawnEffect();
|
||||
this.a.die();
|
||||
@@ -213,6 +218,11 @@
|
||||
@@ -207,6 +212,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockMonsterEggs) {
|
||||
@ -30,6 +30,6 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (world.getGameRules().getBoolean("mobGriefing")) {
|
||||
if (world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
world.b(blockposition1, true);
|
||||
} else {
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/EntitySlime.java
|
||||
+++ b/net/minecraft/server/EntitySlime.java
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
+// CraftBukkit start
|
||||
+import java.util.ArrayList;
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
@@ -138,7 +145,7 @@
|
||||
@@ -139,7 +146,7 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getEntityType() {
|
||||
@ -23,7 +23,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,6 +155,19 @@
|
||||
@@ -149,6 +156,19 @@
|
||||
if (!this.world.isClientSide && i > 1 && this.getHealth() <= 0.0F) {
|
||||
int j = 2 + this.random.nextInt(3);
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
for (int k = 0; k < j; ++k) {
|
||||
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
|
||||
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
|
||||
@@ -163,8 +183,18 @@
|
||||
@@ -164,8 +184,18 @@
|
||||
|
||||
entityslime.setSize(i / 2, true);
|
||||
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
|
@ -14,16 +14,16 @@
|
||||
super(EntityTypes.SMALL_FIREBALL, entityliving, d0, d1, d2, world);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.shooter != null && this.shooter instanceof EntityInsentient) {
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean("mobGriefing");
|
||||
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
|
||||
@@ -21,18 +28,27 @@
|
||||
Entity entity = ((MovingObjectPositionEntity) movingobjectposition).getEntity();
|
||||
|
||||
@@ -23,7 +30,16 @@
|
||||
if (!entity.isFireProof()) {
|
||||
int i = entity.ad();
|
||||
|
||||
- entity.setOnFire(5);
|
||||
+ // CraftBukkit start - Entity damage by entity event + combust event
|
||||
+ if (isIncendiary) {
|
||||
@ -38,10 +38,11 @@
|
||||
boolean flag = entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
|
||||
|
||||
if (flag) {
|
||||
this.a(this.shooter, entity);
|
||||
@@ -32,11 +48,11 @@
|
||||
entity.g(i);
|
||||
}
|
||||
}
|
||||
- } else if (this.shooter == null || !(this.shooter instanceof EntityInsentient) || this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
- } else if (this.shooter == null || !(this.shooter instanceof EntityInsentient) || this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
+ } else if (isIncendiary) { // CraftBukkit
|
||||
MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection());
|
||||
|
@ -19,7 +19,7 @@
|
||||
+ this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
||||
}
|
||||
|
||||
if (!this.world.getGameRules().getBoolean("mobGriefing")) {
|
||||
if (!this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
@@ -78,7 +82,7 @@
|
||||
BlockPosition blockposition = new BlockPosition(i, j, k);
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
+ this.die();
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.ax();
|
||||
this.ay();
|
||||
this.world.addParticle(Particles.SMOKE, this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
|
||||
@@ -72,9 +78,16 @@
|
||||
}
|
||||
|
@ -124,9 +124,9 @@
|
||||
- public void a(Consumer<Packet<?>> consumer) {
|
||||
+ public void a(Consumer<Packet<?>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
|
||||
if (this.tracker.dead) {
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching addPacket for removed entity");
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity " + this.tracker);
|
||||
+ // CraftBukkit start - Remove useless error spam, just return
|
||||
+ // EntityTrackerEntry.LOGGER.warn("Fetching addPacket for removed entity")
|
||||
+ // EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity " + this.tracker);
|
||||
+ return;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
--- a/net/minecraft/server/EntityTurtle.java
|
||||
+++ b/net/minecraft/server/EntityTurtle.java
|
||||
@@ -258,7 +258,9 @@
|
||||
@@ -254,7 +254,9 @@
|
||||
protected void l() {
|
||||
super.l();
|
||||
if (!this.isBaby() && this.world.getGameRules().getBoolean("doMobLoot")) {
|
||||
if (!this.isBaby() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.a((IMaterial) Items.SCUTE, 1);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -285,7 +287,9 @@
|
||||
@@ -281,7 +283,9 @@
|
||||
|
||||
@Override
|
||||
public void onLightningStrike(EntityLightning entitylightning) {
|
||||
@ -20,8 +20,8 @@
|
||||
}
|
||||
|
||||
static class g extends NavigationGuardian {
|
||||
@@ -445,8 +449,12 @@
|
||||
} else if (this.g.bH > 200) {
|
||||
@@ -441,8 +445,12 @@
|
||||
} else if (this.g.bG > 200) {
|
||||
World world = this.g.world;
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -33,7 +33,7 @@
|
||||
this.g.r(false);
|
||||
this.g.s(false);
|
||||
this.g.setLoveTicks(600);
|
||||
@@ -532,7 +540,7 @@
|
||||
@@ -528,7 +536,7 @@
|
||||
--this.e;
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityVillager.java
|
||||
+++ b/net/minecraft/server/EntityVillager.java
|
||||
@@ -17,6 +17,16 @@
|
||||
@@ -16,6 +16,16 @@
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
|
||||
|
||||
@@ -62,7 +72,7 @@
|
||||
@@ -58,7 +68,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityVillager> getBehaviorController() {
|
||||
@ -26,16 +26,16 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,7 +136,7 @@
|
||||
@@ -122,7 +132,7 @@
|
||||
@Override
|
||||
protected void mobTick() {
|
||||
this.world.getMethodProfiler().enter("brain");
|
||||
- this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this);
|
||||
+ this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error
|
||||
this.world.getMethodProfiler().exit();
|
||||
if (!this.dY() && this.bE > 0) {
|
||||
if (!this.dZ() && this.bE > 0) {
|
||||
--this.bE;
|
||||
@@ -136,7 +146,7 @@
|
||||
@@ -132,7 +142,7 @@
|
||||
this.bF = false;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +268,14 @@
|
||||
@@ -278,7 +288,14 @@
|
||||
while (iterator.hasNext()) {
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,7 +581,12 @@
|
||||
@@ -598,7 +615,12 @@
|
||||
entitywitch.setCustomNameVisible(this.getCustomNameVisible());
|
||||
}
|
||||
|
||||
@ -74,21 +74,30 @@
|
||||
this.die();
|
||||
}
|
||||
|
||||
@@ -737,7 +759,7 @@
|
||||
|
||||
if (entityirongolem != null) {
|
||||
if (entityirongolem.a((GeneratorAccess) this.world, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.a((IWorldReader) this.world)) {
|
||||
- this.world.addEntity(entityirongolem);
|
||||
+ this.world.addEntity(entityirongolem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE); // CraftBukkit
|
||||
return entityirongolem;
|
||||
}
|
||||
|
||||
@@ -787,7 +809,7 @@
|
||||
EntityVillager.a entityvillager_a = (EntityVillager.a) this.getBehaviorController().getMemory(MemoryModuleType.GOLEM_SPAWN_CONDITIONS).orElseGet(EntityVillager.a::new);
|
||||
|
||||
entityvillager_a.b(this.world.getTime());
|
||||
- this.br.setMemory(MemoryModuleType.GOLEM_SPAWN_CONDITIONS, (Object) entityvillager_a);
|
||||
+ this.br.setMemory(MemoryModuleType.GOLEM_SPAWN_CONDITIONS, entityvillager_a); // CraftBukkit - decompile error
|
||||
@@ -730,7 +752,7 @@
|
||||
}
|
||||
|
||||
public static final class a {
|
||||
private void b(long i) {
|
||||
- this.br.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, (Object) i);
|
||||
+ this.br.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, i); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private boolean c(long i) {
|
||||
@@ -779,7 +801,7 @@
|
||||
|
||||
if (entityirongolem != null) {
|
||||
if (entityirongolem.a((GeneratorAccess) this.world, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.a((IWorldReader) this.world)) {
|
||||
- this.world.addEntity(entityirongolem);
|
||||
+ this.world.addEntity(entityirongolem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE); // CraftBukkit
|
||||
return entityirongolem;
|
||||
}
|
||||
|
||||
@@ -830,7 +852,7 @@
|
||||
@Override
|
||||
public void e(BlockPosition blockposition) {
|
||||
super.e(blockposition);
|
||||
- this.br.setMemory(MemoryModuleType.LAST_SLEPT, (Object) MinecraftSerializableLong.a(this.world.getTime()));
|
||||
+ this.br.setMemory(MemoryModuleType.LAST_SLEPT, MinecraftSerializableLong.a(this.world.getTime())); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private boolean d(long i) {
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
public EntityVillagerAbstract(EntityTypes<? extends EntityVillagerAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -204,7 +219,16 @@
|
||||
@@ -221,7 +236,16 @@
|
||||
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.a(this, this.random);
|
||||
|
||||
if (merchantrecipe != null) {
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b);
|
||||
@@ -188,14 +195,38 @@
|
||||
i = this.dV() - 1;
|
||||
i = this.dW() - 1;
|
||||
if (i <= 0) {
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean("mobGriefing") ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
+ // CraftBukkit start
|
||||
+ // this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, explosion_effect);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
@ -49,7 +49,7 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.q(i);
|
||||
this.r(i);
|
||||
if (this.ticksLived % 10 == 0) {
|
||||
- this.heal(10.0F);
|
||||
+ this.heal(10.0F, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
|
||||
|
@ -32,7 +32,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean("mobGriefing") ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
|
||||
- this.world.createExplosion(this, this.locX, this.locY, this.locZ, 1.0F, false, explosion_effect);
|
||||
+ // CraftBukkit start
|
||||
|
@ -18,7 +18,7 @@
|
||||
this.targetSelector.a(2, new PathfinderGoalOwnerHurtTarget(this));
|
||||
- this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a());
|
||||
+ this.targetSelector.a(3, (new PathfinderGoalHurtByTarget(this, new Class[0])).a(new Class[0])); // CraftBukkit - decompile error
|
||||
this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed<>(this, EntityAnimal.class, false, EntityWolf.bD));
|
||||
this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed<>(this, EntityAnimal.class, false, EntityWolf.bC));
|
||||
this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed<>(this, EntityTurtle.class, false, EntityTurtle.bz));
|
||||
this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntitySkeletonAbstract.class, false));
|
||||
@@ -61,6 +66,22 @@
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/EntityZombieHusk.java
|
||||
+++ b/net/minecraft/server/EntityZombieHusk.java
|
||||
@@ -43,7 +43,7 @@
|
||||
@@ -44,7 +44,7 @@
|
||||
if (flag && this.getItemInMainHand().isEmpty() && entity instanceof EntityLiving) {
|
||||
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
this.a(f);
|
||||
this.foodTickTimer = 0;
|
||||
}
|
||||
} else if (flag && this.foodLevel >= 18 && entityhuman.dP()) {
|
||||
} else if (flag && this.foodLevel >= 18 && entityhuman.dQ()) {
|
||||
++this.foodTickTimer;
|
||||
if (this.foodTickTimer >= 80) {
|
||||
- entityhuman.heal(1.0F);
|
||||
|
@ -19,7 +19,7 @@
|
||||
public FurnaceRecipe(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -10,4 +21,14 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
return RecipeSerializer.o;
|
||||
return RecipeSerializer.p;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/IMerchant.java
|
||||
+++ b/net/minecraft/server/IMerchant.java
|
||||
@@ -40,4 +40,6 @@
|
||||
@@ -44,4 +44,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/InventorySubcontainer.java
|
||||
+++ b/net/minecraft/server/InventorySubcontainer.java
|
||||
@@ -4,13 +4,64 @@
|
||||
import java.util.Iterator;
|
||||
@@ -5,13 +5,64 @@
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
|
@ -7,10 +7,10 @@
|
||||
+ // CraftBukkit start - obfuscator went a little crazy
|
||||
+ /*
|
||||
this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> {
|
||||
return entityliving == null ? 0.0F : (entityliving.dl().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.dm()) / 20.0F);
|
||||
return entityliving == null ? 0.0F : (entityliving.dm().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.dn()) / 20.0F);
|
||||
});
|
||||
this.a(new MinecraftKey("pulling"), (itemstack, world, entityliving) -> {
|
||||
return entityliving != null && entityliving.isHandRaised() && entityliving.dl() == itemstack ? 1.0F : 0.0F;
|
||||
return entityliving != null && entityliving.isHandRaised() && entityliving.dm() == itemstack ? 1.0F : 0.0F;
|
||||
});
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
@ -7,7 +7,7 @@
|
||||
+ // CraftBukkit start - obfuscator went a little crazy
|
||||
+ /*
|
||||
this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> {
|
||||
return entityliving != null && itemstack.getItem() == this ? (d(itemstack) ? 0.0F : (float) (itemstack.k() - entityliving.dm()) / (float) e(itemstack)) : 0.0F;
|
||||
return entityliving != null && itemstack.getItem() == this ? (d(itemstack) ? 0.0F : (float) (itemstack.k() - entityliving.dn()) / (float) e(itemstack)) : 0.0F;
|
||||
});
|
||||
@@ -24,6 +26,8 @@
|
||||
this.a(new MinecraftKey("firework"), (itemstack, world, entityliving) -> {
|
||||
|
@ -7,7 +7,7 @@
|
||||
+ // CraftBukkit start - obfuscator went a little crazy
|
||||
+ /*
|
||||
this.a(new MinecraftKey("throwing"), (itemstack, world, entityliving) -> {
|
||||
return entityliving != null && entityliving.isHandRaised() && entityliving.dl() == itemstack ? 1.0F : 0.0F;
|
||||
return entityliving != null && entityliving.isHandRaised() && entityliving.dm() == itemstack ? 1.0F : 0.0F;
|
||||
});
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
@ -23,18 +23,18 @@
|
||||
private PlayerList playerList;
|
||||
private volatile boolean isRunning = true;
|
||||
private boolean isStopped;
|
||||
@@ -104,7 +111,7 @@
|
||||
@@ -103,7 +110,7 @@
|
||||
private final GameProfileRepository gameProfileRepository;
|
||||
private final UserCache userCache;
|
||||
private long Z;
|
||||
private long Y;
|
||||
- public final Thread serverThread = (Thread) SystemUtils.a((Object) (new Thread(this, "Server thread")), (thread) -> {
|
||||
+ public final Thread serverThread = (Thread) SystemUtils.a((new Thread(this, "Server thread")), (thread) -> { // CraftBukkit - decompile error
|
||||
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
||||
MinecraftServer.LOGGER.error(throwable);
|
||||
});
|
||||
@@ -133,7 +140,21 @@
|
||||
@@ -132,7 +139,21 @@
|
||||
@Nullable
|
||||
private String av;
|
||||
private String au;
|
||||
|
||||
- public MinecraftServer(File file, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) {
|
||||
+ // CraftBukkit start
|
||||
@ -53,11 +53,11 @@
|
||||
+
|
||||
+ public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) {
|
||||
super("Server");
|
||||
this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
|
||||
this.ad = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread);
|
||||
this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new);
|
||||
@@ -146,15 +167,15 @@
|
||||
this.ao = new CustomFunctionData(this);
|
||||
this.ap = new CircularTimer();
|
||||
@@ -145,15 +166,15 @@
|
||||
this.an = new CustomFunctionData(this);
|
||||
this.ao = new CircularTimer();
|
||||
this.proxy = proxy;
|
||||
- this.commandDispatcher = commanddispatcher;
|
||||
+ this.commandDispatcher = this.vanillaCommandDispatcher = commanddispatcher; // CraftBukkit
|
||||
@ -73,12 +73,12 @@
|
||||
- this.convertable = new Convertable(file.toPath(), file.toPath().resolve("../backups"), datafixer);
|
||||
+ // this.convertable = new Convertable(file.toPath(), file.toPath().resolve("../backups"), datafixer); // CraftBukkit - moved to DedicatedServer.init
|
||||
this.dataConverterManager = datafixer;
|
||||
this.ae.a((IReloadListener) this.aj);
|
||||
this.ae.a((IReloadListener) this.ai);
|
||||
@@ -163,7 +184,32 @@
|
||||
this.ae.a((IReloadListener) this.an);
|
||||
this.ad.a((IReloadListener) this.ai);
|
||||
this.ad.a((IReloadListener) this.ah);
|
||||
@@ -162,7 +183,32 @@
|
||||
this.ad.a((IReloadListener) this.am);
|
||||
this.executorService = SystemUtils.e();
|
||||
this.K = s;
|
||||
this.J = s;
|
||||
+ // CraftBukkit start
|
||||
+ this.options = options;
|
||||
+ // Try to see if we're actually running in a terminal, disable jline if not
|
||||
@ -108,7 +108,7 @@
|
||||
|
||||
private void initializeScoreboards(WorldPersistentData worldpersistentdata) {
|
||||
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard");
|
||||
@@ -199,11 +245,11 @@
|
||||
@@ -198,11 +244,11 @@
|
||||
}
|
||||
|
||||
if (this.forceUpgrade) {
|
||||
@ -123,7 +123,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = null;
|
||||
|
||||
while (!worldupgrader.b()) {
|
||||
@@ -242,8 +288,9 @@
|
||||
@@ -241,8 +287,9 @@
|
||||
}
|
||||
|
||||
protected void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) {
|
||||
@ -134,7 +134,7 @@
|
||||
WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this);
|
||||
|
||||
this.a(this.getWorld(), worldnbtstorage);
|
||||
@@ -268,24 +315,134 @@
|
||||
@@ -267,24 +314,134 @@
|
||||
}
|
||||
|
||||
this.a(worldnbtstorage.getDirectory(), worlddata);
|
||||
@ -263,26 +263,26 @@
|
||||
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.worldServer.put(DimensionManager.OVERWORLD, worldserver);
|
||||
- this.initializeScoreboards(worldserver.getWorldPersistentData());
|
||||
- worldserver.getWorldBorder().b(worlddata);
|
||||
- WorldServer worldserver1 = this.getWorldServer(DimensionManager.OVERWORLD);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void initWorld(WorldServer worldserver1, WorldData worlddata, WorldSettings worldsettings) {
|
||||
+ worldserver1.getWorldBorder().b(worlddata);
|
||||
+
|
||||
|
||||
- this.worldServer.put(DimensionManager.OVERWORLD, worldserver);
|
||||
- this.initializeScoreboards(worldserver.getWorldPersistentData());
|
||||
- worldserver.getWorldBorder().b(worlddata);
|
||||
- WorldServer worldserver1 = this.getWorldServer(DimensionManager.OVERWORLD);
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver1.generator != null) {
|
||||
+ worldserver1.getWorld().getPopulators().addAll(worldserver1.generator.getDefaultPopulators(worldserver1.getWorld()));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!worlddata.v()) {
|
||||
if (!worlddata.u()) {
|
||||
try {
|
||||
@@ -309,23 +466,8 @@
|
||||
@@ -308,23 +465,8 @@
|
||||
|
||||
worlddata.d(true);
|
||||
}
|
||||
@ -307,7 +307,7 @@
|
||||
|
||||
private void a(WorldData worlddata) {
|
||||
worlddata.f(false);
|
||||
@@ -344,6 +486,25 @@
|
||||
@@ -343,6 +485,25 @@
|
||||
protected void a(File file, WorldData worlddata) {
|
||||
this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla()));
|
||||
this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks"));
|
||||
@ -333,7 +333,7 @@
|
||||
this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder);
|
||||
this.resourcePackRepository.a();
|
||||
List<ResourcePackLoader> list = Lists.newArrayList();
|
||||
@@ -364,11 +525,18 @@
|
||||
@@ -363,11 +524,18 @@
|
||||
this.b(worlddata);
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
|
||||
worldloadlistener.a(new ChunkCoordIntPair(blockposition));
|
||||
@@ -379,17 +547,21 @@
|
||||
@@ -378,17 +546,21 @@
|
||||
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
|
||||
while (chunkproviderserver.b() != 441) {
|
||||
@ -386,7 +386,7 @@
|
||||
|
||||
if (forcedchunk != null) {
|
||||
WorldServer worldserver1 = this.getWorldServer(dimensionmanager);
|
||||
@@ -404,10 +576,16 @@
|
||||
@@ -403,10 +575,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@
|
||||
}
|
||||
|
||||
protected void a(String s, WorldNBTStorage worldnbtstorage) {
|
||||
@@ -450,14 +628,14 @@
|
||||
@@ -449,14 +627,14 @@
|
||||
} catch (ExceptionWorldConflict exceptionworldconflict) {
|
||||
MinecraftServer.LOGGER.warn(exceptionworldconflict.getMessage());
|
||||
}
|
||||
@ -422,7 +422,7 @@
|
||||
return flag3;
|
||||
}
|
||||
|
||||
@@ -466,8 +644,29 @@
|
||||
@@ -465,8 +643,29 @@
|
||||
this.stop();
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@
|
||||
if (this.getServerConnection() != null) {
|
||||
this.getServerConnection().b();
|
||||
}
|
||||
@@ -476,6 +675,7 @@
|
||||
@@ -475,6 +674,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.savePlayers();
|
||||
this.playerList.shutdown();
|
||||
@ -460,7 +460,7 @@
|
||||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -545,14 +745,16 @@
|
||||
@@ -544,14 +744,16 @@
|
||||
while (this.isRunning) {
|
||||
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
|
||||
|
||||
@ -476,9 +476,9 @@
|
||||
|
||||
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
this.nextTick += 50L;
|
||||
if (this.T) {
|
||||
this.T = false;
|
||||
@@ -599,6 +801,12 @@
|
||||
if (this.S) {
|
||||
this.S = false;
|
||||
@@ -598,6 +800,12 @@
|
||||
} catch (Throwable throwable1) {
|
||||
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
||||
} finally {
|
||||
@ -491,25 +491,24 @@
|
||||
this.exit();
|
||||
}
|
||||
|
||||
@@ -607,9 +815,16 @@
|
||||
@@ -606,8 +814,15 @@
|
||||
}
|
||||
|
||||
private boolean canSleepForTick() {
|
||||
- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick);
|
||||
- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ab ? this.aa : this.nextTick);
|
||||
+ // CraftBukkit start
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick);
|
||||
}
|
||||
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ab ? this.aa : this.nextTick);
|
||||
+ }
|
||||
+
|
||||
+ private void executeModerately() {
|
||||
+ this.executeAll();
|
||||
+ java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
protected void sleepForTick() {
|
||||
this.executeAll();
|
||||
this.awaitTasks(() -> {
|
||||
@@ -709,7 +924,7 @@
|
||||
@@ -708,7 +923,7 @@
|
||||
this.serverPing.b().a(agameprofile);
|
||||
}
|
||||
|
||||
@ -518,7 +517,7 @@
|
||||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.methodProfiler.enter("save");
|
||||
this.playerList.savePlayers();
|
||||
@@ -739,27 +954,43 @@
|
||||
@@ -738,23 +953,40 @@
|
||||
}
|
||||
|
||||
protected void b(BooleanSupplier booleansupplier) {
|
||||
@ -526,8 +525,8 @@
|
||||
this.methodProfiler.enter("commandFunctions");
|
||||
this.getFunctionData().tick();
|
||||
this.methodProfiler.exitEnter("levels");
|
||||
Iterator iterator = this.getWorlds().iterator();
|
||||
|
||||
- WorldServer worldserver;
|
||||
+ // CraftBukkit start
|
||||
+ // Run tasks that are waiting on processing
|
||||
+ while (!processQueue.isEmpty()) {
|
||||
@ -538,21 +537,13 @@
|
||||
+ if (this.ticks % 20 == 0) {
|
||||
+ for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||
+ EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); // Add support for per player time
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // WorldServer worldserver; // CraftBukkit - dropped down
|
||||
long i;
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
- for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();((long[]) this.g.computeIfAbsent(worldserver.worldProvider.getDimensionManager(), (dimensionmanager) -> {
|
||||
- return new long[100];
|
||||
- }))[this.ticks % 100] = SystemUtils.getMonotonicNanos() - i) {
|
||||
- worldserver = (WorldServer) iterator.next();
|
||||
+ // CraftBukkit - dropTickTime
|
||||
+ for (Iterator iterator = this.getWorlds().iterator(); iterator.hasNext();) {
|
||||
+ WorldServer worldserver = (WorldServer) iterator.next();
|
||||
i = SystemUtils.getMonotonicNanos();
|
||||
- if (worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) {
|
||||
+ if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit
|
||||
this.methodProfiler.a(() -> {
|
||||
@ -561,14 +552,14 @@
|
||||
+ /* Drop global time updates
|
||||
if (this.ticks % 20 == 0) {
|
||||
this.methodProfiler.enter("timeSync");
|
||||
this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))), worldserver.worldProvider.getDimensionManager());
|
||||
this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))), worldserver.worldProvider.getDimensionManager());
|
||||
this.methodProfiler.exit();
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.methodProfiler.enter("tick");
|
||||
|
||||
@@ -798,7 +1029,8 @@
|
||||
@@ -793,7 +1025,8 @@
|
||||
this.tickables.add(runnable);
|
||||
}
|
||||
|
||||
@ -578,7 +569,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");
|
||||
@@ -821,15 +1053,17 @@
|
||||
@@ -816,15 +1049,17 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
@ -598,7 +589,7 @@
|
||||
MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'");
|
||||
return;
|
||||
}
|
||||
@@ -841,14 +1075,15 @@
|
||||
@@ -836,14 +1071,15 @@
|
||||
|
||||
DispenserRegistry.init();
|
||||
DispenserRegistry.c();
|
||||
@ -617,7 +608,7 @@
|
||||
dedicatedserver.i((String) optionset.valueOf(optionspec7));
|
||||
dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10));
|
||||
dedicatedserver.e(optionset.has(optionspec2));
|
||||
@@ -871,6 +1106,29 @@
|
||||
@@ -866,6 +1102,29 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
@ -647,7 +638,7 @@
|
||||
} catch (Exception exception) {
|
||||
MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception);
|
||||
}
|
||||
@@ -890,7 +1148,9 @@
|
||||
@@ -885,7 +1144,9 @@
|
||||
}
|
||||
|
||||
public void startServerThread() {
|
||||
@ -657,7 +648,7 @@
|
||||
}
|
||||
|
||||
public File d(String s) {
|
||||
@@ -945,7 +1205,7 @@
|
||||
@@ -940,7 +1201,7 @@
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
@ -666,7 +657,7 @@
|
||||
}
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
@@ -984,7 +1244,7 @@
|
||||
@@ -979,7 +1240,7 @@
|
||||
}
|
||||
|
||||
public boolean E() {
|
||||
@ -675,7 +666,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1480,4 +1740,16 @@
|
||||
@@ -1482,4 +1743,16 @@
|
||||
}
|
||||
|
||||
public abstract boolean b(GameProfile gameprofile);
|
||||
|
@ -53,8 +53,8 @@
|
||||
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if ((this != MobEffects.HEAL || entityliving.cB()) && (this != MobEffects.HARM || !entityliving.cB())) {
|
||||
if (this == MobEffects.HARM && !entityliving.cB() || this == MobEffects.HEAL && entityliving.cB()) {
|
||||
} else if ((this != MobEffects.HEAL || entityliving.cC()) && (this != MobEffects.HARM || !entityliving.cC())) {
|
||||
if (this == MobEffects.HARM && !entityliving.cC() || this == MobEffects.HEAL && entityliving.cC()) {
|
||||
entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
|
||||
}
|
||||
} else {
|
||||
|
@ -32,7 +32,7 @@
|
||||
- this.b.addEntity(entityageable);
|
||||
+ this.b.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
this.b.broadcastEntityEffect(this.animal, (byte) 18);
|
||||
if (this.b.getGameRules().getBoolean("doMobLoot")) {
|
||||
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX, this.animal.locY, this.animal.locZ, this.animal.getRandom().nextInt(7) + 1));
|
||||
+ // CraftBukkit start - use event experience
|
||||
+ if (experience > 0) {
|
||||
|
@ -15,9 +15,9 @@
|
||||
BlockPosition blockposition = new BlockPosition(this.b);
|
||||
|
||||
if (PathfinderGoalEatTile.a.test(this.c.getType(blockposition))) {
|
||||
- if (this.c.getGameRules().getBoolean("mobGriefing")) {
|
||||
- if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) {
|
||||
this.c.b(blockposition, false);
|
||||
}
|
||||
|
||||
@ -25,9 +25,9 @@
|
||||
BlockPosition blockposition1 = blockposition.down();
|
||||
|
||||
if (this.c.getType(blockposition1).getBlock() == Blocks.GRASS_BLOCK) {
|
||||
- if (this.c.getGameRules().getBoolean("mobGriefing")) {
|
||||
- if (this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
+ // CraftBukkit
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean("mobGriefing")).isCancelled()) {
|
||||
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.b, blockposition, Blocks.AIR.getBlockData(), !this.c.getGameRules().getBoolean(GameRules.MOB_GRIEFING)).isCancelled()) {
|
||||
this.c.triggerEffect(2001, blockposition1, Block.getCombinedId(Blocks.GRASS_BLOCK.getBlockData()));
|
||||
this.c.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
- this.e.setGoalTarget(this.e.getLastDamager());
|
||||
+ this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason
|
||||
this.g = this.e.getGoalTarget();
|
||||
this.c = this.e.cs();
|
||||
this.c = this.e.ct();
|
||||
this.h = 300;
|
||||
@@ -95,6 +95,6 @@
|
||||
}
|
||||
|
@ -6,6 +6,6 @@
|
||||
if (!this.entity.isTamed()) {
|
||||
- return false;
|
||||
+ return this.willSit && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.entity.au()) {
|
||||
} else if (this.entity.av()) {
|
||||
return false;
|
||||
} else if (!this.entity.onGround) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c());
|
||||
|
||||
@@ -72,9 +81,9 @@
|
||||
@@ -76,9 +85,9 @@
|
||||
@Nullable
|
||||
public Chunk getChunk() {
|
||||
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.a();
|
||||
@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
public CompletableFuture<IChunkAccess> getChunkSave() {
|
||||
@@ -197,7 +206,7 @@
|
||||
@@ -201,7 +210,7 @@
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(i);
|
||||
|
||||
if (completablefuture != null) {
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
if (either == null || either.left().isPresent()) {
|
||||
return completablefuture;
|
||||
@@ -252,6 +261,21 @@
|
||||
@@ -256,6 +265,21 @@
|
||||
boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET;
|
||||
PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel);
|
||||
PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel);
|
||||
@ -68,7 +68,7 @@
|
||||
CompletableFuture completablefuture;
|
||||
|
||||
if (flag) {
|
||||
@@ -283,7 +307,7 @@
|
||||
@@ -287,7 +311,7 @@
|
||||
if (flag2 && !flag3) {
|
||||
completablefuture = this.fullChunkFuture;
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
@ -77,9 +77,9 @@
|
||||
playerchunkmap.getClass();
|
||||
return either1.ifLeft(playerchunkmap::a);
|
||||
}));
|
||||
@@ -321,6 +345,17 @@
|
||||
@@ -325,6 +349,17 @@
|
||||
|
||||
this.w.a(this.location, this::j, this.ticketLevel, this::d);
|
||||
this.w.a(this.location, this::k, this.ticketLevel, this::d);
|
||||
this.oldTicketLevel = this.ticketLevel;
|
||||
+ // CraftBukkit start
|
||||
+ // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -38,6 +38,7 @@
|
||||
@@ -37,6 +37,7 @@
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
||||
@@ -186,9 +187,12 @@
|
||||
@@ -184,9 +185,12 @@
|
||||
|
||||
return completablefuture1.thenApply((list1) -> {
|
||||
List<IChunkAccess> list2 = Lists.newArrayList();
|
||||
@ -23,7 +23,7 @@
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
Optional<IChunkAccess> optional = either.left();
|
||||
|
||||
@@ -286,7 +290,7 @@
|
||||
@@ -284,7 +288,7 @@
|
||||
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.x.getName());
|
||||
} else {
|
||||
this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
|
||||
this.saveChunk(ichunkaccess);
|
||||
@@ -297,7 +301,6 @@
|
||||
@@ -295,7 +299,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
@ -40,7 +40,7 @@
|
||||
protected void unloadChunks(BooleanSupplier booleansupplier) {
|
||||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
|
||||
@@ -336,7 +339,7 @@
|
||||
@@ -334,7 +337,7 @@
|
||||
|
||||
private void a(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkSave();
|
||||
@ -49,7 +49,7 @@
|
||||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -485,7 +488,7 @@
|
||||
@@ -483,7 +486,7 @@
|
||||
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
|
||||
});
|
||||
}, (runnable) -> {
|
||||
@ -58,8 +58,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -566,7 +569,7 @@
|
||||
long i = playerchunk.h().pair();
|
||||
@@ -564,7 +567,7 @@
|
||||
long i = playerchunk.i().pair();
|
||||
|
||||
playerchunk.getClass();
|
||||
- mailbox.a((Object) ChunkTaskQueueSorter.a(runnable, i, playerchunk::getTicketLevel));
|
||||
@ -67,7 +67,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -583,7 +586,7 @@
|
||||
@@ -581,7 +584,7 @@
|
||||
return Either.left(chunk);
|
||||
});
|
||||
}, (runnable) -> {
|
||||
@ -76,7 +76,7 @@
|
||||
});
|
||||
|
||||
completablefuture1.thenAcceptAsync((either) -> {
|
||||
@@ -597,7 +600,7 @@
|
||||
@@ -595,7 +598,7 @@
|
||||
return Either.left(chunk);
|
||||
});
|
||||
}, (runnable) -> {
|
||||
@ -85,7 +85,7 @@
|
||||
});
|
||||
return completablefuture1;
|
||||
}
|
||||
@@ -611,7 +614,7 @@
|
||||
@@ -609,7 +612,7 @@
|
||||
return chunk;
|
||||
});
|
||||
}, (runnable) -> {
|
||||
@ -94,19 +94,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
@@ -675,9 +678,10 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = playerchunk.h();
|
||||
Packet<?>[] apacket = new Packet[2];
|
||||
|
||||
+ int finall = l; // CraftBukkit - decompile error
|
||||
this.a(chunkcoordintpair, false).forEach((entityplayer) -> {
|
||||
int i1 = b(chunkcoordintpair, entityplayer, true);
|
||||
- boolean flag = i1 <= l;
|
||||
+ boolean flag = i1 <= finall; // CraftBukkit - decompile error
|
||||
boolean flag1 = i1 <= this.viewDistance;
|
||||
|
||||
this.sendChunk(entityplayer, chunkcoordintpair, apacket, flag, flag1);
|
||||
@@ -732,7 +736,7 @@
|
||||
@@ -724,7 +727,7 @@
|
||||
private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
|
||||
|
||||
@ -115,7 +103,7 @@
|
||||
}
|
||||
|
||||
boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1052,7 +1056,7 @@
|
||||
@@ -1056,7 +1059,7 @@
|
||||
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
@ -124,7 +112,7 @@
|
||||
this.tracker = entity;
|
||||
this.trackingDistance = i;
|
||||
this.e = SectionPosition.a(entity);
|
||||
@@ -1121,6 +1125,17 @@
|
||||
@@ -1125,6 +1128,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@
|
||||
+ speed = player.abilities.walkSpeed * 10f;
|
||||
+ }
|
||||
+
|
||||
if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean("disableElytraMovementCheck") || !this.player.isGliding())) {
|
||||
if (!this.player.H() && (!this.player.getWorldServer().getGameRules().getBoolean(GameRules.DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isGliding())) {
|
||||
float f2 = this.player.isGliding() ? 300.0F : 100.0F;
|
||||
|
||||
- if (d11 - d10 > (double) (f2 * (float) i) && !this.isExemptPlayer()) {
|
||||
@ -1173,7 +1173,7 @@
|
||||
+ // CraftBukkit end
|
||||
} else if (packetplayinuseentity.b() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT_AT) {
|
||||
enumhand = packetplayinuseentity.c();
|
||||
entity.a(this.player, packetplayinuseentity.d(), enumhand);
|
||||
entity.a((EntityHuman) this.player, packetplayinuseentity.d(), enumhand);
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
|
||||
+ this.player.updateInventory(this.player.activeContainer);
|
||||
|
@ -99,9 +99,9 @@
|
||||
this.a(entityplayer, (EntityPlayer) null, worldserver);
|
||||
PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer);
|
||||
|
||||
- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, worldserver.getGameRules().getBoolean("reducedDebugInfo")));
|
||||
- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO)));
|
||||
+ // CraftBukkit - getType()
|
||||
+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, worldserver.getGameRules().getBoolean("reducedDebugInfo")));
|
||||
+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), this.viewDistance, worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO)));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
||||
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
@ -624,7 +624,7 @@
|
||||
+ WorldBorder worldborder = entityplayer.world.getWorldBorder(); // CraftBukkit
|
||||
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE));
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)));
|
||||
@@ -640,17 +914,26 @@
|
||||
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition));
|
||||
@ -650,7 +650,7 @@
|
||||
+ entityplayer.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
|
||||
+ // CraftBukkit start - from GameRules
|
||||
+ int i = entityplayer.world.getGameRules().get("reducedDebugInfo").getBooleanValue() ? 22 : 23;
|
||||
+ int i = entityplayer.world.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) i));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
public RecipeBlasting(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -10,4 +18,16 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
return RecipeSerializer.p;
|
||||
return RecipeSerializer.q;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/server/RecipeBookServer.java
|
||||
+++ b/net/minecraft/server/RecipeBookServer.java
|
||||
@@ -8,6 +8,7 @@
|
||||
import java.util.Optional;
|
||||
@@ -9,6 +9,7 @@
|
||||
import java.util.function.Consumer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
|
||||
public class RecipeBookServer extends RecipeBook {
|
||||
|
||||
@@ -27,7 +28,7 @@
|
||||
@@ -28,7 +29,7 @@
|
||||
IRecipe<?> irecipe = (IRecipe) iterator.next();
|
||||
MinecraftKey minecraftkey = irecipe.getKey();
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
this.a(minecraftkey);
|
||||
this.c(minecraftkey);
|
||||
list.add(minecraftkey);
|
||||
@@ -61,6 +62,7 @@
|
||||
@@ -62,6 +63,7 @@
|
||||
}
|
||||
|
||||
private void a(PacketPlayOutRecipes.Action packetplayoutrecipes_action, EntityPlayer entityplayer, List<MinecraftKey> list) {
|
||||
|
@ -16,7 +16,7 @@
|
||||
public RecipeCampfire(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -10,4 +18,16 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
return RecipeSerializer.r;
|
||||
return RecipeSerializer.s;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
35
nms-patches/RecipeRepair.patch
Normal file
35
nms-patches/RecipeRepair.patch
Normal file
@ -0,0 +1,35 @@
|
||||
--- a/net/minecraft/server/RecipeRepair.java
|
||||
+++ b/net/minecraft/server/RecipeRepair.java
|
||||
@@ -2,12 +2,15 @@
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
+import java.util.stream.Stream; // CraftBukkit
|
||||
|
||||
-public class RecipeRepair extends IRecipeComplex {
|
||||
+public class RecipeRepair extends ShapelessRecipes { // CraftBukkit - added extends
|
||||
|
||||
+ // CraftBukkit start - Delegate to new parent class
|
||||
public RecipeRepair(MinecraftKey minecraftkey) {
|
||||
- super(minecraftkey);
|
||||
+ super(minecraftkey, "", new ItemStack(Items.LEATHER_HELMET), NonNullList.a(RecipeItemStack.a, RecipeItemStack.a(Items.LEATHER_HELMET)));
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public boolean a(InventoryCrafting inventorycrafting, World world) {
|
||||
List<ItemStack> list = Lists.newArrayList();
|
||||
@@ -67,6 +70,14 @@
|
||||
ItemStack itemstack3 = new ItemStack(itemstack2.getItem());
|
||||
|
||||
itemstack3.setDamage(i1);
|
||||
+ // CraftBukkit start - Construct a dummy repair recipe
|
||||
+ NonNullList<RecipeItemStack> ingredients = NonNullList.a();
|
||||
+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack2.cloneItemStack()))));
|
||||
+ ingredients.add(new RecipeItemStack(Stream.of(new RecipeItemStack.StackProvider(itemstack.cloneItemStack()))));
|
||||
+ ShapelessRecipes recipe = new ShapelessRecipes(new MinecraftKey("repairitem"), "", itemstack3.cloneItemStack(), ingredients);
|
||||
+ inventorycrafting.setCurrentRecipe(recipe);
|
||||
+ itemstack3 = org.bukkit.craftbukkit.event.CraftEventFactory.callPreCraftEvent(inventorycrafting, inventorycrafting.resultInventory, itemstack3, inventorycrafting.container.getBukkitView(), true);
|
||||
+ // CraftBukkit end
|
||||
return itemstack3;
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
public RecipeSmoking(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -10,4 +18,16 @@
|
||||
public RecipeSerializer<?> getRecipeSerializer() {
|
||||
return RecipeSerializer.q;
|
||||
return RecipeSerializer.r;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -24,10 +24,10 @@
|
||||
+ ++i2;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (i >= entityinsentient.dC()) {
|
||||
if (i >= entityinsentient.dD()) {
|
||||
return;
|
||||
}
|
||||
@@ -210,7 +217,7 @@
|
||||
@@ -212,7 +219,7 @@
|
||||
|
||||
if (entityinsentient.a(generatoraccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) generatoraccess)) {
|
||||
groupdataentity = entityinsentient.prepare(generatoraccess, generatoraccess.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/TagRegistry.java
|
||||
+++ b/net/minecraft/server/TagRegistry.java
|
||||
@@ -65,7 +65,7 @@
|
||||
@@ -58,7 +58,7 @@
|
||||
CompletableFuture<Map<MinecraftKey, Tag.a<Item>>> completablefuture1 = this.b.a(iresourcemanager, executor);
|
||||
CompletableFuture<Map<MinecraftKey, Tag.a<FluidType>>> completablefuture2 = this.c.a(iresourcemanager, executor);
|
||||
CompletableFuture<Map<MinecraftKey, Tag.a<EntityTypes<?>>>> completablefuture3 = this.d.a(iresourcemanager, executor);
|
||||
@ -9,7 +9,7 @@
|
||||
return new TagRegistry.a((Map) pair.getFirst(), (Map) pair.getSecond(), (Map) pair1.getFirst(), (Map) pair1.getSecond());
|
||||
});
|
||||
|
||||
@@ -80,6 +80,12 @@
|
||||
@@ -72,6 +72,12 @@
|
||||
TagsItem.a((Tags) this.b);
|
||||
TagsFluid.a((Tags) this.c);
|
||||
TagsEntity.a((Tags) this.d);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/TagsServer.java
|
||||
+++ b/net/minecraft/server/TagsServer.java
|
||||
@@ -9,6 +9,7 @@
|
||||
@@ -8,6 +8,7 @@
|
||||
public class TagsServer<T> extends Tags<T> {
|
||||
|
||||
private final IRegistry<T> a;
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
public TagsServer(IRegistry<T> iregistry, String s, String s1) {
|
||||
super(iregistry::getOptional, s, false, s1);
|
||||
@@ -27,7 +28,7 @@
|
||||
@@ -28,7 +29,7 @@
|
||||
Iterator iterator1 = ((Tag) entry.getValue()).a().iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@ -17,12 +17,3 @@
|
||||
|
||||
packetdataserializer.d(this.a.a(t0));
|
||||
}
|
||||
@@ -47,7 +48,7 @@
|
||||
list.add(this.a.fromId(packetdataserializer.i()));
|
||||
}
|
||||
|
||||
- this.c().put(minecraftkey, Tag.a.a().a((Collection) list).b(minecraftkey));
|
||||
+ this.c().put(minecraftkey, (Tag<T>) Tag.a.a().a((Collection) list).b(minecraftkey)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
public TileEntityBeacon() {
|
||||
super(TileEntityTypes.BEACON);
|
||||
@@ -192,39 +208,78 @@
|
||||
super.W_();
|
||||
super.V_();
|
||||
}
|
||||
|
||||
- private void applyEffects() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/VillageSiege.java
|
||||
+++ b/net/minecraft/server/VillageSiege.java
|
||||
@@ -102,7 +102,7 @@
|
||||
@@ -101,7 +101,7 @@
|
||||
}
|
||||
|
||||
entityzombie.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, this.a.random.nextFloat() * 360.0F, 0.0F);
|
||||
|
@ -12,23 +12,23 @@
|
||||
|
||||
public class WorldData {
|
||||
|
||||
@@ -68,6 +73,7 @@
|
||||
private UUID X;
|
||||
private final GameRules Y;
|
||||
private final CustomFunctionCallbackTimerQueue<MinecraftServer> Z;
|
||||
@@ -67,6 +72,7 @@
|
||||
private UUID W;
|
||||
private final GameRules X;
|
||||
private final CustomFunctionCallbackTimerQueue<MinecraftServer> Y;
|
||||
+ public WorldServer world; // CraftBukkit
|
||||
|
||||
protected WorldData() {
|
||||
this.f = WorldType.NORMAL;
|
||||
@@ -419,6 +425,7 @@
|
||||
nbttagcompound.setString("WanderingTraderId", this.X.toString());
|
||||
@@ -418,6 +424,7 @@
|
||||
nbttagcompound.setString("WanderingTraderId", this.W.toString());
|
||||
}
|
||||
|
||||
+ nbttagcompound.setString("Bukkit.Version", Bukkit.getName() + "/" + Bukkit.getVersion() + "/" + Bukkit.getBukkitVersion()); // CraftBukkit
|
||||
}
|
||||
|
||||
public long getSeed() {
|
||||
@@ -508,6 +515,20 @@
|
||||
@@ -506,6 +513,20 @@
|
||||
}
|
||||
|
||||
public void setThundering(boolean flag) {
|
||||
@ -49,7 +49,7 @@
|
||||
this.thundering = flag;
|
||||
}
|
||||
|
||||
@@ -524,6 +545,20 @@
|
||||
@@ -522,6 +543,20 @@
|
||||
}
|
||||
|
||||
public void setStorm(boolean flag) {
|
||||
@ -70,10 +70,10 @@
|
||||
this.raining = flag;
|
||||
}
|
||||
|
||||
@@ -673,6 +708,12 @@
|
||||
@@ -671,6 +706,12 @@
|
||||
|
||||
public void setDifficulty(EnumDifficulty enumdifficulty) {
|
||||
this.G = enumdifficulty;
|
||||
this.F = enumdifficulty;
|
||||
+ // CraftBukkit start
|
||||
+ PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.getDifficulty(), this.isDifficultyLocked());
|
||||
+ for (EntityPlayer player : (java.util.List<EntityPlayer>) (java.util.List) world.getPlayers()) {
|
||||
@ -83,9 +83,9 @@
|
||||
}
|
||||
|
||||
public boolean isDifficultyLocked() {
|
||||
@@ -777,4 +818,12 @@
|
||||
@@ -775,4 +816,12 @@
|
||||
public void a(UUID uuid) {
|
||||
this.X = uuid;
|
||||
this.W = uuid;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Check if the name stored in NBT is the correct one
|
||||
|
@ -35,15 +35,15 @@
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, boolean flag, boolean flag1, DimensionManager dimensionmanager) {
|
||||
@@ -47,7 +66,31 @@
|
||||
|
||||
@@ -48,7 +67,30 @@
|
||||
@Override
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
- this.map = DimensionManager.a(nbttagcompound.getInt("dimension"));
|
||||
int i = nbttagcompound.getInt("dimension");
|
||||
- DimensionManager dimensionmanager = DimensionManager.a(i);
|
||||
+ // CraftBukkit start
|
||||
+ int dimension = nbttagcompound.getInt("dimension");
|
||||
+ DimensionManager dimensionmanager = null;
|
||||
+
|
||||
+ if (dimension >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
|
||||
+ if (i >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
|
||||
+ long least = nbttagcompound.getLong("UUIDLeast");
|
||||
+ long most = nbttagcompound.getLong("UUIDMost");
|
||||
+
|
||||
@ -55,20 +55,19 @@
|
||||
+ if (world == null) {
|
||||
+ /* All Maps which do not have their valid world loaded are set to a dimension which hopefully won't be reached.
|
||||
+ This is to prevent them being corrupted with the wrong map data. */
|
||||
+ this.map = new DimensionManager(127, null, null, null, false, DimensionManager.OVERWORLD);
|
||||
+ dimensionmanager = new DimensionManager(127, null, null, null, false, DimensionManager.OVERWORLD);
|
||||
+ } else {
|
||||
+ this.map = world.getHandle().getWorldProvider().getDimensionManager();
|
||||
+ dimensionmanager = world.getHandle().getWorldProvider().getDimensionManager();
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ this.map = DimensionManager.a(dimension);
|
||||
+ dimensionmanager = DimensionManager.a(i);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.centerX = nbttagcompound.getInt("xCenter");
|
||||
this.centerZ = nbttagcompound.getInt("zCenter");
|
||||
this.scale = (byte) MathHelper.clamp(nbttagcompound.getByte("scale"), 0, 4);
|
||||
@@ -81,6 +124,25 @@
|
||||
|
||||
if (dimensionmanager == null) {
|
||||
throw new IllegalArgumentException("Invalid map dimension: " + i);
|
||||
@@ -88,6 +130,25 @@
|
||||
|
||||
@Override
|
||||
public NBTTagCompound b(NBTTagCompound nbttagcompound) {
|
||||
@ -94,7 +93,7 @@
|
||||
nbttagcompound.setInt("dimension", this.map.getDimensionID());
|
||||
nbttagcompound.setInt("xCenter", this.centerX);
|
||||
nbttagcompound.setInt("zCenter", this.centerZ);
|
||||
@@ -372,12 +434,25 @@
|
||||
@@ -379,12 +440,25 @@
|
||||
|
||||
@Nullable
|
||||
public Packet<?> a(ItemStack itemstack) {
|
||||
|
@ -27,7 +27,7 @@
|
||||
+ // Add env and gen to constructor
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
|
||||
super(worlddata, dimensionmanager, (world, worldprovider) -> {
|
||||
- return new ChunkProviderServer((WorldServer) world, worldnbtstorage.getDirectory(), worldnbtstorage.getDataFixer(), worldnbtstorage.f(), executor, worldprovider.getChunkGenerator(), minecraftserver.getPlayerList().getViewDistance(), minecraftserver.getPlayerList().getViewDistance() - 2, worldloadlistener, () -> {
|
||||
- return new ChunkProviderServer((WorldServer) world, worldnbtstorage.getDirectory(), worldnbtstorage.getDataFixer(), worldnbtstorage.f(), executor, worldprovider.getChunkGenerator(), minecraftserver.getPlayerList().getViewDistance(), worldloadlistener, () -> {
|
||||
+ // CraftBukkit start
|
||||
+ ChunkGenerator<?> chunkGenerator;
|
||||
+
|
||||
@ -37,7 +37,7 @@
|
||||
+ chunkGenerator = worldprovider.getChunkGenerator();
|
||||
+ }
|
||||
+
|
||||
+ return new ChunkProviderServer((WorldServer) world, worldnbtstorage.getDirectory(), worldnbtstorage.getDataFixer(), worldnbtstorage.f(), executor, chunkGenerator, minecraftserver.getPlayerList().getViewDistance(), minecraftserver.getPlayerList().getViewDistance() - 2, worldloadlistener, () -> {
|
||||
+ return new ChunkProviderServer((WorldServer) world, worldnbtstorage.getDirectory(), worldnbtstorage.getDataFixer(), worldnbtstorage.f(), executor, chunkGenerator, minecraftserver.getPlayerList().getViewDistance(), worldloadlistener, () -> {
|
||||
return minecraftserver.getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData();
|
||||
});
|
||||
- }, gameprofilerfiller, false);
|
||||
@ -102,7 +102,7 @@
|
||||
+ return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit
|
||||
})) {
|
||||
this.D = false;
|
||||
if (this.getGameRules().getBoolean("doDaylightCycle")) {
|
||||
if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
||||
@@ -225,7 +274,7 @@
|
||||
this.ae();
|
||||
this.ticking = false;
|
||||
@ -266,8 +266,8 @@
|
||||
+ // CraftBukkit end
|
||||
EnumCreatureType enumcreaturetype = entity.getEntityType().d();
|
||||
|
||||
if (enumcreaturetype != EnumCreatureType.MISC && this.getChunkProvider().a(entity)) {
|
||||
@@ -732,11 +826,24 @@
|
||||
if (enumcreaturetype != EnumCreatureType.MISC && this.getChunkProvider().b(entity)) {
|
||||
@@ -730,11 +824,24 @@
|
||||
|
||||
@Override
|
||||
public boolean addEntity(Entity entity) {
|
||||
@ -294,7 +294,7 @@
|
||||
}
|
||||
|
||||
public void addEntityTeleport(Entity entity) {
|
||||
@@ -786,13 +893,18 @@
|
||||
@@ -784,13 +891,18 @@
|
||||
this.registerEntity(entityplayer);
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@
|
||||
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX / 16.0D), MathHelper.floor(entity.locZ / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
|
||||
|
||||
if (!(ichunkaccess instanceof Chunk)) {
|
||||
@@ -820,7 +932,7 @@
|
||||
@@ -818,7 +930,7 @@
|
||||
if (entity1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
@ -324,7 +324,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -875,6 +987,7 @@
|
||||
@@ -873,6 +985,7 @@
|
||||
this.I.remove(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@
|
||||
}
|
||||
|
||||
private void registerEntity(Entity entity) {
|
||||
@@ -898,6 +1011,7 @@
|
||||
@@ -896,6 +1009,7 @@
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.I.add(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
@ -340,7 +340,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -928,6 +1042,18 @@
|
||||
@@ -926,6 +1040,18 @@
|
||||
}
|
||||
|
||||
public void strikeLightning(EntityLightning entitylightning) {
|
||||
@ -359,7 +359,7 @@
|
||||
this.globalEntityList.add(entitylightning);
|
||||
this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning));
|
||||
}
|
||||
@@ -936,6 +1062,12 @@
|
||||
@@ -934,6 +1060,12 @@
|
||||
public void a(int i, BlockPosition blockposition, int j) {
|
||||
Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
|
||||
|
||||
@ -372,7 +372,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -944,6 +1076,12 @@
|
||||
@@ -942,6 +1074,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.locY;
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.locZ;
|
||||
|
||||
@ -385,7 +385,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1004,6 +1142,14 @@
|
||||
@@ -1002,6 +1140,14 @@
|
||||
|
||||
@Override
|
||||
public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
|
||||
@ -400,7 +400,7 @@
|
||||
Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect);
|
||||
|
||||
if (damagesource != null) {
|
||||
@@ -1012,6 +1158,8 @@
|
||||
@@ -1010,6 +1156,8 @@
|
||||
|
||||
explosion.a();
|
||||
explosion.a(false);
|
||||
@ -409,7 +409,7 @@
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
explosion.clearBlocks();
|
||||
}
|
||||
@@ -1076,13 +1224,20 @@
|
||||
@@ -1074,13 +1222,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@ -432,7 +432,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1165,7 +1320,13 @@
|
||||
@@ -1163,7 +1318,13 @@
|
||||
@Override
|
||||
public WorldMap a(String s) {
|
||||
return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> {
|
||||
|
4
pom.xml
4
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.14.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.14.3-pre4-SNAPSHOT</version>
|
||||
<name>CraftBukkit</name>
|
||||
<url>https://www.spigotmc.org/</url>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<skipTests>true</skipTests>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<api.version>unknown</api.version>
|
||||
<minecraft.version>1.14.2</minecraft.version>
|
||||
<minecraft.version>1.14.3-pre4</minecraft.version>
|
||||
<minecraft_version>1_14_R1</minecraft_version>
|
||||
<buildtag.prefix>git-Bukkit-</buildtag.prefix>
|
||||
<buildtag.suffix></buildtag.suffix>
|
||||
|
@ -1105,7 +1105,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public void resetRecipes() {
|
||||
console.getCraftingManager().a(console.getResourceManager());
|
||||
// throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1772,7 +1772,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public Iterator<org.bukkit.advancement.Advancement> advancementIterator() {
|
||||
return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().b().iterator(), new Function<Advancement, org.bukkit.advancement.Advancement>() { // PAIL: rename
|
||||
return Iterators.unmodifiableIterator(Iterators.transform(console.getAdvancementData().a().iterator(), new Function<Advancement, org.bukkit.advancement.Advancement>() { // PAIL: rename
|
||||
@Override
|
||||
public org.bukkit.advancement.Advancement apply(Advancement advancement) {
|
||||
return advancement.bukkit;
|
||||
@ -1839,12 +1839,12 @@ public final class CraftServer implements Server {
|
||||
Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Block namespace must have material type");
|
||||
|
||||
TagsServer<Block> blockTags = console.getTagRegistry().a(); // PAIL: getBlockTags
|
||||
return blockTags.c().keySet().stream().map(key -> (org.bukkit.Tag<T>) new CraftBlockTag(blockTags, key)).collect(ImmutableList.toImmutableList());
|
||||
return blockTags.b().keySet().stream().map(key -> (org.bukkit.Tag<T>) new CraftBlockTag(blockTags, key)).collect(ImmutableList.toImmutableList());
|
||||
case org.bukkit.Tag.REGISTRY_ITEMS:
|
||||
Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Item namespace must have material type");
|
||||
|
||||
TagsServer<Item> itemTags = console.getTagRegistry().b(); // PAIL: getItemTags
|
||||
return itemTags.c().keySet().stream().map(key -> (org.bukkit.Tag<T>) new CraftItemTag(itemTags, key)).collect(ImmutableList.toImmutableList());
|
||||
return itemTags.b().keySet().stream().map(key -> (org.bukkit.Tag<T>) new CraftItemTag(itemTags, key)).collect(ImmutableList.toImmutableList());
|
||||
default:
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
@ -7,9 +7,11 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@ -80,9 +82,6 @@ import net.minecraft.server.Vec3D;
|
||||
import net.minecraft.server.WorldGenFeatureEmptyConfiguration;
|
||||
import net.minecraft.server.WorldGenerator;
|
||||
import net.minecraft.server.WorldNBTStorage;
|
||||
import net.minecraft.server.WorldProviderHell;
|
||||
import net.minecraft.server.WorldProviderNormal;
|
||||
import net.minecraft.server.WorldProviderTheEnd;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.BlockChangeDelegate;
|
||||
@ -702,7 +701,7 @@ public class CraftWorld implements World {
|
||||
CraftPlayer cp = (CraftPlayer) p;
|
||||
if (cp.getHandle().playerConnection == null) continue;
|
||||
|
||||
cp.getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateTime(cp.getHandle().world.getTime(), cp.getHandle().getPlayerTime(), cp.getHandle().world.getGameRules().getBoolean("doDaylightCycle")));
|
||||
cp.getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateTime(cp.getHandle().world.getTime(), cp.getHandle().getPlayerTime(), cp.getHandle().world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1853,6 +1852,40 @@ public class CraftWorld implements World {
|
||||
world.getMinecraftServer().getPlayerList().sendPacketNearby(null, x, y, z, volume > 1.0F ? 16.0F * volume : 16.0D, this.world.getWorldProvider().getDimensionManager(), packet);
|
||||
}
|
||||
|
||||
private static Map<String, GameRules.GameRuleKey<?>> gamerules;
|
||||
public static synchronized Map<String, GameRules.GameRuleKey<?>> getGameRulesNMS() {
|
||||
if (gamerules != null) {
|
||||
return gamerules;
|
||||
}
|
||||
|
||||
Map<String, GameRules.GameRuleKey<?>> gamerules = new HashMap<>();
|
||||
GameRules.a(new GameRules.GameRuleVisitor() {
|
||||
@Override
|
||||
public <T extends GameRules.GameRuleValue<T>> void a(GameRules.GameRuleKey<T> gamerules_gamerulekey, GameRules.GameRuleDefinition<T> gamerules_gameruledefinition) {
|
||||
gamerules.put(gamerules_gamerulekey.a(), gamerules_gamerulekey);
|
||||
}
|
||||
});
|
||||
|
||||
return CraftWorld.gamerules = gamerules;
|
||||
}
|
||||
|
||||
private static Map<String, GameRules.GameRuleDefinition<?>> gameruleDefinitions;
|
||||
public static synchronized Map<String, GameRules.GameRuleDefinition<?>> getGameRuleDefinitions() {
|
||||
if (gameruleDefinitions != null) {
|
||||
return gameruleDefinitions;
|
||||
}
|
||||
|
||||
Map<String, GameRules.GameRuleDefinition<?>> gameruleDefinitions = new HashMap<>();
|
||||
GameRules.a(new GameRules.GameRuleVisitor() {
|
||||
@Override
|
||||
public <T extends GameRules.GameRuleValue<T>> void a(GameRules.GameRuleKey<T> gamerules_gamerulekey, GameRules.GameRuleDefinition<T> gamerules_gameruledefinition) {
|
||||
gameruleDefinitions.put(gamerules_gamerulekey.a(), gamerules_gameruledefinition);
|
||||
}
|
||||
});
|
||||
|
||||
return CraftWorld.gameruleDefinitions = gameruleDefinitions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGameRuleValue(String rule) {
|
||||
// In method contract for some reason
|
||||
@ -1860,8 +1893,8 @@ public class CraftWorld implements World {
|
||||
return null;
|
||||
}
|
||||
|
||||
GameRules.GameRuleValue value = getHandle().getGameRules().get(rule);
|
||||
return value != null ? value.getValue() : "";
|
||||
GameRules.GameRuleValue<?> value = getHandle().getGameRules().get(getGameRulesNMS().get(rule));
|
||||
return value != null ? value.toString() : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1871,31 +1904,31 @@ public class CraftWorld implements World {
|
||||
|
||||
if (!isGameRule(rule)) return false;
|
||||
|
||||
getHandle().getGameRules().set(rule, value, getHandle().getMinecraftServer());
|
||||
getHandle().getGameRules().get(getGameRulesNMS().get(rule)).b(null, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGameRules() {
|
||||
return GameRules.getGameRules().keySet().toArray(new String[GameRules.getGameRules().size()]);
|
||||
return getGameRulesNMS().keySet().toArray(new String[getGameRulesNMS().size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGameRule(String rule) {
|
||||
Validate.isTrue(rule != null && !rule.isEmpty(), "Rule cannot be null nor empty");
|
||||
return GameRules.getGameRules().containsKey(rule);
|
||||
return getGameRulesNMS().containsKey(rule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getGameRuleValue(GameRule<T> rule) {
|
||||
Validate.notNull(rule, "GameRule cannot be null");
|
||||
return convert(rule, getHandle().getGameRules().get(rule.getName()));
|
||||
return convert(rule, getHandle().getGameRules().get(getGameRulesNMS().get(rule.getName())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getGameRuleDefault(GameRule<T> rule) {
|
||||
Validate.notNull(rule, "GameRule cannot be null");
|
||||
return convert(rule, GameRules.getGameRules().get(rule.getName()).a());
|
||||
return convert(rule, getGameRuleDefinitions().get(rule.getName()).a());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1905,22 +1938,21 @@ public class CraftWorld implements World {
|
||||
|
||||
if (!isGameRule(rule.getName())) return false;
|
||||
|
||||
getHandle().getGameRules().set(rule.getName(), newValue.toString(), getHandle().getMinecraftServer());
|
||||
getHandle().getGameRules().get(getGameRulesNMS().get(rule.getName())).b(null, newValue.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
private <T> T convert(GameRule<T> rule, GameRules.GameRuleValue value) {
|
||||
private <T> T convert(GameRule<T> rule, GameRules.GameRuleValue<?> value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (value.getType()) {
|
||||
case BOOLEAN_VALUE:
|
||||
return rule.getType().cast(value.getBooleanValue());
|
||||
case NUMERICAL_VALUE:
|
||||
return rule.getType().cast(value.getIntValue());
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid GameRule type (" + value.getType() + ") for GameRule " + rule.getName());
|
||||
if (value instanceof GameRules.GameRuleBoolean) {
|
||||
return rule.getType().cast(((GameRules.GameRuleBoolean) value).a());
|
||||
} else if (value instanceof GameRules.GameRuleInt) {
|
||||
return rule.getType().cast(value.getIntValue());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid GameRule type (" + value + ") for GameRule " + rule.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user