Update to forge 37.0.44

This commit is contained in:
IzzelAliz 2021-08-26 17:08:18 +08:00
parent 71151d8797
commit 547467a845
12 changed files with 27 additions and 29 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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());

View File

@ -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<Entity> 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_);

View File

@ -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<List<ItemStack>> 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<List<ItemStack>> 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();
}
}
}

View File

@ -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_);
}
}

View File

@ -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<LivingEntity> list = this.level.getEntitiesOfClass(LivingEntity.class, entity.getBoundingBox().inflate(1.0, 0.25, 1.0));
final List<LivingEntity> 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));

View File

@ -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<IForgeRegistry<?>> 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);
}

View File

@ -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 {

View File

@ -22,6 +22,7 @@ public class Main_Forge {
} catch (Exception e) {
e.printStackTrace();
System.err.println("Fail to launch Arclight.");
System.exit(-1);
}
}
}

View File

@ -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()

View File

@ -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();