Update upstream

This commit is contained in:
IzzelAliz 2023-06-19 11:18:14 +08:00
parent e36ea97a4e
commit b8edc53473
8 changed files with 28 additions and 6 deletions

View File

@ -820,7 +820,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
} else {
// TODO 1.20 update this
BlockHitResult movingobjectpositionblock = movingobjectposition;
PlayerInteractEvent event2 = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand);
PlayerInteractEvent event2 = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand, movingobjectpositionblock.getLocation());
cancelled = (event2.useItemInHand() == Event.Result.DENY);
}
if (cancelled) {

View File

@ -303,7 +303,7 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana
cancelledBlock = true;
}
PlayerInteractEvent bukkitEvent = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, blockpos, blockRaytraceResultIn.getDirection(), stackIn, cancelledBlock, handIn);
PlayerInteractEvent bukkitEvent = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, blockpos, blockRaytraceResultIn.getDirection(), stackIn, cancelledBlock, handIn, blockRaytraceResultIn.getLocation());
bridge$setFiredInteract(true);
bridge$setInteractResult(bukkitEvent.useItemInHand() == Event.Result.DENY);
if (bukkitEvent.useInteractedBlock() == Event.Result.DENY) {

View File

@ -69,7 +69,7 @@ public abstract class BoatItemMixin extends Item {
if (result.getType() == HitResult.Type.BLOCK) {
if (DistValidate.isValid(worldIn)) {
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, result.getBlockPos(), result.getDirection(), itemstack, handIn);
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, result.getBlockPos(), result.getDirection(), itemstack, false, handIn, result.getLocation());
if (event.isCancelled()) {
return new InteractionResultHolder<>(InteractionResult.PASS, itemstack);

View File

@ -36,6 +36,7 @@ public abstract class BlockEntityMixin implements TileEntityBridge {
@Shadow public abstract boolean onlyOpCanSetNbt();
@Shadow protected static void setChanged(Level p_155233_, BlockPos p_155234_, BlockState p_155235_) { }
@Shadow public abstract BlockEntityType<?> getType();
@Shadow public void load(CompoundTag p_155245_) {}
// @formatter:on
@Inject(method = "load", at = @At("RETURN"))

View File

@ -1,5 +1,6 @@
package io.izzel.arclight.common.mixin.core.world.level.block.entity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.item.ItemEntity;
@ -10,7 +11,9 @@ import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.spongepowered.asm.mixin.Mixin;
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;
import java.util.Collections;
@ -23,4 +26,9 @@ public abstract class BrushableBlockEntityMixin extends BlockEntityMixin {
CraftEventFactory.handleBlockDropItemEvent(block, block.getState(), (ServerPlayer) player, Collections.singletonList((ItemEntity) entity));
return true;
}
@Inject(method = "load", at = @At("HEAD"))
private void arclight$load(CompoundTag p_277597_, CallbackInfo ci) {
super.load(p_277597_);
}
}

View File

@ -4,6 +4,7 @@ import io.izzel.arclight.common.bridge.core.inventory.IInventoryBridge;
import io.izzel.arclight.common.bridge.core.world.WorldBridge;
import io.izzel.arclight.common.mod.util.DistValidate;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
@ -69,10 +70,15 @@ public abstract class ChiseledBookShelfBlockEntityMixin extends BlockEntityMixin
return new org.bukkit.Location(((WorldBridge) level).bridge$getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
}
@Inject(method = "setItem", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity;updateState(I)V"))
private void arclight$skipIfNull(int p_256610_, ItemStack p_255789_, CallbackInfo ci) {
@Inject(method = "updateState", cancellable = true, at = @At("HEAD"))
private void arclight$skipIfNull(int p_261806_, CallbackInfo ci) {
if (level == null) {
ci.cancel();
}
}
@Inject(method = "load", at = @At("HEAD"))
private void arclight$load(CompoundTag p_277597_, CallbackInfo ci) {
super.load(p_277597_);
}
}

View File

@ -1,6 +1,7 @@
package io.izzel.arclight.common.mixin.core.world.level.block.entity;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.SculkCatalystBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
@ -11,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(SculkCatalystBlockEntity.class)
public class SculkCatalystBlockEntityMixin {
public abstract class SculkCatalystBlockEntityMixin extends BlockEntityMixin {
@Inject(method = "serverTick", at = @At("HEAD"))
private static void arclight$overrideSource(Level p_222780_, BlockPos p_222781_, BlockState p_222782_, SculkCatalystBlockEntity blockEntity, CallbackInfo ci) {
@ -22,4 +23,9 @@ public class SculkCatalystBlockEntityMixin {
private static void arclight$resetSource(Level p_222780_, BlockPos p_222781_, BlockState p_222782_, SculkCatalystBlockEntity blockEntity, CallbackInfo ci) {
CraftEventFactory.sourceBlockOverride = null;
}
@Inject(method = "load", at = @At("HEAD"))
private void arclight$load(CompoundTag p_277597_, CallbackInfo ci) {
super.load(p_277597_);
}
}

View File

@ -6,6 +6,7 @@ public net.minecraft.server.packs.repository.Pack f_244124_ # resources
public net.minecraft.world.flag.FeatureFlag f_243952_ # universe
public net.minecraft.world.flag.FeatureFlagRegistry f_244560_ # names
public-f net.minecraft.server.players.PlayerList f_11193_ # maxPlayers
public net.minecraft.world.level.block.ChiseledBookShelfBlock m_261279_(Lnet/minecraft/world/phys/Vec2;)I # getHitSlot
# 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