top.hendrixshen.magiclib.impl.event.minecraft.render.RenderLevelEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of magiclib-minecraft-api-1.19.3-fabric Show documentation
Show all versions of magiclib-minecraft-api-1.19.3-fabric Show documentation
Unleash magic into Minecraft, infuse souls, ascend to heaven!
package top.hendrixshen.magiclib.impl.event.minecraft.render;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import net.minecraft.class_310;
import net.minecraft.class_4587;
import net.minecraft.class_638;
import org.jetbrains.annotations.NotNull;
import top.hendrixshen.magiclib.api.event.Event;
import top.hendrixshen.magiclib.api.event.minecraft.render.RenderLevelListener;
import top.hendrixshen.magiclib.api.render.context.RenderContext;
import java.util.List;
public class RenderLevelEvent {
public static final class_310 mc = class_310.method_1551();
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public static class LevelRenderContext {
private final class_638 level;
private final RenderContext renderContext;
private final float partialTicks;
public static @NotNull LevelRenderContext of(
class_638 level,
//#if MC > 11502
class_4587 poseStack,
//#endif
float partialTicks
) {
return new LevelRenderContext(level, RenderContext.of(
//#if MC > 11502
poseStack
//#endif
), partialTicks);
}
}
@AllArgsConstructor
public static class PreRender implements Event {
private final LevelRenderContext context;
@Override
public void dispatch(@NotNull List listeners) {
RenderLevelEvent.mc.method_16011().method_15396("Magiclib#PreLevelRenderHook");
for (RenderLevelListener listener : listeners) {
listener.preRenderLevel(this.context.level, this.context.renderContext, this.context.partialTicks);
}
RenderLevelEvent.mc.method_16011().method_15407();
}
@Override
public Class getListenerType() {
return RenderLevelListener.class;
}
}
@AllArgsConstructor
public static class PostRender implements Event {
private final LevelRenderContext context;
@Override
public void dispatch(@NotNull List listeners) {
RenderLevelEvent.mc.method_16011().method_15396("Magiclib#PostLevelRenderHook");
for (RenderLevelListener listener : listeners) {
listener.postRenderLevel(this.context.level, this.context.renderContext, this.context.partialTicks);
}
RenderLevelEvent.mc.method_16011().method_15407();
}
@Override
public Class getListenerType() {
return RenderLevelListener.class;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy