Update upstream

This commit is contained in:
IzzelAliz 2023-02-02 12:16:23 +08:00
parent c4f79bc0fb
commit e09caddf64
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338
5 changed files with 28 additions and 8 deletions

View File

@ -2,11 +2,11 @@ package io.izzel.arclight.common.mixin.core.server.management;
import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
import io.izzel.arclight.api.ArclightVersion;
import io.izzel.arclight.common.bridge.core.entity.EntityBridge;
import io.izzel.arclight.common.bridge.core.entity.InternalEntityBridge;
import io.izzel.arclight.common.bridge.core.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.core.network.NetworkManagerBridge;
import io.izzel.arclight.common.bridge.core.network.datasync.SynchedEntityDataBridge;
import io.izzel.arclight.common.bridge.core.network.play.ServerPlayNetHandlerBridge;
import io.izzel.arclight.common.bridge.core.server.management.PlayerListBridge;
import io.izzel.arclight.common.bridge.core.world.WorldBridge;
@ -539,12 +539,11 @@ public abstract class PlayerListMixin implements PlayerListBridge {
@Redirect(method = "sendAllPlayerInfo", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;resetSentInfo()V"))
private void arclight$useScaledHealth(ServerPlayer playerEntity) {
((ServerPlayerEntityBridge) playerEntity).bridge$getBukkitEntity().updateScaledHealth();
((SynchedEntityDataBridge) playerEntity.getEntityData()).bridge$refresh(playerEntity);
int i = playerEntity.level.getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
playerEntity.connection.send(new ClientboundEntityEventPacket(playerEntity, (byte) i));
if (ArclightVersion.atLeast(ArclightVersion.v1_15)) {
float immediateRespawn = playerEntity.level.getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0f : 0.0f;
playerEntity.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.IMMEDIATE_RESPAWN, immediateRespawn));
}
float immediateRespawn = playerEntity.level.getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0f : 0.0f;
playerEntity.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.IMMEDIATE_RESPAWN, immediateRespawn));
}
public void broadcastMessage(Component[] components) {

View File

@ -172,9 +172,6 @@ public abstract class ExplosionMixin implements ExplosionBridge {
double d14 = Explosion.getSeenPercent(vec3d, entity);
double d10 = (1.0D - d12) * d14;
CraftEventFactory.entityDamage = this.source;
((EntityBridge) entity).bridge$setLastDamageCancelled(false);
// Special case ender dragon only give knockback if no damage is cancelled
// Thinks to note:
// - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
@ -185,6 +182,9 @@ public abstract class ExplosionMixin implements ExplosionBridge {
continue;
}
CraftEventFactory.entityDamage = this.source;
((EntityBridge) entity).bridge$setLastDamageCancelled(false);
var parts = entity.getParts();
if (parts != null) {
for (var part : parts) {

View File

@ -7,6 +7,8 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.inventory.GrindstoneMenu;
import net.minecraft.world.item.ItemStack;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.craftbukkit.v.inventory.CraftInventoryGrindstone;
import org.bukkit.craftbukkit.v.inventory.CraftInventoryView;
import org.spongepowered.asm.mixin.Final;
@ -14,6 +16,7 @@ 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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GrindstoneMenu.class)
@ -30,6 +33,16 @@ public abstract class GrindstoneContainerMixin extends AbstractContainerMenuMixi
this.playerInventory = playerInventory;
}
@Redirect(method = "createResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/Container;setItem(ILnet/minecraft/world/item/ItemStack;)V"))
private void arclight$prepareEvent(Container instance, int i, ItemStack itemStack) {
CraftEventFactory.callPrepareGrindstoneEvent(getBukkitView(), itemStack);
}
@Inject(method = "createResult", at = @At(value = "INVOKE", ordinal = 3, target = "Lnet/minecraft/world/inventory/GrindstoneMenu;broadcastChanges()V"))
private void arclight$sync(CallbackInfo ci) {
sendAllDataToRemote();
}
@Override
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {

View File

@ -13,6 +13,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;
@Mixin(ShulkerBoxMenu.class)
public abstract class ShulkerBoxContainerMixin extends AbstractContainerMenuMixin {
@ -29,6 +30,11 @@ public abstract class ShulkerBoxContainerMixin extends AbstractContainerMenuMixi
this.playerInventory = playerInventory;
}
@Inject(method = "stillValid", cancellable = true, at = @At("HEAD"))
public void arclight$unreachable(net.minecraft.world.entity.player.Player playerIn, CallbackInfoReturnable<Boolean> cir) {
if (!bridge$isCheckReachable()) cir.setReturnValue(true);
}
@Override
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {

View File

@ -1,5 +1,7 @@
# Arclight 1.19.3
public net.minecraft.server.MinecraftServer$TimeProfiler <init>(JI)V # TimeProfiler
public net.minecraft.world.level.block.entity.SkullBlockEntity f_262250_ # noteBlockSound
public net.minecraft.world.entity.player.Player f_36081_ # enchantmentSeed
# Arclight 1.18.2
public-f net.minecraft.server.ReloadableServerResources f_206847_ # commands
public net.minecraft.world.level.chunk.ChunkGenerator f_212255_