mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 21:13:42 +01:00
Cleanup flywheel event listeners, fix crash on server startup
This commit is contained in:
parent
0bc1a71558
commit
3ce4e2c5e8
6 changed files with 25 additions and 18 deletions
|
@ -25,6 +25,8 @@ import com.simibubi.create.foundation.item.render.CustomItemModels;
|
|||
import com.simibubi.create.foundation.item.render.CustomRenderedItems;
|
||||
import com.simibubi.create.foundation.ponder.content.PonderIndex;
|
||||
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
|
||||
import com.simibubi.create.foundation.render.AllMaterialSpecs;
|
||||
import com.simibubi.create.foundation.render.CreateContexts;
|
||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||
import com.simibubi.create.foundation.utility.ghost.GhostBlocks;
|
||||
import com.simibubi.create.foundation.utility.outliner.Outliner;
|
||||
|
@ -75,6 +77,8 @@ public class CreateClient {
|
|||
modEventBus.addListener(CreateClient::onModelBake);
|
||||
modEventBus.addListener(AllParticleTypes::registerFactories);
|
||||
modEventBus.addListener(ClientEvents::loadCompleted);
|
||||
modEventBus.addListener(CreateContexts::flwInit);
|
||||
modEventBus.addListener(AllMaterialSpecs::flwInit);
|
||||
}
|
||||
|
||||
public static void clientInit(FMLClientSetupEvent event) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
@EventBusSubscriber(Dist.CLIENT)
|
||||
public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTileEntity> {
|
||||
|
||||
public static final Compartment<BlockState> KINETIC_TILE = new Compartment<>();
|
||||
|
|
|
@ -13,6 +13,10 @@ import static org.lwjgl.opengl.GL20.glUseProgram;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
|
@ -63,7 +67,8 @@ import net.minecraftforge.fml.common.Mod;
|
|||
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Mod.EventBusSubscriber(Dist.CLIENT)
|
||||
public class ContraptionRenderDispatcher {
|
||||
private static final Lazy<BlockModelRenderer> MODEL_RENDERER = Lazy.of(() -> new BlockModelRenderer(Minecraft.getInstance().getBlockColors()));
|
||||
private static final Lazy<BlockModelShapes> BLOCK_MODELS = Lazy.of(() -> Minecraft.getInstance().getModelManager().getBlockModelShapes());
|
||||
|
|
|
@ -26,12 +26,15 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.util.math.vector.Vector3i;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Mod.EventBusSubscriber(Dist.CLIENT)
|
||||
public class FluidRenderer {
|
||||
|
||||
// If we draw to BufferBuilder that minecraft provides for RenderType.getTranslucent(), minecraft draws the contents
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.instancing.InstanceData;
|
||||
import com.jozufozu.flywheel.backend.instancing.MaterialSpec;
|
||||
import com.jozufozu.flywheel.core.Formats;
|
||||
import com.jozufozu.flywheel.event.GatherContextEvent;
|
||||
|
@ -12,10 +11,10 @@ import com.simibubi.create.content.contraptions.relays.belt.BeltData;
|
|||
import com.simibubi.create.content.logistics.block.FlapData;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class AllMaterialSpecs {
|
||||
public static void init() {
|
||||
// noop, make sure the static field are loaded.
|
||||
|
@ -26,16 +25,11 @@ public class AllMaterialSpecs {
|
|||
public static final MaterialSpec<ActorData> ACTORS = new MaterialSpec<>(Locations.ACTORS, AllProgramSpecs.ACTOR, Formats.UNLIT_MODEL, AllInstanceFormats.ACTOR, ActorData::new);
|
||||
public static final MaterialSpec<FlapData> FLAPS = new MaterialSpec<>(Locations.FLAPS, AllProgramSpecs.FLAPS, Formats.UNLIT_MODEL, AllInstanceFormats.FLAP, FlapData::new);
|
||||
|
||||
public static <D extends InstanceData> MaterialSpec<D> register(MaterialSpec<D> spec) {
|
||||
return Backend.getInstance().register(spec);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void flwInit(GatherContextEvent event) {
|
||||
register(ROTATING);
|
||||
register(BELTS);
|
||||
register(ACTORS);
|
||||
register(FLAPS);
|
||||
event.getBackend().register(ROTATING);
|
||||
event.getBackend().register(BELTS);
|
||||
event.getBackend().register(ACTORS);
|
||||
event.getBackend().register(FLAPS);
|
||||
}
|
||||
|
||||
public static class Locations {
|
||||
|
|
|
@ -12,10 +12,12 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren
|
|||
import com.simibubi.create.foundation.render.effects.EffectsContext;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class CreateContexts {
|
||||
private static final ResourceLocation CONTRAPTION = new ResourceLocation("create", "context/contraption");
|
||||
|
||||
|
@ -23,7 +25,6 @@ public class CreateContexts {
|
|||
public static WorldContext<ContraptionProgram> CWORLD;
|
||||
public static WorldContext<ContraptionProgram> STRUCTURE;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void flwInit(GatherContextEvent event) {
|
||||
Backend backend = event.getBackend();
|
||||
|
||||
|
|
Loading…
Reference in a new issue