From c051d2ab16cc19bc5e7cca0b665db9b0f042bd59 Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Thu, 21 Jan 2021 22:27:58 +0800 Subject: [PATCH] Update to 1.16.5, forge 36.0.1 --- README.md | 2 +- arclight-common/build.gradle | 10 ++++----- .../bridge/entity/LivingEntityBridge.java | 6 ++++++ .../mixin/core/entity/LivingEntityMixin.java | 21 +++++++++++++++++++ .../ai/goal/TriggerSkeletonTrapGoalMixin.java | 9 +++++--- .../entity/item/ArmorStandEntityMixin.java | 18 ++++++++++++++++ .../core/entity/player/PlayerEntityMixin.java | 15 +++++++++++++ .../core/server/MinecraftServerMixin.java | 2 +- .../src/main/resources/async_catcher.json | 5 +++++ arclight-forge-1.16/build.gradle | 12 +++++------ .../forgeinstaller/ForgeInstaller.java | 3 ++- 11 files changed, 86 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 2228b387..cb80d131 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A Bukkit server implementation utilizing Mixin. | Minecraft | Forge | Status | Build | | :----: | :----: | :---: | :---: | -| 1.16.x | 35.1.29 | ACTIVE | [![1.16 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-16?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-16) | +| 1.16.x | 36.0.1 | ACTIVE | [![1.16 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-16?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-16) | | 1.15.x | 31.2.47 | ACTIVE | [![1.15 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-15?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-15) | | 1.14.x | 28.2.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.0.6) | [![1.14 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight) | diff --git a/arclight-common/build.gradle b/arclight-common/build.gradle index a7c4d47c..bf28614a 100644 --- a/arclight-common/build.gradle +++ b/arclight-common/build.gradle @@ -20,8 +20,8 @@ apply plugin: 'idea' apply plugin: 'io.izzel.arclight' ext { - minecraftVersion = '1.16.4' - forgeVersion = '35.1.29' + minecraftVersion = '1.16.5' + forgeVersion = '36.0.1' } arclight { @@ -53,14 +53,14 @@ dependencies { minecraft "net.minecraftforge:forge:$minecraftVersion-$forgeVersion" compile "org.spigotmc:spigot-api:$minecraftVersion-R0.1-SNAPSHOT@jar" compile 'org.jetbrains:annotations:19.0.0' - compile 'org.spongepowered:mixin:0.8.1' + compile 'org.spongepowered:mixin:0.8.2' compile 'com.github.ArclightTeam:mixin-tools:1.0.0' compile 'jline:jline:2.12.1' compile 'net.md-5:SpecialSource:1.8.6' compile 'org.apache.logging.log4j:log4j-jul:2.11.2' - compile 'net.md-5:bungeecord-chat:1.16-R0.3' + compile 'net.md-5:bungeecord-chat:1.16-R0.4' compile 'mysql:mysql-connector-java:5.1.49' - compile 'org.yaml:snakeyaml:1.26' + compile 'org.yaml:snakeyaml:1.27' compile project(':arclight-api') compile project(':i18n-config') } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/bridge/entity/LivingEntityBridge.java b/arclight-common/src/main/java/io/izzel/arclight/common/bridge/entity/LivingEntityBridge.java index 9ffa8c8d..028667b2 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/bridge/entity/LivingEntityBridge.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/bridge/entity/LivingEntityBridge.java @@ -1,5 +1,7 @@ package io.izzel.arclight.common.bridge.entity; +import net.minecraft.inventory.EquipmentSlotType; +import net.minecraft.item.ItemStack; import net.minecraft.potion.Effect; import net.minecraft.potion.EffectInstance; import org.bukkit.craftbukkit.v.entity.CraftLivingEntity; @@ -10,6 +12,10 @@ import java.util.Optional; public interface LivingEntityBridge extends EntityBridge { + void bridge$setSlot(EquipmentSlotType slotIn, ItemStack stack, boolean silent); + + void bridge$playEquipSound(ItemStack stack, boolean silent); + boolean bridge$canPickUpLoot(); boolean bridge$isForceDrops(); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/LivingEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/LivingEntityMixin.java index 6bdcdddc..10efe1ef 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/LivingEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/LivingEntityMixin.java @@ -172,6 +172,7 @@ public abstract class LivingEntityMixin extends EntityMixin implements LivingEnt @Shadow public abstract boolean getShouldBeDead(); @Shadow public abstract int getArrowCountInEntity(); @Shadow @Final private static DataParameter ARROW_COUNT_IN_ENTITY; + @Shadow public abstract void setItemStackToSlot(EquipmentSlotType slotIn, ItemStack stack); // @formatter:on public int expToDrop; @@ -1088,4 +1089,24 @@ public abstract class LivingEntityMixin extends EntityMixin implements LivingEnt private boolean arclight$callArrowCountChange(int newCount, boolean reset) { return CraftEventFactory.callArrowBodyCountChangeEvent((LivingEntity) (Object) this, this.getArrowCountInEntity(), newCount, reset).isCancelled(); } + + public void setSlot(EquipmentSlotType slotIn, ItemStack stack, boolean silent) { + this.setItemStackToSlot(slotIn, stack); + } + + @Override + public void bridge$setSlot(EquipmentSlotType slotIn, ItemStack stack, boolean silent) { + this.setSlot(slotIn, stack, silent); + } + + protected void playEquipSound(ItemStack stack, boolean silent) { + if (!silent) { + this.playEquipSound(stack); + } + } + + @Override + public void bridge$playEquipSound(ItemStack stack, boolean silent) { + this.playEquipSound(stack, silent); + } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/ai/goal/TriggerSkeletonTrapGoalMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/ai/goal/TriggerSkeletonTrapGoalMixin.java index a0c3f390..d8ce513b 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/ai/goal/TriggerSkeletonTrapGoalMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/ai/goal/TriggerSkeletonTrapGoalMixin.java @@ -15,6 +15,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.Redirect; +import org.spongepowered.asm.mixin.injection.Slice; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(TriggerSkeletonTrapGoal.class) @@ -24,18 +25,20 @@ public class TriggerSkeletonTrapGoalMixin { @Shadow @Final private SkeletonHorseEntity horse; // @formatter:on - @Inject(method = "tick", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/server/ServerWorld;func_242417_l(Lnet/minecraft/entity/Entity;)V")) + @Inject(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;func_242417_l(Lnet/minecraft/entity/Entity;)V"), + slice = @Slice(to = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/goal/TriggerSkeletonTrapGoal;createHorse(Lnet/minecraft/world/DifficultyInstance;)Lnet/minecraft/entity/passive/horse/AbstractHorseEntity;"))) private void arclight$thunder(CallbackInfo ci) { ((WorldBridge) this.horse.world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.TRAP); } - @Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;addEntity(Lnet/minecraft/entity/Entity;)Z")) + @Redirect(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;addEntity(Lnet/minecraft/entity/Entity;)Z")) private boolean arclight$addHorse(ServerWorld world, Entity entityIn) { ((ServerWorldBridge) world).bridge$strikeLightning((LightningBoltEntity) entityIn, LightningStrikeEvent.Cause.TRAP); return true; } - @Inject(method = "tick", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/world/server/ServerWorld;func_242417_l(Lnet/minecraft/entity/Entity;)V")) + @Inject(method = "*", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;func_242417_l(Lnet/minecraft/entity/Entity;)V"), + slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/entity/ai/goal/TriggerSkeletonTrapGoal;createHorse(Lnet/minecraft/world/DifficultyInstance;)Lnet/minecraft/entity/passive/horse/AbstractHorseEntity;"))) private void arclight$jockey(CallbackInfo ci) { ((WorldBridge) this.horse.world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.JOCKEY); } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/item/ArmorStandEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/item/ArmorStandEntityMixin.java index 80a36a98..72133f94 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/item/ArmorStandEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/item/ArmorStandEntityMixin.java @@ -11,6 +11,7 @@ import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.Hand; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.GameRules; import net.minecraft.world.World; @@ -22,6 +23,7 @@ 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.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -41,6 +43,8 @@ public abstract class ArmorStandEntityMixin extends LivingEntityMixin { // @formatter:off @Shadow private boolean canInteract; @Shadow public abstract ItemStack getItemStackFromSlot(EquipmentSlotType slotIn); + @Shadow @Final private NonNullList handItems; + @Shadow @Final private NonNullList armorItems; // @formatter:on @Override @@ -157,4 +161,18 @@ public abstract class ArmorStandEntityMixin extends LivingEntityMixin { cir.setReturnValue(true); } } + + @Override + public void setSlot(EquipmentSlotType slotIn, ItemStack stack, boolean silent) { + switch (slotIn.getSlotType()) { + case HAND: + this.bridge$playEquipSound(stack, silent); + this.handItems.set(slotIn.getIndex(), stack); + break; + case ARMOR: + this.bridge$playEquipSound(stack, silent); + this.armorItems.set(slotIn.getIndex(), stack); + } + + } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/PlayerEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/PlayerEntityMixin.java index c5afca22..91b368e3 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/PlayerEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/PlayerEntityMixin.java @@ -27,6 +27,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.inventory.EnderChestInventory; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.PlayerContainer; import net.minecraft.item.ItemStack; @@ -492,4 +493,18 @@ public abstract class PlayerEntityMixin extends LivingEntityMixin implements Pla public CraftHumanEntity bridge$getBukkitEntity() { return (CraftHumanEntity) ((InternalEntityBridge) this).internal$getBukkitEntity(); } + + @Override + public void setSlot(EquipmentSlotType slotIn, ItemStack stack, boolean silent) { + if (slotIn == EquipmentSlotType.MAINHAND) { + this.bridge$playEquipSound(stack, silent); + this.inventory.mainInventory.set(this.inventory.currentItem, stack); + } else if (slotIn == EquipmentSlotType.OFFHAND) { + this.bridge$playEquipSound(stack, silent); + this.inventory.offHandInventory.set(0, stack); + } else if (slotIn.getSlotType() == EquipmentSlotType.Group.ARMOR) { + this.bridge$playEquipSound(stack, silent); + this.inventory.armorInventory.set(slotIn.getIndex(), stack); + } + } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/MinecraftServerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/MinecraftServerMixin.java index 7969d0ef..c40e7dcc 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/MinecraftServerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/MinecraftServerMixin.java @@ -120,7 +120,7 @@ public abstract class MinecraftServerMixin extends RecursiveEventLoop