Store progress

This commit is contained in:
IzzelAliz 2020-06-13 14:37:28 +08:00
parent be9ed9abe6
commit 620c83cbe4
20 changed files with 246 additions and 50 deletions

View File

@ -168,6 +168,7 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
@Shadow protected abstract void applyEnchantments(LivingEntity entityLivingBaseIn, Entity entityIn);
@Shadow public abstract float getEyeHeight();
@Shadow @Nullable public abstract Entity changeDimension(DimensionType destination);
@Shadow public abstract boolean isRidingSameEntity(Entity entityIn);
// @formatter:on
private static final int CURRENT_LEVEL = 2;

View File

@ -63,6 +63,7 @@ public abstract class MobEntityMixin extends LivingEntityMixin implements MobEnt
@Shadow @Nullable public abstract Entity getLeashHolder();
@Shadow public abstract boolean isNoDespawnRequired();
@Shadow protected void updateAITasks() { }
@Shadow public abstract boolean isAIDisabled();
// @formatter:on
@Inject(method = "setCanPickUpLoot", at = @At("HEAD"))

View File

@ -26,7 +26,7 @@ public class BreedGoalMixin {
// @formatter:off
@Shadow @Final protected AnimalEntity animal;
@Shadow protected AnimalEntity field_75391_e;
@Shadow protected AnimalEntity targetMate;
@Shadow @Final protected World world;
// @formatter:on
@ -39,11 +39,11 @@ public class BreedGoalMixin {
((LivingEntityBridge) ageableEntity).bridge$setPersist(true);
}
ServerPlayerEntity playerEntity = this.animal.getLoveCause();
if (playerEntity == null && this.field_75391_e.getLoveCause() != null) {
playerEntity = this.field_75391_e.getLoveCause();
if (playerEntity == null && this.targetMate.getLoveCause() != null) {
playerEntity = this.targetMate.getLoveCause();
}
arclight$exp = this.animal.getRNG().nextInt(7) + 1;
EntityBreedEvent event = CraftEventFactory.callEntityBreedEvent(ageableEntity, this.animal, this.field_75391_e, playerEntity, ((AnimalEntityBridge) this.animal).bridge$getBreedItem(), arclight$exp);
EntityBreedEvent event = CraftEventFactory.callEntityBreedEvent(ageableEntity, this.animal, this.targetMate, playerEntity, ((AnimalEntityBridge) this.animal).bridge$getBreedItem(), arclight$exp);
if (event.isCancelled()) {
ci.cancel();
return;

View File

@ -14,10 +14,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(DefendVillageTargetGoal.class)
public class DefendVillageTargetGoalMixin {
@Shadow @Final private IronGolemEntity field_75305_a;
@Shadow @Final private IronGolemEntity irongolem;
@Inject(method = "startExecuting", at = @At("HEAD"))
public void arclight$reason(CallbackInfo ci) {
((MobEntityBridge) this.field_75305_a).bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true);
((MobEntityBridge) this.irongolem).bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.DEFEND_VILLAGE, true);
}
}

View File

@ -24,6 +24,7 @@ public class EatGrassGoalMixin {
public void arclight$capturePos1(CallbackInfo ci, BlockPos pos) {
arclight$pos = pos;
}
@Inject(method = "tick", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Z"))
public void arclight$capturePos2(CallbackInfo ci, BlockPos pos) {
arclight$pos = pos.down();

View File

@ -1,6 +1,7 @@
package io.izzel.arclight.common.mixin.core.entity.boss.dragon;
import io.izzel.arclight.common.mixin.core.entity.MobEntityMixin;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.boss.dragon.EnderDragonEntity;
@ -98,7 +99,7 @@ public abstract class EnderDragonEntityMixin extends MobEntityMixin {
} else {
for (final org.bukkit.block.Block block2 : event.blockList()) {
final org.bukkit.Material blockId = block2.getType();
if (blockId == org.bukkit.Material.AIR) {
if (blockId.isAir()) {
continue;
}
final CraftBlock craftBlock = (CraftBlock) block2;
@ -107,7 +108,11 @@ public abstract class EnderDragonEntityMixin extends MobEntityMixin {
if (nmsBlock.canDropFromExplosion(this.explosionSource)) {
final TileEntity tileentity = nmsBlock.hasTileEntity() ? this.world.getTileEntity(blockposition2) : null;
final LootContext.Builder loottableinfo_builder = new LootContext.Builder((ServerWorld) this.world).withRandom(this.world.rand).withParameter(LootParameters.POSITION, blockposition2).withParameter(LootParameters.TOOL, ItemStack.EMPTY).withParameter(LootParameters.EXPLOSION_RADIUS, 1.0f / event.getYield()).withNullableParameter(LootParameters.BLOCK_ENTITY, tileentity);
net.minecraft.block.Block.spawnDrops(craftBlock.getNMS(), loottableinfo_builder);
for (ItemStack stack : craftBlock.getNMS().getDrops(loottableinfo_builder)) {
Block.spawnAsEntity(this.world, blockposition2, stack);
}
craftBlock.getNMS().spawnAdditionalDrops(this.world, blockposition2, ItemStack.EMPTY);
// net.minecraft.block.Block.spawnDrops(craftBlock.getNMS(), loottableinfo_builder);
}
nmsBlock.onExplosionDestroy(this.world, blockposition2, this.explosionSource);
this.world.removeBlock(blockposition2, false);

View File

@ -1,26 +1,16 @@
package io.izzel.arclight.common.mixin.core.entity.item;
import com.google.common.collect.Lists;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.mixin.core.entity.LivingEntityMixin;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v.CraftEquipmentSlot;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.craftbukkit.v.inventory.CraftItemStack;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@ -44,25 +34,6 @@ public abstract class ArmorStandEntityMixin extends LivingEntityMixin {
return this.rotationYaw;
}
@Inject(method = "swapItem", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerEntity;abilities:Lnet/minecraft/entity/player/PlayerAbilities;"))
public void arclight$manipulateEvent(PlayerEntity playerEntity, EquipmentSlotType slotType, ItemStack itemStack, Hand hand, CallbackInfo ci) {
ItemStack itemStack1 = this.getItemStackFromSlot(slotType);
org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemStack1);
org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemStack);
Player player = ((ServerPlayerEntityBridge) playerEntity).bridge$getBukkitEntity();
ArmorStand self = (ArmorStand) this.getBukkitEntity();
EquipmentSlot slot = CraftEquipmentSlot.getSlot(slotType);
PlayerArmorStandManipulateEvent event = new PlayerArmorStandManipulateEvent(player, self, playerHeldItem, armorStandItem, slot);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
ci.cancel();
}
}
@Inject(method = "attackEntityFrom", cancellable = true, at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/entity/item/ArmorStandEntity;remove()V"))
public void arclight$damageDropOut(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
if (CraftEventFactory.handleNonLivingEntityDamageEvent((ArmorStandEntity) (Object) this, source, amount)) {

View File

@ -67,11 +67,13 @@ public abstract class BoatEntityMixin extends EntityMixin {
@Inject(method = "applyEntityCollision", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;applyEntityCollision(Lnet/minecraft/entity/Entity;)V"))
private void arclight$collideVehicle(Entity entityIn, CallbackInfo ci) {
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), ((EntityBridge) entityIn).bridge$getBukkitEntity());
Bukkit.getPluginManager().callEvent(event);
if (isRidingSameEntity(entityIn)) {
VehicleEntityCollisionEvent event = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), ((EntityBridge) entityIn).bridge$getBukkitEntity());
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
ci.cancel();
if (event.isCancelled()) {
ci.cancel();
}
}
}
@ -91,7 +93,7 @@ public abstract class BoatEntityMixin extends EntityMixin {
@Redirect(method = "updateFallState", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/item/BoatEntity;removed:Z"))
private boolean arclight$breakVehicle(BoatEntity boatEntity) {
if (!boatEntity.removed) {
final Vehicle vehicle = (Vehicle)this.getBukkitEntity();
final Vehicle vehicle = (Vehicle) this.getBukkitEntity();
final VehicleDestroyEvent event = new VehicleDestroyEvent(vehicle, null);
Bukkit.getPluginManager().callEvent(event);
return event.isCancelled();

View File

@ -31,7 +31,6 @@ public abstract class CreeperEntityMixin extends CreatureEntityMixin implements
// @formatter:off
@Shadow @Final private static DataParameter<Boolean> POWERED;
@Shadow public abstract boolean getPowered();
@Shadow public int explosionRadius;
@Shadow protected abstract void spawnLingeringCloud();
@Shadow private int timeSinceIgnited;
@ -52,7 +51,7 @@ public abstract class CreeperEntityMixin extends CreatureEntityMixin implements
public void explode() {
if (!this.world.isRemote) {
Explosion.Mode explosion_effect = ForgeEventFactory.getMobGriefingEvent(this.world, (CreeperEntity) (Object) this) ? Explosion.Mode.DESTROY : Explosion.Mode.NONE;
final float f = this.getPowered() ? 2.0f : 1.0f;
final float f = this.dataManager.get(POWERED) ? 2.0f : 1.0f;
final ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {

View File

@ -25,10 +25,10 @@ public class FoxEntity_MateGoalMixin extends BreedGoalMixin {
*/
@Overwrite
protected void spawnBaby() {
FoxEntity foxentity = (FoxEntity) this.animal.createChild(this.field_75391_e);
FoxEntity foxentity = (FoxEntity) this.animal.createChild(this.targetMate);
if (foxentity != null) {
ServerPlayerEntity serverplayerentity = this.animal.getLoveCause();
ServerPlayerEntity serverplayerentity1 = this.field_75391_e.getLoveCause();
ServerPlayerEntity serverplayerentity1 = this.targetMate.getLoveCause();
ServerPlayerEntity serverplayerentity2 = serverplayerentity;
if (serverplayerentity != null) {
((FoxEntityBridge) foxentity).bridge$addTrustedUUID(serverplayerentity.getUniqueID());
@ -40,21 +40,21 @@ public class FoxEntity_MateGoalMixin extends BreedGoalMixin {
((FoxEntityBridge) foxentity).bridge$addTrustedUUID(serverplayerentity1.getUniqueID());
}
int experience = this.animal.getRNG().nextInt(7) + 1;
final EntityBreedEvent entityBreedEvent = CraftEventFactory.callEntityBreedEvent(foxentity, this.animal, this.field_75391_e, serverplayerentity, ((AnimalEntityBridge) this.animal).bridge$getBreedItem(), experience);
final EntityBreedEvent entityBreedEvent = CraftEventFactory.callEntityBreedEvent(foxentity, this.animal, this.targetMate, serverplayerentity, ((AnimalEntityBridge) this.animal).bridge$getBreedItem(), experience);
if (entityBreedEvent.isCancelled()) {
return;
}
experience = entityBreedEvent.getExperience();
if (serverplayerentity2 != null) {
serverplayerentity2.addStat(Stats.ANIMALS_BRED);
CriteriaTriggers.BRED_ANIMALS.trigger(serverplayerentity2, this.animal, this.field_75391_e, foxentity);
CriteriaTriggers.BRED_ANIMALS.trigger(serverplayerentity2, this.animal, this.targetMate, foxentity);
}
int i = 6000;
this.animal.setGrowingAge(6000);
this.field_75391_e.setGrowingAge(6000);
this.targetMate.setGrowingAge(6000);
this.animal.resetInLove();
this.field_75391_e.resetInLove();
this.targetMate.resetInLove();
foxentity.setGrowingAge(-24000);
foxentity.setLocationAndAngles(this.animal.posX, this.animal.posY, this.animal.posZ, 0.0F, 0.0F);
((WorldBridge) this.world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.BREEDING);

View File

@ -0,0 +1,19 @@
package io.izzel.arclight.common.mixin.core.entity.projectile;
import net.minecraft.entity.projectile.AbstractFireballEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
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.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(AbstractFireballEntity.class)
public class AbstractFireballEntityMixin {
@Inject(method = "readAdditional", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/AbstractFireballEntity;setStack(Lnet/minecraft/item/ItemStack;)V"))
private void arclight$nonNullItem(CompoundNBT compound, CallbackInfo ci, ItemStack stack) {
if (stack.isEmpty()) ci.cancel();
}
}

View File

@ -0,0 +1,48 @@
package io.izzel.arclight.common.mixin.v1_15.entity.item;
import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v.CraftEquipmentSlot;
import org.bukkit.craftbukkit.v.inventory.CraftItemStack;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.inventory.EquipmentSlot;
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.CallbackInfoReturnable;
@Mixin(ArmorStandEntity.class)
public abstract class ArmorStandEntityMixin_1_15 {
// @formatter:off
@Shadow public abstract ItemStack getItemStackFromSlot(EquipmentSlotType slotIn);
// @formatter:on
@Inject(method = "func_226529_a_", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerEntity;abilities:Lnet/minecraft/entity/player/PlayerAbilities;"))
public void arclight$manipulateEvent(PlayerEntity playerEntity, EquipmentSlotType slotType, ItemStack itemStack, Hand hand, CallbackInfoReturnable<Boolean> cir) {
ItemStack itemStack1 = this.getItemStackFromSlot(slotType);
org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemStack1);
org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemStack);
Player player = ((ServerPlayerEntityBridge) playerEntity).bridge$getBukkitEntity();
ArmorStand self = (ArmorStand) ((EntityBridge) this).bridge$getBukkitEntity();
EquipmentSlot slot = CraftEquipmentSlot.getSlot(slotType);
PlayerArmorStandManipulateEvent event = new PlayerArmorStandManipulateEvent(player, self, playerHeldItem, armorStandItem, slot);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
cir.setReturnValue(true);
}
}
}

View File

@ -0,0 +1,46 @@
package io.izzel.arclight.common.mixin.v1_15.entity.passive;
import io.izzel.arclight.common.bridge.entity.LivingEntityBridge;
import io.izzel.arclight.common.mixin.core.entity.passive.AnimalEntityMixin;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.BeeEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.DamageSource;
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.event.entity.EntityTargetEvent;
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.CallbackInfoReturnable;
@Mixin(BeeEntity.class)
public abstract class BeeEntityMixin extends AnimalEntityMixin {
// @formatter:off
@Shadow private BeeEntity.PollinateGoal pollinateGoal;
@Shadow public abstract boolean setBeeAttacker(Entity attacker);
// @formatter:on
@Inject(method = "attackEntityAsMob", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;addPotionEffect(Lnet/minecraft/potion/EffectInstance;)Z"))
private void arclight$sting(Entity entityIn, CallbackInfoReturnable<Boolean> cir) {
((LivingEntityBridge) entityIn).bridge$pushEffectCause(EntityPotionEffectEvent.Cause.ATTACK);
}
@Inject(method = "attackEntityAsMob", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/BeeEntity;setAttackTarget(Lnet/minecraft/entity/LivingEntity;)V"))
private void arclight$stungTarget(Entity entityIn, CallbackInfoReturnable<Boolean> cir) {
bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.FORGOT_TARGET, true);
}
@Redirect(method = "attackEntityFrom", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/AnimalEntity;attackEntityFrom(Lnet/minecraft/util/DamageSource;F)Z"))
private boolean arclight$attackUpdateTarget(AnimalEntity animalEntity, DamageSource source, float amount) {
boolean result = super.attackEntityFrom(source, amount);
if (result && !this.world.isRemote && source.getTrueSource() instanceof PlayerEntity && !((PlayerEntity) source.getTrueSource()).isCreative() && this.canEntityBeSeen(source.getTrueSource()) && !this.isAIDisabled()) {
this.pollinateGoal.cancel();
this.setBeeAttacker(source.getTrueSource());
}
return result;
}
}

View File

@ -0,0 +1,19 @@
package io.izzel.arclight.common.mixin.v1_15.entity.passive;
import io.izzel.arclight.common.bridge.entity.MobEntityBridge;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import org.bukkit.event.entity.EntityTargetEvent;
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.callback.CallbackInfo;
@Mixin(targets = "net.minecraft.entity.passive.BeeEntity.AngerGoal")
public class BeeEntity_AngerGoalMixin {
@Inject(method = "setAttackTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/MobEntity;setAttackTarget(Lnet/minecraft/entity/LivingEntity;)V"))
private void arclight$reason(MobEntity mobIn, LivingEntity targetIn, CallbackInfo ci) {
((MobEntityBridge) mobIn).bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true);
}
}

View File

@ -0,0 +1,27 @@
package io.izzel.arclight.common.mixin.v1_15.entity.passive;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.passive.BeeEntity;
import net.minecraft.state.IntegerProperty;
import net.minecraft.util.math.BlockPos;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
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;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(targets = "net.minecraft.entity.passive.BeeEntity.FindPollinationTargetGoal")
public class BeeEntity_FindPollinationTargetGoalMixin {
@Shadow(aliases = {"this$0", "field_226483_b_"}) private BeeEntity outerThis;
@Inject(method = "tick", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playEvent(ILnet/minecraft/util/math/BlockPos;I)V"))
private void arclight$entityChangeBlock(CallbackInfo ci, int i, BlockPos blockPos, BlockState blockState, Block block, boolean flag, IntegerProperty property) {
if (CraftEventFactory.callEntityChangeBlockEvent(outerThis, blockPos, blockState.with(property, blockState.get(property) + 1)).isCancelled()) {
ci.cancel();
}
}
}

View File

@ -30,6 +30,9 @@ public net.minecraft.world.end.DragonFightManager func_186095_a(Lnet/minecraft/w
public net.minecraft.world.end.DragonFightManager field_186119_m #dragonUniqueId
public net.minecraft.world.end.DragonFightManager field_186121_o #exitPortalLocation
public net.minecraft.world.end.DragonFightManager field_186122_p #respawnState
public net.minecraft.entity.passive.BeeEntity field_226364_bD_ #stayOutOfHiveCountdown
public net.minecraft.entity.passive.BeeEntity$PollinateGoal
public net.minecraft.entity.passive.BeeEntity.PollinateGoal func_226504_l_()V #cancel
# Bukkit
public net.minecraft.entity.player.PlayerEntity func_190531_bD()I
public net.minecraft.entity.item.ItemFrameEntity func_174859_a(Lnet/minecraft/util/Direction;)V

View File

@ -49,6 +49,10 @@
"command.impl.TimeCommandMixin",
"enchantment.FrostWalkerEnchantmentMixin_1_15",
"entity.EntityMixin_1_15",
"entity.item.ArmorStandEntityMixin_1_15",
"entity.passive.BeeEntity_AngerGoalMixin",
"entity.passive.BeeEntity_FindPollinationTargetGoalMixin",
"entity.passive.BeeEntityMixin",
"world.biome.BiomeContainerMixin",
"world.chunk.ChunkMixin_1_15",
"world.dimension.DimensionTypeMixin_1_15",

View File

@ -197,6 +197,7 @@
"entity.player.PlayerInventoryMixin",
"entity.player.ServerPlayerEntityMixin",
"entity.projectile.AbstractArrowEntityMixin",
"entity.projectile.AbstractFireballEntityMixin",
"entity.projectile.ArrowEntityMixin",
"entity.projectile.DamagingProjectileEntityMixin",
"entity.projectile.EggEntityMixin",

View File

@ -0,0 +1,48 @@
package io.izzel.arclight.impl.mixin.v1_14.entity.item;
import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Hand;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v.CraftEquipmentSlot;
import org.bukkit.craftbukkit.v.inventory.CraftItemStack;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerArmorStandManipulateEvent;
import org.bukkit.inventory.EquipmentSlot;
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;
@Mixin(ArmorStandEntity.class)
public abstract class ArmorStandEntityMixin_1_14 {
// @formatter:off
@Shadow public abstract ItemStack getItemStackFromSlot(EquipmentSlotType slotIn);
// @formatter:on
@Inject(method = "swapItem", cancellable = true, at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerEntity;abilities:Lnet/minecraft/entity/player/PlayerAbilities;"))
public void arclight$manipulateEvent(PlayerEntity playerEntity, EquipmentSlotType slotType, ItemStack itemStack, Hand hand, CallbackInfo ci) {
ItemStack itemStack1 = this.getItemStackFromSlot(slotType);
org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemStack1);
org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemStack);
Player player = ((ServerPlayerEntityBridge) playerEntity).bridge$getBukkitEntity();
ArmorStand self = (ArmorStand) ((EntityBridge) this).bridge$getBukkitEntity();
EquipmentSlot slot = CraftEquipmentSlot.getSlot(slotType);
PlayerArmorStandManipulateEvent event = new PlayerArmorStandManipulateEvent(player, self, playerHeldItem, armorStandItem, slot);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
ci.cancel();
}
}
}

View File

@ -48,6 +48,7 @@
"command.impl.TeleportCommandMixin_1_14",
"enchantment.FrostWalkerEnchantmentMixin_1_14",
"entity.EntityMixin_1_14",
"entity.item.ArmorStandEntityMixin_1_14",
"world.chunk.ChunkMixin_1_14",
"world.dimension.DimensionTypeMixin_1_14",
"world.server.TicketManagerMixin_1_14"