mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
Whoops missed some classes
This commit is contained in:
parent
312b327161
commit
d189efd987
2 changed files with 84 additions and 0 deletions
|
@ -0,0 +1,57 @@
|
||||||
|
package com.simibubi.create.foundation.data;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry;
|
||||||
|
import com.jozufozu.flywheel.backend.instancing.entity.IEntityInstanceFactory;
|
||||||
|
import com.jozufozu.flywheel.backend.instancing.tile.ITileInstanceFactory;
|
||||||
|
import com.tterrag.registrate.AbstractRegistrate;
|
||||||
|
import com.tterrag.registrate.builders.BuilderCallback;
|
||||||
|
import com.tterrag.registrate.builders.EntityBuilder;
|
||||||
|
|
||||||
|
import com.tterrag.registrate.util.OneTimeEventReceiver;
|
||||||
|
import com.tterrag.registrate.util.nullness.NonNullSupplier;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityClassification;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
public class CreateEntityBuilder<T extends Entity, P> extends EntityBuilder<T, P> {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private NonNullSupplier<IEntityInstanceFactory<? super T>> instanceFactory;
|
||||||
|
|
||||||
|
public static <T extends Entity, P> EntityBuilder<T, P> create(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, EntityType.IFactory<T> factory, EntityClassification classification) {
|
||||||
|
return (new CreateEntityBuilder<>(owner, parent, name, callback, factory, classification)).defaultLang();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateEntityBuilder(AbstractRegistrate<?> owner, P parent, String name, BuilderCallback callback, EntityType.IFactory<T> factory, EntityClassification classification) {
|
||||||
|
super(owner, parent, name, callback, factory, classification);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreateEntityBuilder<T, P> instance(NonNullSupplier<IEntityInstanceFactory<? super T>> instanceFactory) {
|
||||||
|
if (this.instanceFactory == null) {
|
||||||
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> this::registerInstance);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.instanceFactory = instanceFactory;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void registerInstance() {
|
||||||
|
OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, $ -> {
|
||||||
|
NonNullSupplier<IEntityInstanceFactory<? super T>> instanceFactory = this.instanceFactory;
|
||||||
|
if (instanceFactory != null) {
|
||||||
|
InstancedRenderRegistry.getInstance().register(getEntry(), instanceFactory.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.simibubi.create.foundation.render;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.core.shader.spec.IBooleanStateProvider;
|
||||||
|
import com.simibubi.create.Create;
|
||||||
|
import com.simibubi.create.content.contraptions.KineticDebugger;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class RainbowDebugStateProvider implements IBooleanStateProvider {
|
||||||
|
|
||||||
|
public static final RainbowDebugStateProvider INSTANCE = new RainbowDebugStateProvider();
|
||||||
|
public static final ResourceLocation NAME = new ResourceLocation(Create.ID, "rainbow_debug");
|
||||||
|
|
||||||
|
protected RainbowDebugStateProvider() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTrue() {
|
||||||
|
return KineticDebugger.isActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getID() {
|
||||||
|
return NAME;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue