Update to forge 40.1.0

This commit is contained in:
海波 曾 2022-04-20 03:19:27 +08:00 committed by IzzelAliz
parent c7a17ba31e
commit cb35340211
No known key found for this signature in database
GPG Key ID: EE50E123A11D8338
6 changed files with 27 additions and 13 deletions

View File

@ -6,7 +6,7 @@ A Bukkit server implementation utilizing Mixin.
| Minecraft | Forge | Status | Build | | Minecraft | Forge | Status | Build |
| :----: |:-------:| :---: | :---: | | :----: |:-------:| :---: | :---: |
| 1.18.x | 40.0.12 | ACTIVE | [![1.18 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-18?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) | | 1.18.x | 40.1.0 | ACTIVE | [![1.18 Status](https://img.shields.io/appveyor/build/IzzelAliz/arclight-18?style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) |
| 1.17.x | 37.1.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.17/1.0.2) | [![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.1.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.17/1.0.2) | [![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.26 | 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.2.26 | 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.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) |

View File

@ -1,8 +1,9 @@
package io.izzel.arclight.common.bridge.core.world.chunk; package io.izzel.arclight.common.bridge.core.world.chunk;
import net.minecraft.core.Holder;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
public interface LevelChunkSectionBridge { public interface LevelChunkSectionBridge {
void bridge$setBiome(int x, int y, int z, Biome biome); void bridge$setBiome(int x, int y, int z, Holder<Biome> biome);
} }

View File

@ -6,6 +6,7 @@ import io.izzel.arclight.common.bridge.core.entity.player.ServerPlayerEntityBrid
import io.izzel.arclight.common.bridge.core.util.FoodStatsBridge; import io.izzel.arclight.common.bridge.core.util.FoodStatsBridge;
import net.minecraft.network.protocol.game.ClientboundSetHealthPacket; import net.minecraft.network.protocol.game.ClientboundSetHealthPacket;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.food.FoodData; import net.minecraft.world.food.FoodData;
import net.minecraft.world.food.FoodProperties; import net.minecraft.world.food.FoodProperties;
@ -22,6 +23,8 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import javax.annotation.Nullable;
@Mixin(FoodData.class) @Mixin(FoodData.class)
public abstract class FoodDataMixin implements FoodStatsBridge { public abstract class FoodDataMixin implements FoodStatsBridge {
@ -46,19 +49,22 @@ public abstract class FoodDataMixin implements FoodStatsBridge {
this.entityhuman = playerEntity; this.entityhuman = playerEntity;
} }
@Redirect(method = "eat(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/ItemStack;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/food/FoodData;eat(IF)V")) @Redirect(method = "eat(Lnet/minecraft/world/item/Item;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/LivingEntity;)V", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/world/food/FoodData;eat(IF)V"))
public void arclight$foodLevelChange(FoodData foodStats, int foodLevelIn, float foodSaturationModifier, Item maybeFood, ItemStack stack) { public void arclight$foodLevelChange(FoodData foodStats, int foodLevelIn, float foodSaturationModifier, Item maybeFood, ItemStack stack, @Nullable LivingEntity entity) {
if (entityhuman == null) { var player = this.entityhuman != null ? this.entityhuman : (entity instanceof Player p ? p : null);
if (player == null) {
foodStats.eat(foodLevelIn, foodSaturationModifier); foodStats.eat(foodLevelIn, foodSaturationModifier);
return; return;
} else if (this.entityhuman == null) {
this.entityhuman = player;
} }
FoodProperties food = maybeFood.getFoodProperties(); FoodProperties food = maybeFood.getFoodProperties(stack, entity);
int oldFoodLevel = this.foodLevel; int oldFoodLevel = this.foodLevel;
FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(entityhuman, food.getNutrition() + oldFoodLevel, stack); FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(player, food.getNutrition() + oldFoodLevel, stack);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.eat(event.getFoodLevel() - oldFoodLevel, food.getSaturationModifier()); this.eat(event.getFoodLevel() - oldFoodLevel, food.getSaturationModifier());
} }
((ServerPlayerEntityBridge) entityhuman).bridge$getBukkitEntity().sendHealthUpdate(); ((ServerPlayerEntityBridge) player).bridge$getBukkitEntity().sendHealthUpdate();
} }
@Inject(method = "tick", at = @At(value = "INVOKE_ASSIGN", remap = false, target = "Ljava/lang/Math;max(II)I")) @Inject(method = "tick", at = @At(value = "INVOKE_ASSIGN", remap = false, target = "Ljava/lang/Math;max(II)I"))

View File

@ -6,6 +6,7 @@ import net.minecraft.CrashReport;
import net.minecraft.CrashReportCategory; import net.minecraft.CrashReportCategory;
import net.minecraft.ReportedException; import net.minecraft.ReportedException;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.core.QuartPos; import net.minecraft.core.QuartPos;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -73,7 +74,7 @@ public abstract class ChunkAccessMixin implements BlockGetter, BiomeManager.Nois
return this.persistentDataContainer; return this.persistentDataContainer;
} }
public void setBiome(int i, int j, int k, Biome biome) { public void setBiome(int i, int j, int k, Holder<Biome> biome) {
try { try {
int l = QuartPos.fromBlock(this.getMinBuildHeight()); int l = QuartPos.fromBlock(this.getMinBuildHeight());
int i1 = l + QuartPos.fromBlock(this.getHeight()) - 1; int i1 = l + QuartPos.fromBlock(this.getHeight()) - 1;

View File

@ -1,9 +1,15 @@
package io.izzel.arclight.common.mixin.core.world.level.chunk; package io.izzel.arclight.common.mixin.core.world.level.chunk;
import io.izzel.arclight.common.bridge.core.world.chunk.LevelChunkSectionBridge; import io.izzel.arclight.common.bridge.core.world.chunk.LevelChunkSectionBridge;
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
import net.minecraft.core.Holder;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.PalettedContainer;
import org.bukkit.Bukkit;
import net.minecraft.core.Registry;
import org.bukkit.craftbukkit.v.CraftServer;
import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@ -11,14 +17,14 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(LevelChunkSection.class) @Mixin(LevelChunkSection.class)
public class LevelChunkSectionMixin implements LevelChunkSectionBridge { public class LevelChunkSectionMixin implements LevelChunkSectionBridge {
@Shadow @Final private PalettedContainer<Biome> biomes; @Shadow @Final private PalettedContainer<Holder<Biome>> biomes;
public void setBiome(int i, int j, int k, Biome biome) { public void setBiome(int i, int j, int k, Holder<net.minecraft.world.level.biome.Biome> biome) {
this.biomes.set(i, j, k, biome); this.biomes.set(i, j, k, biome);
} }
@Override @Override
public void bridge$setBiome(int x, int y, int z, Biome biome) { public void bridge$setBiome(int x, int y, int z, Holder<Biome> biome) {
this.setBiome(x, y, z, biome); this.setBiome(x, y, z, biome);
} }
} }

View File

@ -14,7 +14,7 @@ allprojects {
ext { ext {
agpVersion = '1.22' agpVersion = '1.22'
minecraftVersion = '1.18.2' minecraftVersion = '1.18.2'
forgeVersion = '40.0.36' forgeVersion = '40.1.0'
apiVersion = '1.2.6' apiVersion = '1.2.6'
toolsVersion = '1.3.+' toolsVersion = '1.3.+'
mixinVersion = '0.8.5' mixinVersion = '0.8.5'