Update upstream

This commit is contained in:
IzzelAliz 2021-12-06 14:11:29 +08:00
parent 03a4afa0ad
commit 5140aaf4eb
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338
12 changed files with 93 additions and 15 deletions

View File

@ -7,7 +7,7 @@ A Bukkit server implementation utilizing Mixin.
| Minecraft | Forge | Status | Build |
| :----: | :----: | :---: | :---: |
| 1.18.x | 38.0.12 | ACTIVE | [![1.18 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-18?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) |
| 1.17.x | 37.1.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.17/1.0.1) | [![1.17 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-17?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-17) |
| 1.17.x | 37.1.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.17/1.0.2) | [![1.17 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-17?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-17) |
| 1.16.x | 36.2.19 | ACTIVE | [![1.16 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-16?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-16) |
| 1.15.x | 31.2.48 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.15/1.0.19) | [![1.15 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-15?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-15) |
| 1.14.x | 28.2.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.0.6) | [![1.14 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight) |

View File

@ -27,4 +27,4 @@ public org/bukkit/craftbukkit/v/inventory/CraftMetaTropicalFishBucket/<init>(Lor
public org/bukkit/craftbukkit/v/inventory/CraftMetaCrossbow/<init>(Lorg/bukkit/craftbukkit/v/inventory/CraftMetaItem;)V
public org/bukkit/craftbukkit/v/inventory/CraftMetaSuspiciousStew/<init>(Lorg/bukkit/craftbukkit/v/inventory/CraftMetaItem;)V
public org/spigotmc/ActivationRange$ActivationType/boundingBox
public org/bukkit/craftbukkit/v/inventory/CraftMetaItem/<init>(Lnet/minecraft/nbt/CompoundNBT;)V
public org/bukkit/craftbukkit/v/inventory/CraftMetaItem/<init>(Lnet/minecraft/nbt/CompoundTag;)V

View File

@ -566,7 +566,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
this.player.setOnGround(packetplayinflying.isOnGround()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move
this.player.onGround = packetplayinflying.isOnGround();
double d12 = d8;
d7 = d0 - this.player.getX();
@ -634,9 +634,9 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
// CraftBukkit end
this.player.getLevel().getChunkSource().move(this.player);
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
// this.player.setOnGround(packetplayinflying.b()); // CraftBukkit - moved up
this.player.setOnGround(packetplayinflying.isOnGround());
if (flag) {
this.player.fallDistance = 0.0F;
this.player.resetFallDistance();
}
this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5);

View File

@ -22,9 +22,12 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.core.BlockPos;
import net.minecraft.core.RegistryAccess;
import net.minecraft.nbt.NbtOps;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.protocol.status.ServerStatus;
import net.minecraft.obfuscate.DontObfuscate;
import net.minecraft.resources.RegistryReadOps;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerResources;
@ -134,6 +137,7 @@ public abstract class MinecraftServerMixin extends ReentrantBlockableEventLoop<T
}
public DataPackConfig datapackconfiguration;
public RegistryReadOps<Tag> registryreadops;
private boolean forceTicks;
public CraftServer server;
public OptionSet options;
@ -172,6 +176,7 @@ public abstract class MinecraftServerMixin extends ReentrantBlockableEventLoop<T
e.printStackTrace();
}
this.datapackconfiguration = ArclightCaptures.getDatapackConfig();
this.registryreadops = RegistryReadOps.createAndLoad(NbtOps.INSTANCE, dataRegistries.getResourceManager(), dynamicRegistries);
this.vanillaCommandDispatcher = dataRegistries.getCommands();
}

View File

@ -2,8 +2,10 @@ package io.izzel.arclight.common.mixin.core.server.level;
import com.google.common.collect.Lists;
import io.izzel.arclight.common.bridge.core.entity.EntityBridge;
import io.izzel.arclight.common.bridge.core.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.core.world.storage.MapDataBridge;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
@ -11,6 +13,7 @@ import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraftforge.server.ServerLifecycleHooks;
import org.bukkit.inventory.InventoryHolder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@ -18,6 +21,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net/minecraft/server/level/ServerLevel$EntityCallbacks")
public class ServerLevel_EntityCallbacksMixin {
@Shadow(aliases = {"f_143351_", "this$0"}) private ServerLevel outerThis;
@Inject(method = "onTrackingStart(Lnet/minecraft/world/entity/Entity;)V", at = @At("RETURN"))
private void arclight$valid(Entity entity, CallbackInfo ci) {
((EntityBridge) entity).bridge$setValid(true);
@ -46,5 +51,10 @@ public class ServerLevel_EntityCallbacksMixin {
@Inject(method = "onTrackingEnd(Lnet/minecraft/world/entity/Entity;)V", at = @At("RETURN"))
private void arclight$invalid(Entity entity, CallbackInfo ci) {
((EntityBridge) entity).bridge$setValid(true);
if (!(entity instanceof ServerPlayer)) {
for (var player : outerThis.players()) {
((ServerPlayerEntityBridge) player).bridge$getBukkitEntity().onEntityRemove(entity);
}
}
}
}

View File

@ -24,6 +24,8 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.tags.FluidTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
@ -37,6 +39,7 @@ import net.minecraft.world.entity.TamableAnimal;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
@ -45,6 +48,8 @@ import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.portal.PortalInfo;
import net.minecraft.world.level.portal.PortalShape;
import net.minecraft.world.phys.AABB;
@ -57,6 +62,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v.CraftServer;
import org.bukkit.craftbukkit.v.CraftWorld;
import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.bukkit.craftbukkit.v.entity.CraftEntity;
import org.bukkit.craftbukkit.v.entity.CraftPlayer;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
@ -217,6 +223,7 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
public boolean forceExplosionKnockback; // SPIGOT-949
public boolean persistentInvisibility = false;
public BlockPos lastLavaContact;
private CraftEntity bukkitEntity;
@ -370,11 +377,29 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
if ((Object) this instanceof ServerPlayer) this.handleNetherPortal();// CraftBukkit - // Moved up to postTick
}
@Redirect(method = "updateFluidHeightAndDoFluidPushing", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/material/FluidState;getFlow(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/phys/Vec3;"))
private Vec3 arclight$setLava(FluidState instance, BlockGetter level, BlockPos pos, Tag<Fluid> tag) {
if (tag == FluidTags.LAVA) {
lastLavaContact = pos.immutable();
}
return instance.getFlow(level, pos);
}
@Redirect(method = "baseTick", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/world/entity/Entity;isInLava()Z"))
private boolean arclight$resetLava(Entity instance) {
var ret = instance.isInLava();
if (!ret) {
this.lastLavaContact = null;
}
return ret;
}
@Redirect(method = "lavaHurt", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setSecondsOnFire(I)V"))
public void arclight$setOnFireFromLava$bukkitEvent(Entity entity, int seconds) {
var damager = (lastLavaContact == null) ? null : CraftBlock.at(level, lastLavaContact);
CraftEventFactory.blockDamage = damager;
if ((Object) this instanceof LivingEntity && remainingFireTicks <= 0) {
org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
var damagee = this.getBukkitEntity();
EntityCombustEvent combustEvent = new EntityCombustByBlockEvent(damager, damagee, 15);
Bukkit.getPluginManager().callEvent(combustEvent);
@ -387,6 +412,11 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
}
}
@Inject(method = "lavaHurt", at = @At("RETURN"))
private void arclight$resetBlockDamage(CallbackInfo ci) {
CraftEventFactory.blockDamage = null;
}
public void setSecondsOnFire(int seconds, boolean callEvent) {
if (callEvent) {
EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), seconds);

View File

@ -0,0 +1,17 @@
package io.izzel.arclight.common.mixin.core.world.entity.animal.horse;
import net.minecraft.world.entity.animal.horse.Llama;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(Llama.class)
public abstract class LlamaMixin {
// @formatter:off
@Shadow private void setStrength(int p_30841_) {}
// @formatter:on
public void setStrengthPublic(int i) {
this.setStrength(i);
}
}

View File

@ -162,6 +162,7 @@ public abstract class ServerPlayerMixin extends PlayerMixin implements ServerPla
@Shadow public abstract void setLevel(ServerLevel p_143426_);
@Shadow(remap = false) private boolean hasTabListName;
@Shadow(remap = false) private Component tabListDisplayName;
@Shadow public abstract void resetFallDistance();
// @formatter:on
public String displayName;
@ -919,7 +920,7 @@ public abstract class ServerPlayerMixin extends PlayerMixin implements ServerPla
this.setHealth(this.getMaxHealth());
this.stopUsingItem();
this.remainingFireTicks = 0;
this.fallDistance = 0.0f;
this.resetFallDistance();
this.foodData = new FoodData();
((FoodStatsBridge) this.foodData).bridge$setEntityHuman((ServerPlayer) (Object) this);
this.experienceLevel = this.newLevel;

View File

@ -20,8 +20,8 @@ import net.minecraft.world.level.chunk.FeatureAccess;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.UpgradeData;
import net.minecraft.world.level.levelgen.blending.BlendingData;
import org.bukkit.craftbukkit.v.persistence.CraftPersistentDataContainer;
import org.bukkit.craftbukkit.v.persistence.CraftPersistentDataTypeRegistry;
import org.bukkit.craftbukkit.v.persistence.DirtyCraftPersistentDataContainer;
import org.bukkit.persistence.PersistentDataContainer;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@ -29,6 +29,7 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Map;
@ -47,13 +48,24 @@ public abstract class ChunkAccessMixin implements BlockGetter, BiomeManager.Nois
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
public CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
public DirtyCraftPersistentDataContainer persistentDataContainer = new DirtyCraftPersistentDataContainer(DATA_TYPE_REGISTRY);
public Registry<Biome> biomeRegistry;
@Inject(method = "<init>", at = @At("RETURN"))
private void arclight$init(ChunkPos p_187621_, UpgradeData p_187622_, LevelHeightAccessor p_187623_, Registry<Biome> registry, long p_187625_, LevelChunkSection[] p_187626_, BlendingData p_187627_, CallbackInfo ci) {
this.biomeRegistry = registry;
this.persistentDataContainer.setCallback(() -> this.setUnsaved(true));
}
@Inject(method = "setUnsaved", at = @At("HEAD"))
private void arclight$dirty(boolean flag, CallbackInfo ci) {
if (!flag) {
this.persistentDataContainer.dirty(false);
}
}
@Inject(method = "isUnsaved", cancellable = true, at = @At("RETURN"))
private void arclight$isDirty(CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(cir.getReturnValueZ() || this.persistentDataContainer.dirty());
}
@Override

View File

@ -19,6 +19,7 @@ import net.minecraft.world.ticks.LevelChunkTicks;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v.CraftChunk;
import org.bukkit.craftbukkit.v.persistence.CraftPersistentDataContainer;
import org.bukkit.craftbukkit.v.persistence.DirtyCraftPersistentDataContainer;
import org.bukkit.event.world.ChunkLoadEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@ -53,7 +54,7 @@ public abstract class LevelChunkMixin extends ChunkAccessMixin implements ChunkB
@Inject(method = "<init>(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/chunk/ProtoChunk;Lnet/minecraft/world/level/chunk/LevelChunk$PostLoadProcessor;)V", at = @At("RETURN"))
private void arclight$init(ServerLevel p_196850_, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor p_196852_, CallbackInfo ci) {
this.needsDecoration = true;
this.persistentDataContainer = (CraftPersistentDataContainer) ((ChunkAccessBridge) protoChunk).bridge$getPersistentDataContainer();
this.persistentDataContainer = (DirtyCraftPersistentDataContainer) ((ChunkAccessBridge) protoChunk).bridge$getPersistentDataContainer();
}
@Inject(method = "removeBlockEntity", at = @At(value = "INVOKE_ASSIGN", remap = false, target = "Ljava/util/Map;remove(Ljava/lang/Object;)Ljava/lang/Object;"))

View File

@ -1,5 +1,7 @@
# Arclight 1.18
public net.minecraft.server.level.PlayerRespawnLogic m_183928_(Lnet/minecraft/server/level/ServerLevel;II)Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.npc.Villager m_35524_()V # releaseAllPois
public net.minecraft.world.entity.Entity f_19861_ # onGround
# Arclight 1.17
public net.minecraft.world.entity.Entity f_19851_
public net.minecraft.world.entity.raid.Raider$HoldGroundAttackGoal
@ -268,7 +270,6 @@ public net.minecraft.world.entity.player.Player m_6101_()I
public net.minecraft.world.entity.player.Player m_36364_(Lnet/minecraft/nbt/CompoundTag;)V
public net.minecraft.world.entity.player.Player m_36362_(Lnet/minecraft/nbt/CompoundTag;)V
public net.minecraft.world.entity.player.Player m_6915_()V
public net.minecraft.world.entity.animal.horse.Llama m_30840_(I)V
public net.minecraft.server.level.Ticket f_9422_
public net.minecraft.server.level.Ticket m_9429_(J)V
public net.minecraft.server.level.Ticket <init>(Lnet/minecraft/server/level/TicketType;ILjava/lang/Object;)V

View File

@ -74,10 +74,10 @@
"server.management.ServerPlayerGameModeMixin",
"server.management.UserListMixin",
"stats.StatisticsCounterMixin",
"world.BlockGetterMixin",
"world.CompoundContainerMixin",
"world.ContainerMixin",
"world.ExplosionMixin",
"world.BlockGetterMixin",
"world.IServerWorldMixin",
"world.IWorldMixin",
"world.IWorldWriterMixin",
@ -151,6 +151,7 @@
"world.entity.animal.TurtleMixin",
"world.entity.animal.WolfMixin",
"world.entity.animal.horse.AbstractHorseMixin",
"world.entity.animal.horse.LlamaMixin",
"world.entity.animal.horse.TraderLlamaEntity_FollowTraderGoalMixin",
"world.entity.boss.enderdragon.EnderCrystalMixin",
"world.entity.boss.enderdragon.EnderDragonMixin",
@ -430,8 +431,8 @@
"world.level.entity.PersistentEntitySectionManagerMixin",
"world.level.levelgen.ChunkGeneratorMixin",
"world.level.portal.PortalForcerMixin",
"world.level.saveddata.maps.MapItemSavedData_HoldingPlayerMixin",
"world.level.saveddata.maps.MapDataMixin",
"world.level.saveddata.maps.MapItemSavedData_HoldingPlayerMixin",
"world.level.storage.loot.LootTableManagerMixin",
"world.level.storage.loot.LootTableMixin",
"world.level.storage.loot.entries.LootEntry_SerializerMixin",