This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
Herobrine-Rewoven/src/main/java/com/thebrokenrail/herobrine/mixin/MixinServerWorld.java

24 lines
842 B
Java

package com.thebrokenrail.herobrine.mixin;
import com.thebrokenrail.herobrine.data.HerobrineData;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
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 java.util.function.BooleanSupplier;
@Mixin(ServerWorld.class)
public class MixinServerWorld {
@Inject(at = @At("HEAD"), method = "tick")
public void tick(BooleanSupplier shouldKeepTicking, CallbackInfo info) {
ServerWorld world = ((ServerWorld) (Object) this);
if (world.getRegistryKey() == World.OVERWORLD) {
HerobrineData data = HerobrineData.get(world);
data.tick(world);
}
}
}