diff --git a/README.md b/README.md index 5428e01b..292b063d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A Bukkit server implementation utilizing Mixin. | Minecraft | Forge | Status | Build | | :----: | :----: | :---: | :---: | -| 1.17.x | 37.0.1 | ACTIVE | [![1.17 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-17?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-17) | +| 1.17.x | 37.0.44 | ACTIVE | [![1.17 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-17?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-17) | | 1.16.x | 36.2.0 | 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.48 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.15/1.0.19) | [![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) | @@ -32,7 +32,7 @@ Please read this [wiki section](https://github.com/IzzelAliz/Arclight/wiki/Contr ## License -This project in licensed under [GPL v3](LICENSE). +This project is licensed under [GPL v3](LICENSE). ## Sponsor diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java index a15cdae2..a3206c2f 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java @@ -1194,6 +1194,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB // CraftBukkit end InteractionResult enuminteractionresult = interaction.run(player, entity, hand); + if (ForgeHooks.onInteractEntityAt(player, entity, entity.position(), hand) != null) return; // CraftBukkit start if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) { diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/PlayerListMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/PlayerListMixin.java index 672115cf..7cc87a87 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/PlayerListMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/PlayerListMixin.java @@ -49,6 +49,7 @@ import net.minecraft.stats.ServerStatsCounter; import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; @@ -252,7 +253,7 @@ public abstract class PlayerListMixin implements PlayerListBridge { public ServerPlayer moveToWorld(ServerPlayer playerIn, ServerLevel worldIn, boolean flag, Location location, boolean avoidSuffocation) { playerIn.stopRiding(); this.removePlayer(playerIn); - playerIn.getLevel().removePlayer(playerIn, true); + playerIn.getLevel().removePlayerImmediately(playerIn, Entity.RemovalReason.DISCARDED); playerIn.revive(); BlockPos pos = playerIn.getRespawnPosition(); float f = playerIn.getRespawnAngle(); @@ -375,7 +376,7 @@ public abstract class PlayerListMixin implements PlayerListBridge { arclight$suffo = null; playerIn.stopRiding(); this.removePlayer(playerIn); - playerIn.getLevel().removePlayer(playerIn, true); // Forge: keep data until copyFrom called + playerIn.getLevel().removePlayerImmediately(playerIn, Entity.RemovalReason.DISCARDED); BlockPos pos = playerIn.getRespawnPosition(); float f = playerIn.getRespawnAngle(); boolean flag2 = playerIn.isRespawnForced(); @@ -449,7 +450,6 @@ public abstract class PlayerListMixin implements PlayerListBridge { if (!conqueredEnd) { // keep inventory here since inventory dropped at ServerPlayerEntity#onDeath serverplayerentity.getInventory().replaceWith(playerIn.getInventory()); } - playerIn.remove(false); // Forge: clone event had a chance to see old data, now discard it serverplayerentity.setId(playerIn.getId()); serverplayerentity.setMainArm(playerIn.getMainArm()); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java index 65784f4a..1916c4e0 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java @@ -128,7 +128,6 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge, @Shadow @Nullable public abstract MinecraftServer getServer(); @Shadow public abstract Vec3 getDeltaMovement(); @Shadow public abstract EntityType getType(); - @Shadow(remap = false) public void remove(boolean keepData) { } @Shadow @Final protected Random random; @Shadow public abstract float getBbWidth(); @Shadow public abstract float getBbHeight(); @@ -202,7 +201,7 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge, @Shadow public abstract void setInvisible(boolean invisible); @Shadow public ImmutableList passengers; @Shadow public abstract boolean isRemoved(); - @Shadow public abstract void remove(Entity.RemovalReason p_146834_); + @Shadow public void remove(Entity.RemovalReason p_146834_) {} @Shadow public abstract void discard(); @Shadow protected abstract void unsetRemoved(); @Shadow public abstract double getY(double p_20228_); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/animal/MushroomCowMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/animal/MushroomCowMixin.java index 29fdf4a0..8c451751 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/animal/MushroomCowMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/animal/MushroomCowMixin.java @@ -1,12 +1,10 @@ package io.izzel.arclight.common.mixin.core.world.entity.animal; import io.izzel.arclight.common.bridge.core.world.WorldBridge; -import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.animal.Cow; import net.minecraft.world.entity.animal.MushroomCow; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; import org.bukkit.craftbukkit.v.event.CraftEventFactory; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityTransformEvent; @@ -23,17 +21,17 @@ import java.util.List; @Mixin(MushroomCow.class) public abstract class MushroomCowMixin extends AnimalMixin { - @Redirect(method = "onSheared", remap = false, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/MushroomCow;remove(Z)V")) - private void arclight$animalTransformPre(MushroomCow mushroomCow, boolean keepData) { + @Redirect(method = "shearInternal", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/animal/MushroomCow;discard()V")) + private void arclight$animalTransformPre(MushroomCow mushroomCow) { } - @Inject(method = "onSheared", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z")) - private void arclight$animalTransform(Player player, ItemStack item, Level world, BlockPos pos, int fortune, CallbackInfoReturnable> cir, Cow cowEntity) { + @Inject(method = "shearInternal", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z")) + private void arclight$animalTransform(SoundSource p_28924_, CallbackInfoReturnable> cir, Cow cowEntity) { if (CraftEventFactory.callEntityTransformEvent((MushroomCow) (Object) this, cowEntity, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) { cir.setReturnValue(Collections.emptyList()); } else { ((WorldBridge) this.level).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.SHEARED); - this.remove(false); + this.discard(); } } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/SlimeMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/SlimeMixin.java index 254ca7a4..d73c41f4 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/SlimeMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/monster/SlimeMixin.java @@ -3,6 +3,7 @@ package io.izzel.arclight.common.mixin.core.world.entity.monster; import io.izzel.arclight.common.bridge.core.world.WorldBridge; import io.izzel.arclight.common.mixin.core.world.entity.MobMixin; import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import org.bukkit.Bukkit; @@ -32,7 +33,7 @@ public abstract class SlimeMixin extends MobMixin { */ @Overwrite(remap = false) @Override - public void remove(boolean keepData) { + public void remove(Entity.RemovalReason p_149847_) { int i = this.getSize(); if (!this.level.isClientSide && i > 1 && this.isDeadOrDying()) { Component itextcomponent = this.getCustomName(); @@ -44,7 +45,7 @@ public abstract class SlimeMixin extends MobMixin { SlimeSplitEvent event = new SlimeSplitEvent((Slime) this.getBukkitEntity(), k); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled() || event.getCount() <= 0) { - super.remove(keepData); + super.remove(p_149847_); return; } k = event.getCount(); @@ -73,6 +74,6 @@ public abstract class SlimeMixin extends MobMixin { this.level.addFreshEntity(living); } } - super.remove(keepData); + super.remove(p_149847_); } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/PlayerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/PlayerMixin.java index 3daa14fd..dd1ba391 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/PlayerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/player/PlayerMixin.java @@ -48,7 +48,6 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.InventoryMenu; import net.minecraft.world.inventory.PlayerEnderChestContainer; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.SwordItem; import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; @@ -296,9 +295,7 @@ public abstract class PlayerMixin extends LivingEntityMixin implements PlayerEnt final double d0 = this.walkDist - this.walkDistO; if (flag && !flag3 && !flag2 && this.onGround && d0 < this.getSpeed()) { final ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); - if (itemstack.getItem() instanceof SwordItem) { - flag4 = true; - } + flag4 = itemstack.canPerformAction(net.minecraftforge.common.ToolActions.SWORD_SWEEP); } float f4 = 0.0f; boolean flag5 = false; @@ -328,7 +325,7 @@ public abstract class PlayerMixin extends LivingEntityMixin implements PlayerEnt } if (flag4) { final float f5 = 1.0f + EnchantmentHelper.getSweepingDamageRatio((net.minecraft.world.entity.player.Player) (Object) this) * f; - final List list = this.level.getEntitiesOfClass(LivingEntity.class, entity.getBoundingBox().inflate(1.0, 0.25, 1.0)); + final List list = this.level.getEntitiesOfClass(LivingEntity.class, this.getItemInHand(InteractionHand.MAIN_HAND).getSweepHitBox((net.minecraft.world.entity.player.Player) (Object) this, entity)); for (final LivingEntity entityliving : list) { if (entityliving != (Object) this && entityliving != entity && !this.isAlliedTo(entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr(entityliving) < 9.0 && entityliving.hurt(((DamageSourceBridge) DamageSource.playerAttack((net.minecraft.world.entity.player.Player) (Object) this)).bridge$sweep(), f5)) { entityliving.knockback(0.4f, Mth.sin(this.getYRot() * 0.017453292f), -Mth.cos(this.getYRot() * 0.017453292f)); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mod/server/BukkitRegistry.java b/arclight-common/src/main/java/io/izzel/arclight/common/mod/server/BukkitRegistry.java index 6c3780b1..ec7e7c39 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mod/server/BukkitRegistry.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mod/server/BukkitRegistry.java @@ -273,12 +273,12 @@ public class BukkitRegistry { private static void loadPotions() { int origin = PotionEffectType.values().length; - int size = ForgeRegistries.POTIONS.getEntries().size(); - int maxId = ForgeRegistries.POTIONS.getValues().stream().mapToInt(MobEffect::getId).max().orElse(0); + int size = ForgeRegistries.MOB_EFFECTS.getEntries().size(); + int maxId = ForgeRegistries.MOB_EFFECTS.getValues().stream().mapToInt(MobEffect::getId).max().orElse(0); PotionEffectType[] types = new PotionEffectType[maxId + 1]; putStatic(PotionEffectType.class, "byId", types); putBool(PotionEffectType.class, "acceptingNew", true); - for (MobEffect eff : ForgeRegistries.POTIONS) { + for (MobEffect eff : ForgeRegistries.MOB_EFFECTS) { try { String name = ResourceLocationUtil.standardize(eff.getRegistryName()); ArclightPotionEffect effect = new ArclightPotionEffect(eff, name); @@ -381,7 +381,7 @@ public class BukkitRegistry { private static Set> registries() { return ImmutableSet.of(ForgeRegistries.BLOCKS, ForgeRegistries.ITEMS, - ForgeRegistries.POTION_TYPES, ForgeRegistries.POTIONS, + ForgeRegistries.MOB_EFFECTS, ForgeRegistries.POTIONS, ForgeRegistries.ENTITIES, ForgeRegistries.BLOCK_ENTITIES, ForgeRegistries.BIOMES); } diff --git a/arclight-forge/build.gradle b/arclight-forge/build.gradle index 8a0103f8..8cf8c29a 100644 --- a/arclight-forge/build.gradle +++ b/arclight-forge/build.gradle @@ -110,6 +110,7 @@ jar { } task generateInstallerInfo { + inputs.property('forgeVersion', forgeVersion) def installer = file("${project.buildDir}/arclight_installer/META-INF/installer.json") outputs.file(installer) doLast { diff --git a/arclight-forge/src/main/java/io/izzel/arclight/boot/Main_Forge.java b/arclight-forge/src/main/java/io/izzel/arclight/boot/Main_Forge.java index ff6df54a..8c8d7632 100644 --- a/arclight-forge/src/main/java/io/izzel/arclight/boot/Main_Forge.java +++ b/arclight-forge/src/main/java/io/izzel/arclight/boot/Main_Forge.java @@ -22,6 +22,7 @@ public class Main_Forge { } catch (Exception e) { e.printStackTrace(); System.err.println("Fail to launch Arclight."); + System.exit(-1); } } } diff --git a/build.gradle b/build.gradle index de02d550..d7bf10bf 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ allprojects { ext { agpVersion = '1.20' minecraftVersion = '1.17.1' - forgeVersion = '37.0.1' + forgeVersion = '37.0.44' apiVersion = '1.0.+' toolsVersion = '1.3.+' gitHash = getGitHash() diff --git a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java index 8e654058..51ded740 100644 --- a/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java +++ b/forge-installer/src/main/java/io/izzel/arclight/forgeinstaller/ForgeInstaller.java @@ -76,7 +76,7 @@ public class ForgeInstaller { try { ProcessBuilder builder = new ProcessBuilder(); File file = new File(System.getProperty("java.home"), "bin/java"); - builder.command(file.getCanonicalPath(), "-Djava.net.useSystemProxies=true", "-jar", String.format("forge-%s-%s-installer.jar", installInfo.installer.minecraft, installInfo.installer.forge), "--installServer", "."); + builder.command(file.getCanonicalPath(), "-Djava.net.useSystemProxies=true", "-jar", String.format("forge-%s-%s-installer.jar", installInfo.installer.minecraft, installInfo.installer.forge), "--installServer", ".", "--debug"); builder.inheritIO(); Process process = builder.start(); process.waitFor();