Add missing cancellable

This commit is contained in:
IzzelAliz 2021-02-20 23:56:50 +08:00
parent 0d02fdb5a4
commit a392e7c441
6 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ import java.util.Random;
@Mixin(RedstoneLampBlock.class)
public class RedstoneLampBlockMixin {
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
@Inject(method = "tick", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
private void arclight$redstoneChange(BlockState state, ServerWorld worldIn, BlockPos pos, Random rand, CallbackInfo ci) {
if (CraftEventFactory.callRedstoneChange(worldIn, pos, 15, 0).getNewCurrent() != 0) {
ci.cancel();

View File

@ -284,7 +284,7 @@ public abstract class AbstractMinecartEntityMixin extends EntityMixin {
return this.isBeingRidden() || !this.slowWhenEmpty;
}
@Inject(method = "applyEntityCollision", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/item/minecart/AbstractMinecartEntity;isPassenger(Lnet/minecraft/entity/Entity;)Z"))
@Inject(method = "applyEntityCollision", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/item/minecart/AbstractMinecartEntity;isPassenger(Lnet/minecraft/entity/Entity;)Z"))
private void arclight$vehicleCollide(Entity entityIn, CallbackInfo ci) {
if (!this.isPassenger(entityIn)) {
VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), ((EntityBridge) entityIn).bridge$getBukkitEntity());

View File

@ -35,7 +35,7 @@ public abstract class LoomContainerMixin extends ContainerMixin implements PosCo
this.playerInventory = playerInventory;
}
@Inject(method = "canInteractWith", at = @At("HEAD"))
@Inject(method = "canInteractWith", cancellable = true, at = @At("HEAD"))
public void arclight$unreachable(PlayerEntity playerIn, CallbackInfoReturnable<Boolean> cir) {
if (!bridge$isCheckReachable()) {
cir.setReturnValue(true);

View File

@ -37,7 +37,7 @@ public class MerchantOfferMixin implements MerchantOfferBridge {
return asBukkit();
}
@Inject(method = "getDiscountedBuyingStackFirst", at = @At("HEAD"))
@Inject(method = "getDiscountedBuyingStackFirst", cancellable = true, at = @At("HEAD"))
private void arclight$fix(CallbackInfoReturnable<ItemStack> cir) {
if (this.buyingStackFirst.getCount() <= 0) {
cir.setReturnValue(ItemStack.EMPTY);

View File

@ -62,7 +62,7 @@ public abstract class BeehiveTileEntityMixin extends TileEntityMixin {
return list;
}
@Inject(method = "tryEnterHive(Lnet/minecraft/entity/Entity;ZI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;stopRiding()V"))
@Inject(method = "tryEnterHive(Lnet/minecraft/entity/Entity;ZI)V", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;stopRiding()V"))
private void arclight$beeEnterBlock(Entity entity, boolean p_226962_2_, int p_226962_3_, CallbackInfo ci) {
if (this.world != null) {
EntityEnterBlockEvent event = new EntityEnterBlockEvent(((EntityBridge) entity).bridge$getBukkitEntity(), CraftBlock.at(this.world, this.getPos()));

View File

@ -64,7 +64,7 @@ public abstract class BrewingStandTileEntityMixin extends LockableTileEntityMixi
arclight$consume = false;
}
@Inject(method = "brewPotions", at = @At("HEAD"))
@Inject(method = "brewPotions", cancellable = true, at = @At("HEAD"))
public void arclight$brewPotion(CallbackInfo ci) {
InventoryHolder owner = this.getOwner();
if (owner != null) {