Update to forge 47.1.0

Update upstream
This commit is contained in:
IzzelAliz 2023-07-09 15:07:29 +08:00
parent 381d0134a0
commit 6d8f55e858
34 changed files with 45 additions and 49 deletions

View File

@ -6,7 +6,7 @@ A Bukkit server implementation utilizing Mixin.
| Release | Forge | Status | Build |
|:--------------------:|:-------:|:------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Trials (1.20-1.20.1) | 47.0.3 | ACTIVE | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) |
| Trials (1.20-1.20.1) | 47.1.0 | ACTIVE | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) |
| Executions (1.19.4) | 45.1.0 | LTS | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Executions&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3AExecutions) |
| 1.18.x | 40.1.80 | LTS | [![1.18 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=1.18&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) |
| 1.16.x | 36.2.39 | LTS | [![1.16 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=1.16&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-16) |

View File

@ -198,7 +198,7 @@ public class CraftEventFactoryMixin {
* @reason
*/
@Overwrite
public static EntityChangeBlockEvent callEntityChangeBlockEvent(Entity entity, BlockPos position, net.minecraft.world.level.block.state.BlockState newBlock, boolean cancelled) {
public static boolean callEntityChangeBlockEvent(Entity entity, BlockPos position, net.minecraft.world.level.block.state.BlockState newBlock, boolean cancelled) {
Block block = CraftBlock.at(entity.level(), position);
EntityChangeBlockEvent event = new EntityChangeBlockEvent(((EntityBridge) entity).bridge$getBukkitEntity(), block, CraftBlockData.fromData(newBlock));
event.setCancelled(cancelled);
@ -206,7 +206,7 @@ public class CraftEventFactoryMixin {
if (DistValidate.isValid(entity.level())) {
Bukkit.getPluginManager().callEvent(event);
}
return event;
return !event.isCancelled();
}
/**

View File

@ -1528,7 +1528,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
}
if (packet.getSlotNum() == 2 && top instanceof SmithingInventory) {
if (packet.getSlotNum() == 3 && top instanceof SmithingInventory) {
org.bukkit.inventory.ItemStack result = ((SmithingInventory) top).getResult();
if (result != null) {
if (click == ClickType.NUMBER_KEY) {

View File

@ -7,7 +7,6 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.event.ForgeEventFactory;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -33,8 +32,8 @@ public class EatBlockGoalMixin {
@Redirect(method = "tick", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;)Z"))
public boolean arclight$entityChangeBlock(Level world, Entity entity) {
boolean b = ForgeEventFactory.getMobGriefingEvent(world, entity);
EntityChangeBlockEvent event = CraftEventFactory.callEntityChangeBlockEvent(entity, arclight$pos, Blocks.AIR.defaultBlockState(), !b);
var result = CraftEventFactory.callEntityChangeBlockEvent(entity, arclight$pos, Blocks.AIR.defaultBlockState(), !b);
arclight$pos = null;
return !event.isCancelled();
return result;
}
}

View File

@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.animal.Bee;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.IntegerProperty;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -21,7 +20,7 @@ public class Bee_GrowCropGoalMixin {
@Inject(method = "tick", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;levelEvent(ILnet/minecraft/core/BlockPos;I)V"))
private void arclight$entityChangeBlock(CallbackInfo ci, int i, BlockPos blockPos, BlockState blockState, Block block, BlockState state) {
if (CraftEventFactory.callEntityChangeBlockEvent(outerThis, blockPos, state).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(outerThis, blockPos, state)) {
ci.cancel();
}
}

View File

@ -25,7 +25,7 @@ public abstract class Fox_EatBerriesGoalMixin extends MoveToBlockGoal {
@Inject(method = "pickSweetBerries", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/util/RandomSource;nextInt(I)I"))
private void arclight$eatBerry(BlockState state, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(outerThis, this.blockPos, state.setValue(SweetBerryBushBlock.AGE, 1)).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(outerThis, this.blockPos, state.setValue(SweetBerryBushBlock.AGE, 1))) {
ci.cancel();
}
}

View File

@ -25,15 +25,15 @@ public class Rabbit_RaidGardenGoalMixin {
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z"))
private void arclight$entityChangeBlock(CallbackInfo ci, Level world, BlockPos blockPos, BlockState blockState, Block block, int i) {
if (i == 0) {
if (CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockPos, Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockPos, Blocks.AIR.defaultBlockState())) {
ci.cancel();
}
} else {
if (CraftEventFactory.callEntityChangeBlockEvent(
if (!CraftEventFactory.callEntityChangeBlockEvent(
this.rabbit,
blockPos,
blockState.setValue(CarrotBlock.AGE, i - 1)
).isCancelled()) {
)) {
ci.cancel();
}
}

View File

@ -38,7 +38,7 @@ public abstract class Turtle_LayEggGoalMixin extends MoveToBlockGoal {
((TurtleEntityBridge) this.turtle).bridge$setDigging(true);
} else if (((TurtleEntityBridge) this.turtle).bridge$getDigging() > 200) {
Level world = this.turtle.level();
if (!CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (Blocks.TURTLE_EGG.defaultBlockState()).setValue(TurtleEggBlock.EGGS, this.turtle.getRandom().nextInt(4) + 1)).isCancelled()) {
if (CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (Blocks.TURTLE_EGG.defaultBlockState()).setValue(TurtleEggBlock.EGGS, this.turtle.getRandom().nextInt(4) + 1))) {
BlockPos blockpos1 = this.blockPos.above();
BlockState blockstate = Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.getRandom().nextInt(4) + 1);
world.setBlock(blockpos1, blockstate, 3);

View File

@ -11,7 +11,6 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.HorseJumpEvent;
import org.bukkit.inventory.InventoryHolder;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@ -68,8 +67,7 @@ public abstract class AbstractHorseMixin extends AnimalMixin {
} else {
power = 0.4F + 0.4F * (float) i / 90.0F;
}
HorseJumpEvent event = CraftEventFactory.callHorseJumpEvent((AbstractHorse) (Object) this, power);
if (event.isCancelled()) {
if (!CraftEventFactory.callHorseJumpEvent((AbstractHorse) (Object) this, power)) {
ci.cancel();
}
}

View File

@ -133,7 +133,7 @@ public abstract class WitherBossMixin extends PathfinderMobMixin {
BlockPos blockpos = new BlockPos(l2, l, i1);
BlockState blockstate = this.level().getBlockState(blockpos);
if (blockstate.canEntityDestroy(this.level(), blockpos, (WitherBoss) (Object) this) && ForgeEventFactory.onEntityDestroyBlock((WitherBoss) (Object) this, blockpos, blockstate)) {
if (CraftEventFactory.callEntityChangeBlockEvent((WitherBoss) (Object) this, blockpos, Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent((WitherBoss) (Object) this, blockpos, Blocks.AIR.defaultBlockState())) {
continue;
}
flag = this.level().destroyBlock(blockpos, true, (WitherBoss) (Object) this) || flag;

View File

@ -28,7 +28,7 @@ public abstract class FallingBlockEntityMixin extends EntityMixin {
@Inject(method = "tick", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z"))
private void arclight$entityChangeBlock(CallbackInfo ci, Block block, BlockPos pos) {
if (CraftEventFactory.callEntityChangeBlockEvent((FallingBlockEntity) (Object) this, pos, this.blockState).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent((FallingBlockEntity) (Object) this, pos, this.blockState)) {
ci.cancel();
}
}
@ -45,7 +45,7 @@ public abstract class FallingBlockEntityMixin extends EntityMixin {
@Inject(method = "fall", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z"))
private static void arclight$entityFall(Level level, BlockPos pos, BlockState state, CallbackInfoReturnable<FallingBlockEntity> cir, FallingBlockEntity entity) {
if (CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.getFluidState().createLegacyBlock()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.getFluidState().createLegacyBlock())) {
cir.setReturnValue(entity);
}
}

View File

@ -44,7 +44,7 @@ public abstract class ItemEntityMixin extends EntityMixin {
@Inject(method = "merge(Lnet/minecraft/world/entity/item/ItemEntity;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/item/ItemEntity;Lnet/minecraft/world/item/ItemStack;)V", cancellable = true, at = @At("HEAD"))
private static void arclight$itemMerge(ItemEntity from, ItemStack stack1, ItemEntity to, ItemStack stack2, CallbackInfo ci) {
if (CraftEventFactory.callItemMergeEvent(to, from).isCancelled()) {
if (!CraftEventFactory.callItemMergeEvent(to, from)) {
ci.cancel();
}
}

View File

@ -24,7 +24,7 @@ public class EnderMan_EndermanLeaveBlockGoalMixin {
@Inject(method = "tick", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z"))
private void arclight$entityChangeBlock(CallbackInfo ci, RandomSource random, Level world, int i, int j, int k, BlockPos blockPos, BlockState blockState, BlockPos blockPos1, BlockState blockState1, BlockState blockState2) {
if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockPos, blockState2).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockPos, blockState2)) {
ci.cancel();
}
}

View File

@ -24,7 +24,7 @@ public class EnderMan_EndermanTakeBlockGoalMixin {
@Inject(method = "tick", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/EnderMan;setCarriedBlock(Lnet/minecraft/world/level/block/state/BlockState;)V"))
private void arclight$entityChangeBlock(CallbackInfo ci, RandomSource random, Level world, int i, int j, int k, BlockPos blockPos) {
if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockPos, Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockPos, Blocks.AIR.defaultBlockState())) {
ci.cancel();
}
}

View File

@ -16,7 +16,7 @@ public abstract class RavagerMixin extends PathfinderMobMixin {
@Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;destroyBlock(Lnet/minecraft/core/BlockPos;ZLnet/minecraft/world/entity/Entity;)Z"))
private boolean arclight$entityChangeBlock(Level world, BlockPos pos, boolean dropBlock, Entity entityIn) {
return !CraftEventFactory.callEntityChangeBlockEvent((Ravager) (Object) this, pos, Blocks.AIR.defaultBlockState()).isCancelled()
return CraftEventFactory.callEntityChangeBlockEvent((Ravager) (Object) this, pos, Blocks.AIR.defaultBlockState())
&& world.destroyBlock(pos, dropBlock, entityIn);
}
}

View File

@ -22,7 +22,7 @@ public abstract class Silverfish_MergeWithStoneGoalMixin extends RandomStrollGoa
@Inject(method = "start", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/LevelAccessor;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z"))
private void arclight$entityChangeBlock(CallbackInfo ci, LevelAccessor world, BlockPos blockPos, BlockState blockState) {
if (CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, InfestedBlock.infestedStateByHost(blockState)).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockPos, InfestedBlock.infestedStateByHost(blockState))) {
ci.cancel();
}
}

View File

@ -42,7 +42,7 @@ public abstract class Silverfish_WakeUpFriendsGoalMixin extends Goal {
BlockState blockstate = world.getBlockState(blockpos1);
Block block = blockstate.getBlock();
if (block instanceof InfestedBlock) {
if (CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockpos1, Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockpos1, Blocks.AIR.defaultBlockState())) {
continue;
}
if (ForgeEventFactory.getMobGriefingEvent(world, this.silverfish)) {

View File

@ -112,21 +112,21 @@ public abstract class ThrownPotionMixin extends ThrowableItemProjectileMixin {
@Inject(method = "dowseFire", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;removeBlock(Lnet/minecraft/core/BlockPos;Z)Z"))
private void arclight$entityChangeBlock(BlockPos pos, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent((ThrownPotion) (Object) this, pos, Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent((ThrownPotion) (Object) this, pos, Blocks.AIR.defaultBlockState())) {
ci.cancel();
}
}
@Inject(method = "dowseFire", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;levelEvent(Lnet/minecraft/world/entity/player/Player;ILnet/minecraft/core/BlockPos;I)V"))
private void arclight$entityChangeBlock2(BlockPos pos, CallbackInfo ci, BlockState state) {
if (CraftEventFactory.callEntityChangeBlockEvent((ThrownPotion) (Object) this, pos, state.setValue(CampfireBlock.LIT, false)).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent((ThrownPotion) (Object) this, pos, state.setValue(CampfireBlock.LIT, false))) {
ci.cancel();
}
}
@Inject(method = "dowseFire", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/AbstractCandleBlock;extinguish(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;)V"))
private void arclight$entityChangeBlock3(BlockPos pos, CallbackInfo ci, BlockState state) {
if (CraftEventFactory.callEntityChangeBlockEvent((ThrownPotion) (Object) this, pos, state.setValue(AbstractCandleBlock.LIT, false)).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent((ThrownPotion) (Object) this, pos, state.setValue(AbstractCandleBlock.LIT, false))) {
ci.cancel();
}
}

View File

@ -7,7 +7,7 @@ import net.minecraft.world.inventory.SmithingMenu;
import net.minecraft.world.item.ItemStack;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.craftbukkit.v.inventory.CraftInventory;
import org.bukkit.craftbukkit.v.inventory.CraftInventorySmithingNew;
import org.bukkit.craftbukkit.v.inventory.CraftInventorySmithing;
import org.bukkit.craftbukkit.v.inventory.CraftInventoryView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -28,7 +28,7 @@ public abstract class SmithingTableContainerMixin extends ItemCombinerMixin {
if (this.bukkitEntity != null) {
return this.bukkitEntity;
}
CraftInventory inventory = new CraftInventorySmithingNew(((IWorldPosCallableBridge) this.access).bridge$getLocation(), this.inputSlots, this.resultSlots);
CraftInventory inventory = new CraftInventorySmithing(((IWorldPosCallableBridge) this.access).bridge$getLocation(), this.inputSlots, this.resultSlots);
return this.bukkitEntity = new CraftInventoryView(((PlayerEntityBridge) this.player).bridge$getBukkitEntity(), inventory, (SmithingMenu) (Object) this);
}
}

View File

@ -145,7 +145,7 @@ public abstract class LevelMixin implements WorldBridge, LevelWriter {
private boolean processCaptures(BlockPos pos, BlockState newState, int flags) {
Entity entityChangeBlock = ArclightCaptures.getEntityChangeBlock();
if (entityChangeBlock != null) {
if (CraftEventFactory.callEntityChangeBlockEvent(entityChangeBlock, pos, newState).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entityChangeBlock, pos, newState)) {
return false;
}
}

View File

@ -30,7 +30,7 @@ public class BigDripleafBlockMixin {
@Inject(method = "onProjectileHit", cancellable = true, at = @At("HEAD"))
private void arclight$projectileHit(Level level, BlockState state, BlockHitResult hitResult, Projectile projectile, CallbackInfo ci) {
if (DistValidate.isValid(level) && CraftEventFactory.callEntityChangeBlockEvent(projectile, hitResult.getBlockPos(), state.setValue(TILT, Tilt.FULL)).isCancelled()) {
if (!DistValidate.isValid(level) && CraftEventFactory.callEntityChangeBlockEvent(projectile, hitResult.getBlockPos(), state.setValue(TILT, Tilt.FULL))) {
ci.cancel();
}
}
@ -50,7 +50,7 @@ public class BigDripleafBlockMixin {
ci.cancel();
return;
}
if (CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.setValue(TILT, Tilt.FULL)).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.setValue(TILT, Tilt.FULL))) {
ci.cancel();
}
}

View File

@ -35,7 +35,7 @@ public interface CaveVinesMixin {
static InteractionResult use(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) {
if (state.getValue(CaveVines.BERRIES)) {
if (entity != null) {
if (CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.setValue(CaveVines.BERRIES, false)).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state.setValue(CaveVines.BERRIES, false))) {
return InteractionResult.SUCCESS;
}

View File

@ -117,7 +117,7 @@ public abstract class ChorusFlowerBlockMixin extends BlockMixin {
@Inject(method = "onProjectileHit", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;destroyBlock(Lnet/minecraft/core/BlockPos;ZLnet/minecraft/world/entity/Entity;)Z"))
private void arclight$hitByProjectile(Level p_51654_, BlockState p_51655_, BlockHitResult result, Projectile projectile, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(projectile, result.getBlockPos(), Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, result.getBlockPos(), Blocks.AIR.defaultBlockState())) {
ci.cancel();
}
}

View File

@ -56,7 +56,7 @@ public abstract class ComposterBlockMixin {
double rand = world.random.nextDouble();
BlockState state1 = addItem(entity, state, DummyGeneratorAccess.INSTANCE, pos, stack, rand);
if (state == state1 || CraftEventFactory.callEntityChangeBlockEvent(ArclightCaptures.getEntityChangeBlock(), pos, state1).isCancelled()) {
if (state == state1 || !CraftEventFactory.callEntityChangeBlockEvent(ArclightCaptures.getEntityChangeBlock(), pos, state1)) {
return state;
}
@ -72,7 +72,7 @@ public abstract class ComposterBlockMixin {
private static void arclight$emptyComposter(Entity entity, BlockState state, Level world, BlockPos pos, CallbackInfoReturnable<BlockState> cir) {
if (entity != null && !(entity instanceof Player)) {
BlockState blockState = empty(entity, state, DummyGeneratorAccess.INSTANCE, pos);
if (CraftEventFactory.callEntityChangeBlockEvent(entity, pos, blockState).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, blockState)) {
cir.setReturnValue(state);
}
}

View File

@ -12,7 +12,6 @@ import net.minecraft.world.level.block.CropBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.event.ForgeEventFactory;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@ -31,8 +30,7 @@ public class CropBlockMixin {
@Redirect(method = "entityInside", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/level/Level;Lnet/minecraft/world/entity/Entity;)Z"))
public boolean arclight$entityChangeBlock(Level world, Entity entity, BlockState state, Level worldIn, BlockPos pos) {
boolean result = ForgeEventFactory.getMobGriefingEvent(world, entity);
EntityChangeBlockEvent event = CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state, result);
return event.isCancelled();
return !CraftEventFactory.callEntityChangeBlockEvent(entity, pos, state, result);
}
@Redirect(method = "randomTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z"))

View File

@ -17,7 +17,7 @@ public class LilyPadBlockMixin {
@Inject(method = "entityInside", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;destroyBlock(Lnet/minecraft/core/BlockPos;ZLnet/minecraft/world/entity/Entity;)Z"))
public void arclight$entityChangeBlock(BlockState state, Level worldIn, BlockPos pos, Entity entityIn, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(entityIn, pos, Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entityIn, pos, Blocks.AIR.defaultBlockState())) {
ci.cancel();
}
}

View File

@ -30,7 +30,7 @@ public class PointedDripstoneBlockMixin {
@Inject(method = "onProjectileHit", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;destroyBlock(Lnet/minecraft/core/BlockPos;Z)Z"))
private void arclight$projectile(Level p_154042_, BlockState p_154043_, BlockHitResult hitResult, Projectile projectile, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(projectile, hitResult.getBlockPos(), Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, hitResult.getBlockPos(), Blocks.AIR.defaultBlockState())) {
ci.cancel();
}
}

View File

@ -17,7 +17,7 @@ public class PowderSnowBlockMixin {
@Inject(method = "entityInside", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;destroyBlock(Lnet/minecraft/core/BlockPos;Z)Z"))
private void arclight$entityChangeBlock(BlockState p_154263_, Level p_154264_, BlockPos pos, Entity entity, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) {
ci.cancel();
}
}

View File

@ -76,7 +76,7 @@ public abstract class RedstoneOreBlockMixin {
@Inject(method = "interact", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z"))
private static void arclight$entityChangeBlock(BlockState blockState, Level world, BlockPos blockPos, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(arclight$entity, blockPos, blockState.setValue(RedStoneOreBlock.LIT, true)).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(arclight$entity, blockPos, blockState.setValue(RedStoneOreBlock.LIT, true))) {
ci.cancel();
}
arclight$entity = null;

View File

@ -52,7 +52,7 @@ public abstract class TntBlockMixin {
@Inject(method = "onProjectileHit", cancellable = true, at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/world/level/block/TntBlock;onCaughtFire(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;Lnet/minecraft/world/entity/LivingEntity;)V"))
public void arclight$entityChangeBlock(Level worldIn, BlockState state, BlockHitResult hit, Projectile projectile, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(projectile, hit.getBlockPos(), Blocks.AIR.defaultBlockState()).isCancelled()
if (!CraftEventFactory.callEntityChangeBlockEvent(projectile, hit.getBlockPos(), Blocks.AIR.defaultBlockState())
|| !CraftEventFactory.callTNTPrimeEvent(worldIn, hit.getBlockPos(), TNTPrimeEvent.PrimeCause.PROJECTILE, projectile, null)) {
ci.cancel();
}

View File

@ -115,7 +115,7 @@ public abstract class BaseSpawnerMixin {
entity.moveTo(entity.getX(), entity.getY(), entity.getZ(), level.random.nextFloat() * 360.0F, 0.0F);
if (entity instanceof Mob mob) {
if (spawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(level, MobSpawnType.SPAWNER) || !mob.checkSpawnObstruction(level)) {
if (!net.minecraftforge.event.ForgeEventFactory.checkSpawnPositionSpawner(mob, level, MobSpawnType.SPAWNER, spawnData, (BaseSpawner) (Object) this)) {
continue;
}

View File

@ -50,7 +50,7 @@ public class BlockBreakEventDispatcher {
return;
}
if (CraftEventFactory.callEntityChangeBlockEvent(entity, event.getPos(), Blocks.DIRT.defaultBlockState()).isCancelled()) {
if (!CraftEventFactory.callEntityChangeBlockEvent(entity, event.getPos(), Blocks.DIRT.defaultBlockState())) {
event.setCanceled(true);
}
}

View File

@ -1,3 +1,5 @@
# Arclight 1.20
public net.minecraft.world.entity.item.FallingBlockEntity f_31947_ # cancelDrop
# Arclight 1.19.4
public net.minecraft.world.item.DebugStickItem m_150802_(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;ZLnet/minecraft/world/item/ItemStack;)Z # handleInteraction
public net.minecraft.world.level.block.ComposterBlock m_269590_(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState; # empty

View File

@ -14,7 +14,7 @@ allprojects {
ext {
agpVersion = '1.23'
minecraftVersion = '1.20.1'
forgeVersion = '47.0.3'
forgeVersion = '47.1.0'
apiVersion = '1.5.4'
toolsVersion = '1.3.0'
mixinVersion = '0.8.5'