mirror of
https://github.com/FabricMC/fabric.git
synced 2024-11-22 15:47:57 -05:00
Turn off tests and mixins for currently disabled part
This commit is contained in:
parent
e05dd712ca
commit
27eec61ee2
7 changed files with 18 additions and 58 deletions
|
@ -79,12 +79,12 @@ public abstract class MinecraftServerMixin {
|
|||
/**
|
||||
* When a world is closed, it means the world will be unloaded.
|
||||
*/
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;close()V"), method = "shutdown", locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
/*@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;close()V"), method = "shutdown", locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
private void closeWorld(CallbackInfo ci, Iterator<ServerWorld> worlds, ServerWorld serverWorld) {
|
||||
for (BlockEntity blockEntity : serverWorld.blockEntities) {
|
||||
ServerBlockEntityEvents.BLOCK_ENTITY_UNLOAD.invoker().onUnload(blockEntity, serverWorld);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// The locals you have to manage for an inject are insane. And do it twice. A redirect is much cleaner.
|
||||
// Here is what it looks like with an inject: https://gist.github.com/i509VCB/f80077cc536eb4dba62b794eba5611c1
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
|||
|
||||
@Mixin(ServerWorld.class)
|
||||
public abstract class ServerWorldMixin {
|
||||
@Shadow
|
||||
/*@Shadow
|
||||
private boolean inEntityTick;
|
||||
|
||||
// Call our load event after vanilla has loaded the entity
|
||||
|
@ -42,7 +42,7 @@ public abstract class ServerWorldMixin {
|
|||
if (!this.inEntityTick) { // Copy vanilla logic, we cannot load entities while the game is ticking entities
|
||||
ServerEntityEvents.ENTITY_LOAD.invoker().onLoad(entity, (ServerWorld) (Object) this);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Make sure "insideBlockTick" is true before we call the start tick, so inject after it is set
|
||||
@Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/server/world/ServerWorld;inBlockTick:Z", opcode = Opcodes.PUTFIELD, ordinal = 0, shift = At.Shift.AFTER))
|
||||
|
|
|
@ -16,27 +16,16 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.event.lifecycle;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
|
||||
@Mixin(World.class)
|
||||
|
@ -47,7 +36,7 @@ public abstract class WorldMixin {
|
|||
@Shadow
|
||||
public abstract Profiler getProfiler();
|
||||
|
||||
@Inject(method = "addBlockEntity", at = @At("TAIL"))
|
||||
/*@Inject(method = "addBlockEntity", at = @At("TAIL"))
|
||||
protected void onLoadBlockEntity(BlockEntity blockEntity, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!this.isClient()) { // Only fire this event if we are a server world
|
||||
ServerBlockEntityEvents.BLOCK_ENTITY_LOAD.invoker().onLoad(blockEntity, (ServerWorld) (Object) this);
|
||||
|
@ -79,7 +68,7 @@ public abstract class WorldMixin {
|
|||
|
||||
// Mimic vanilla logic
|
||||
return blockEntityList.removeAll(removals);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Inject(at = @At("RETURN"), method = "tickBlockEntities")
|
||||
protected void tickWorldAfterBlockEntities(CallbackInfo ci) {
|
||||
|
|
|
@ -17,27 +17,16 @@
|
|||
package net.fabricmc.fabric.mixin.event.lifecycle.client;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.network.packet.s2c.play.GameJoinS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerRespawnS2CPacket;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientBlockEntityEvents;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(ClientPlayNetworkHandler.class)
|
||||
public abstract class ClientPlayNetworkHandlerMixin {
|
||||
@Shadow
|
||||
/*@Shadow
|
||||
private ClientWorld world;
|
||||
|
||||
@Inject(method = "onPlayerRespawn", at = @At(value = "NEW", target = "net/minecraft/client/world/ClientWorld"))
|
||||
|
@ -53,7 +42,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
|
|||
// No need to clear the `tickingBlockEntities` list since it will be null in just an instant
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* An explanation why we unload entities during onGameJoin:
|
||||
|
@ -61,7 +50,7 @@ public abstract class ClientPlayNetworkHandlerMixin {
|
|||
* Velocity by default will send a Game Join packet when the player changes servers, which will create a new client world.
|
||||
* Also anyone can send another GameJoinPacket at any time, so we need to watch out.
|
||||
*/
|
||||
@Inject(method = "onGameJoin", at = @At(value = "NEW", target = "net/minecraft/client/world/ClientWorld"))
|
||||
/*@Inject(method = "onGameJoin", at = @At(value = "NEW", target = "net/minecraft/client/world/ClientWorld"))
|
||||
private void onGameJoin(GameJoinS2CPacket packet, CallbackInfo ci) {
|
||||
// If a world already exists, we need to unload all (block)entities in the world.
|
||||
if (this.world != null) {
|
||||
|
@ -90,5 +79,5 @@ public abstract class ClientPlayNetworkHandlerMixin {
|
|||
// No need to clear the `tickingBlockEntities` list since it will be null in just an instant
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -16,33 +16,22 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.event.lifecycle.client;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientBlockEntityEvents;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.mixin.event.lifecycle.WorldMixin;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(ClientWorld.class)
|
||||
public abstract class ClientWorldMixin extends WorldMixin {
|
||||
// Call our load event after vanilla has loaded the entity
|
||||
/*// Call our load event after vanilla has loaded the entity
|
||||
@Inject(method = "addEntityPrivate", at = @At("TAIL"))
|
||||
private void onEntityLoad(int id, Entity entity, CallbackInfo ci) {
|
||||
ClientEntityEvents.ENTITY_LOAD.invoker().onLoad(entity, (ClientWorld) (Object) this);
|
||||
|
@ -52,10 +41,10 @@ public abstract class ClientWorldMixin extends WorldMixin {
|
|||
@Inject(method = "finishRemovingEntity", at = @At("HEAD"))
|
||||
private void onEntityUnload(Entity entity, CallbackInfo ci) {
|
||||
ClientEntityEvents.ENTITY_UNLOAD.invoker().onUnload(entity, (ClientWorld) (Object) this);
|
||||
}
|
||||
}*/
|
||||
|
||||
// We override our injection on the clientworld so only the client's block entity invocations will run
|
||||
@Override
|
||||
/*@Override
|
||||
protected void onLoadBlockEntity(BlockEntity blockEntity, CallbackInfoReturnable<Boolean> cir) {
|
||||
ClientBlockEntityEvents.BLOCK_ENTITY_LOAD.invoker().onLoad(blockEntity, (ClientWorld) (Object) this);
|
||||
}
|
||||
|
@ -78,7 +67,7 @@ public abstract class ClientWorldMixin extends WorldMixin {
|
|||
}
|
||||
|
||||
return super.onPurgeRemovedBlockEntities(blockEntityList, removals); // Call super
|
||||
}
|
||||
}*/
|
||||
|
||||
// We override our injection on the clientworld so only the client world's tick invocations will run
|
||||
@Override
|
||||
|
|
|
@ -19,16 +19,9 @@ package net.fabricmc.fabric.test.event.lifecycle;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
|
||||
public class ServerBlockEntityLifecycleTests implements ModInitializer {
|
||||
private static boolean PRINT_SERVER_BLOCKENTITY_MESSAGES = System.getProperty("fabric-lifecycle-events-testmod.printServerBlockEntityMessages") != null;
|
||||
|
@ -36,7 +29,7 @@ public class ServerBlockEntityLifecycleTests implements ModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
final Logger logger = ServerLifecycleTests.LOGGER;
|
||||
/*final Logger logger = ServerLifecycleTests.LOGGER;
|
||||
|
||||
ServerBlockEntityEvents.BLOCK_ENTITY_LOAD.register((blockEntity, world) -> {
|
||||
this.serverBlockEntities.add(blockEntity);
|
||||
|
@ -89,6 +82,6 @@ public class ServerBlockEntityLifecycleTests implements ModInitializer {
|
|||
if (this.serverBlockEntities.size() != 0) {
|
||||
logger.error("[SERVER] Mismatch in tracked blockentities, expected 0");
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ClientBlockEntityLifecycleTests implements ClientModInitializer {
|
|||
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
final Logger logger = ServerLifecycleTests.LOGGER;
|
||||
/*final Logger logger = ServerLifecycleTests.LOGGER;
|
||||
|
||||
ClientBlockEntityEvents.BLOCK_ENTITY_LOAD.register((blockEntity, world) -> {
|
||||
this.clientBlockEntities.add(blockEntity);
|
||||
|
@ -80,6 +80,6 @@ public class ClientBlockEntityLifecycleTests implements ClientModInitializer {
|
|||
logger.error("[CLIENT] Mismatch in tracked blockentities, expected 0");
|
||||
}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue