mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-30 05:05:19 -05:00
Fix LVTs (#167)
* Fix ServerGamePacketListenerImpl Closes #165, closes #166 * Fix MixinGameRenderer by giving it an explicit ordering The Fabric API mixin uses the default priority of 1000, so we use 1100 priority to apply before it. This results in this bytecode structure, where "F" is the Fabric API injections, "A" is the Architectury API injections, and "M" is the Minecraft function being injected pre/post: `FAMAF`. * Fix MixinPhantomSpawner captures * Fix MixinPatrolSpawner captures * Fix MixinChunkSerializer captures
This commit is contained in:
committed by
shedaniel
parent
7604846cd3
commit
2169738b58
@@ -41,7 +41,7 @@ public class MixinChunkSerializer {
|
||||
@Inject(method = "read", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private static void load(ServerLevel serverLevel, StructureManager structureManager, PoiManager poiManager, ChunkPos chunkPos, CompoundTag compoundTag,
|
||||
CallbackInfoReturnable<ProtoChunk> cir, ChunkGenerator chunkGenerator, BiomeSource biomeSource, CompoundTag compoundTagLevelData,
|
||||
ChunkBiomeContainer chunkBiomeContainer, UpgradeData upgradeData, ProtoTickList<?> protoTickList, ProtoTickList<?> protoTickList2,
|
||||
ChunkPos chunkPos2, ChunkBiomeContainer chunkBiomeContainer, UpgradeData upgradeData, ProtoTickList<?> protoTickList, ProtoTickList<?> protoTickList2,
|
||||
boolean bl, ListTag listTag, int i, LevelChunkSection[] levelChunkSections, boolean bl2, ChunkSource chunkSource,
|
||||
LevelLightEngine levelLightEngine, long l, ChunkStatus.ChunkType chunkType, ChunkAccess chunk) {
|
||||
ChunkEvent.LOAD_DATA.invoker().load(chunk, serverLevel, compoundTag);
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.monster.PatrollingMonster;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.PatrolSpawner;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -48,7 +49,7 @@ public abstract class MixinPatrolSpawner {
|
||||
cancellable = true,
|
||||
locals = LocalCapture.CAPTURE_FAILHARD
|
||||
)
|
||||
private void checkPatrolSpawn(ServerLevel level, BlockPos pos, Random r, boolean b, CallbackInfoReturnable<Boolean> cir, PatrollingMonster entity) {
|
||||
private void checkPatrolSpawn(ServerLevel level, BlockPos pos, Random r, boolean b, CallbackInfoReturnable<Boolean> cir, BlockState state, PatrollingMonster entity) {
|
||||
var result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(entity, level, pos.getX(), pos.getY(), pos.getZ(), MobSpawnType.PATROL, null);
|
||||
if (result.value() != null) {
|
||||
cir.setReturnValue(result.value());
|
||||
|
||||
@@ -22,13 +22,15 @@ package dev.architectury.mixin.fabric;
|
||||
import dev.architectury.event.events.common.EntityEvent;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.stats.ServerStatsCounter;
|
||||
import net.minecraft.world.DifficultyInstance;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.entity.SpawnGroupData;
|
||||
import net.minecraft.world.entity.monster.Phantom;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.PhantomSpawner;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@@ -52,9 +54,10 @@ public abstract class MixinPhantomSpawner {
|
||||
cancellable = true,
|
||||
locals = LocalCapture.CAPTURE_FAILSOFT // SOFT, because this will break in 2 seconds
|
||||
)
|
||||
private void checkPhantomSpawn(ServerLevel level, boolean bl, boolean bl2, CallbackInfoReturnable<Integer> cir,
|
||||
Random random, int i, Iterator<ServerPlayer> it, Player player, BlockPos pos, DifficultyInstance diff, BlockPos pos2,
|
||||
SpawnGroupData sgd, int l, int m, Phantom entity) {
|
||||
private void checkPhantomSpawn(ServerLevel level, boolean bl, boolean arg2, CallbackInfoReturnable<Integer> cir,
|
||||
Random random, int i, Iterator var6, Player player, BlockPos blockPos, DifficultyInstance difficultyInstance,
|
||||
ServerStatsCounter serverStatsCounter, int j, int k, BlockPos pos, BlockState blockState,
|
||||
FluidState fluidState, SpawnGroupData spawnGroupData, int l, int m, Phantom entity) {
|
||||
if (EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(entity, level, pos.getX(), pos.getY(), pos.getZ(), MobSpawnType.NATURAL, null).value() == Boolean.FALSE) {
|
||||
cir.setReturnValue(0);
|
||||
cir.cancel();
|
||||
|
||||
@@ -57,7 +57,7 @@ public abstract class MixinServerGamePacketListenerImpl {
|
||||
at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/players/PlayerList;broadcastMessage(Lnet/minecraft/network/chat/Component;Ljava/util/function/Function;Lnet/minecraft/network/chat/ChatType;Ljava/util/UUID;)V"),
|
||||
cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD)
|
||||
private void handleChat(TextFilter.FilteredText message, CallbackInfo ci, String string, Component component, Component component2) {
|
||||
private void handleChat(TextFilter.FilteredText message, CallbackInfo ci, String string, String string2, Component component, Component component2) {
|
||||
var chatComponent = new ChatComponentImpl(component2, component);
|
||||
var process = ChatEvent.SERVER.invoker().process(this.player, message, chatComponent);
|
||||
if (process.isEmpty()) return;
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
@Mixin(value = GameRenderer.class, priority = 1100)
|
||||
public abstract class MixinGameRenderer {
|
||||
@Shadow
|
||||
@Final
|
||||
|
||||
@@ -13,7 +13,7 @@ base_version=2.8
|
||||
maven_group=dev.architectury
|
||||
|
||||
fabric_loader_version=0.12.8
|
||||
fabric_api_version=0.34.9+1.17
|
||||
fabric_api_version=0.45.0+1.17
|
||||
mod_menu_version=2.0.0-beta.7
|
||||
|
||||
forge_version=37.0.69
|
||||
|
||||
Reference in New Issue
Block a user