Merge branch 'mc1.18/global-railways' of https://github.com/Creators-of-Create/Create-Concealed into mc1.18/global-railways

This commit is contained in:
simibubi 2022-04-08 01:41:23 +02:00
commit bb0f15269f
17 changed files with 403 additions and 58 deletions

View file

@ -19,7 +19,7 @@ parchment_version = 2022.03.13
# dependency versions
registrate_version = MC1.18.2-1.0.24
flywheel_version = 1.18-0.6.2.64
flywheel_version = 1.18-0.6.2.65
jei_minecraft_version = 1.18.2
jei_version = 9.5.3.143

View file

@ -16,8 +16,10 @@ import com.simibubi.create.content.curiosities.weapons.PotatoProjectileEntity;
import com.simibubi.create.content.curiosities.weapons.PotatoProjectileRenderer;
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntity;
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionEntityRenderer;
import com.simibubi.create.content.logistics.trains.entity.CarriageContraptionInstance;
import com.simibubi.create.foundation.data.CreateEntityBuilder;
import com.simibubi.create.foundation.utility.Lang;
import com.tterrag.registrate.builders.EntityBuilder;
import com.tterrag.registrate.util.entry.EntityEntry;
import com.tterrag.registrate.util.nullness.NonNullConsumer;
import com.tterrag.registrate.util.nullness.NonNullFunction;
@ -33,15 +35,20 @@ import net.minecraft.world.entity.MobCategory;
public class AllEntityTypes {
public static final EntityEntry<OrientedContraptionEntity> ORIENTED_CONTRAPTION = contraption("contraption",
OrientedContraptionEntity::new, () -> OrientedContraptionEntityRenderer::new, 5, 3, true);
OrientedContraptionEntity::new, () -> OrientedContraptionEntityRenderer::new, 5, 3, true)
.register();
public static final EntityEntry<ControlledContraptionEntity> CONTROLLED_CONTRAPTION =
contraption("stationary_contraption", ControlledContraptionEntity::new, () -> ContraptionEntityRenderer::new,
20, 40, false);
20, 40, false)
.register();
public static final EntityEntry<GantryContraptionEntity> GANTRY_CONTRAPTION = contraption("gantry_contraption",
GantryContraptionEntity::new, () -> ContraptionEntityRenderer::new, 10, 40, false);
GantryContraptionEntity::new, () -> ContraptionEntityRenderer::new, 10, 40, false)
.register();
public static final EntityEntry<CarriageContraptionEntity> CARRIAGE_CONTRAPTION =
contraption("carriage_contraption", CarriageContraptionEntity::new,
() -> CarriageContraptionEntityRenderer::new, 15, 3, true);
() -> CarriageContraptionEntityRenderer::new, 15, 3, true)
.instance(() -> CarriageContraptionInstance::new)
.register();
public static final EntityEntry<SuperGlueEntity> SUPER_GLUE =
register("super_glue", SuperGlueEntity::new, () -> SuperGlueRenderer::new, MobCategory.MISC, 10,
@ -61,11 +68,11 @@ public class AllEntityTypes {
//
private static <T extends Entity> EntityEntry<T> contraption(String name, EntityFactory<T> factory,
private static <T extends Entity> CreateEntityBuilder<T, ?> contraption(String name, EntityFactory<T> factory,
NonNullSupplier<NonNullFunction<EntityRendererProvider.Context, EntityRenderer<? super T>>> renderer, int range,
int updateFrequency, boolean sendVelocity) {
return register(name, factory, renderer, MobCategory.MISC, range, updateFrequency, sendVelocity, true,
AbstractContraptionEntity::build).register();
AbstractContraptionEntity::build);
}
private static <T extends Entity> CreateEntityBuilder<T, ?> register(String name, EntityFactory<T> factory,

View file

@ -24,7 +24,7 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
lightUpdater = LightUpdater.get(contraption.entity.level);
bounds = getContraptionBounds();
growBoundsForEdgeData();
growBoundsForEdgeData(bounds);
lightVolume = new GPULightVolume(bounds);
@ -51,7 +51,7 @@ public abstract class ContraptionLighter<C extends Contraption> implements Light
lightVolume.onLightPacket(world, chunkX, chunkZ);
}
protected void growBoundsForEdgeData() {
protected static void growBoundsForEdgeData(GridAlignedBB bounds) {
// so we have at least enough data on the edges to avoid artifacts and have smooth lighting
bounds.grow(2);
}

View file

@ -18,11 +18,11 @@ public class NonStationaryLighter<C extends Contraption> extends ContraptionLigh
ImmutableBox contraptionBounds = getContraptionBounds();
if (bounds.sameAs(contraptionBounds)) {
if (bounds.sameAs(contraptionBounds, 2)) {
return false;
}
bounds.assign(contraptionBounds);
growBoundsForEdgeData();
growBoundsForEdgeData(bounds);
lightVolume.move(provider, bounds);

View file

@ -16,7 +16,7 @@ public class ContraptionGroup<P extends ContraptionProgram> extends InstancedMat
}
@Override
public void setup(P program) {
protected void setup(P program) {
contraption.setup(program);
}

View file

@ -182,7 +182,7 @@ public class FlwContraption extends ContraptionRenderInfo {
private final ContraptionInstanceManager tileInstanceManager;
public ContraptionInstanceWorld(FlwContraption parent) {
switch (Backend.getEngine()) {
switch (Backend.getBackendType()) {
case INSTANCING -> {
InstancingEngine<ContraptionProgram> engine = InstancingEngine.builder(CreateContexts.CWORLD)
.setGroupFactory(ContraptionGroup.forContraption(parent))

View file

@ -7,7 +7,7 @@ import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.backend.RenderLayer;
import com.jozufozu.flywheel.backend.gl.GlStateTracker;
import com.jozufozu.flywheel.backend.gl.GlTextureUnit;
import com.jozufozu.flywheel.config.FlwEngine;
import com.jozufozu.flywheel.config.BackendType;
import com.jozufozu.flywheel.core.Formats;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.compile.ProgramContext;
@ -43,7 +43,7 @@ public class FlwContraptionManager extends ContraptionRenderingWorld<FlwContrapt
GlStateTracker.State restoreState = GlStateTracker.getRestoreState();
GlTextureUnit active = GlTextureUnit.getActive();
if (Backend.getEngine() != FlwEngine.BATCHING) {
if (Backend.getBackendType() != BackendType.BATCHING) {
renderStructures(event);
}

View file

@ -6,8 +6,11 @@ import java.util.List;
import javax.annotation.Nullable;
import com.jozufozu.flywheel.api.MaterialManager;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.content.logistics.trains.entity.BogeyInstance;
import com.simibubi.create.content.logistics.trains.entity.CarriageBogey;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.BlockPos;
@ -43,6 +46,9 @@ public interface IBogeyBlock extends IWrenchable {
public void render(@Nullable BlockState state, float wheelAngle, PoseStack ms, float partialTicks,
MultiBufferSource buffers, int light, int overlay);
@OnlyIn(Dist.CLIENT)
public BogeyInstance createInstance(MaterialManager materialManager, CarriageBogey bogey);
public default Direction getBogeyUpDirection() {
return Direction.UP;
}

View file

@ -0,0 +1,201 @@
package com.simibubi.create.content.logistics.trains.entity;
import com.jozufozu.flywheel.api.Material;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.core.Materials;
import com.jozufozu.flywheel.core.materials.model.ModelData;
import com.jozufozu.flywheel.util.AnimationTickHolder;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.phys.Vec3;
public sealed class BogeyInstance {
public final CarriageBogey bogey;
private final ModelData[] shafts;
protected BogeyInstance(CarriageBogey bogey, MaterialManager materialManager) {
this.bogey = bogey;
shafts = new ModelData[2];
materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(AllBlocks.SHAFT.getDefaultState()
.setValue(ShaftBlock.AXIS, Direction.Axis.Z))
.createInstances(shafts);
}
public void remove() {
for (ModelData shaft : shafts)
shaft.delete();
}
public void beginFrame(float wheelAngle, PoseStack ms) {
for (int i : Iterate.zeroAndOne)
shafts[i].setTransform(ms)
.translate(-.5f, .25f, i * -1)
.centre()
.rotateZ(wheelAngle)
.unCentre();
}
public void updateLight(BlockAndTintGetter world, CarriageContraptionEntity entity) {
var lightPos = new BlockPos(getLightPos(entity));
updateLight(world.getBrightness(LightLayer.BLOCK, lightPos), world.getBrightness(LightLayer.SKY, lightPos));
}
private Vec3 getLightPos(CarriageContraptionEntity entity) {
if (bogey.getAnchorPosition() != null) {
return bogey.getAnchorPosition();
} else {
return entity.getLightProbePosition(AnimationTickHolder.getPartialTicks());
}
}
public void updateLight(int blockLight, int skyLight) {
for (ModelData shaft : shafts) {
shaft.setBlockLight(blockLight).setSkyLight(skyLight);
}
}
public static final class Frame extends BogeyInstance {
private final ModelData frame;
private final ModelData[] wheels;
public Frame(CarriageBogey bogey, MaterialManager materialManager) {
super(bogey, materialManager);
frame = materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(AllBlockPartials.BOGEY_FRAME)
.createInstance();
wheels = new ModelData[2];
materialManager.defaultSolid()
.material(Materials.TRANSFORMED)
.getModel(AllBlockPartials.SMALL_BOGEY_WHEELS)
.createInstances(wheels);
}
@Override
public void beginFrame(float wheelAngle, PoseStack ms) {
super.beginFrame(wheelAngle, ms);
frame.setTransform(ms);
for (int side : Iterate.positiveAndNegative) {
wheels[(side + 1) / 2].setTransform(ms)
.translate(0, 12 / 16f, side)
.rotateX(wheelAngle);
}
}
@Override
public void updateLight(int blockLight, int skyLight) {
super.updateLight(blockLight, skyLight);
frame.setBlockLight(blockLight).setSkyLight(skyLight);
for (ModelData wheel : wheels)
wheel.setBlockLight(blockLight).setSkyLight(skyLight);
}
@Override
public void remove() {
super.remove();
frame.delete();
for (ModelData wheel : wheels)
wheel.delete();
}
}
public static final class Drive extends BogeyInstance {
private final ModelData[] secondShaft;
private final ModelData drive;
private final ModelData piston;
private final ModelData wheels;
private final ModelData pin;
public Drive(CarriageBogey bogey, MaterialManager materialManager) {
super(bogey, materialManager);
Material<ModelData> mat = materialManager.defaultSolid()
.material(Materials.TRANSFORMED);
secondShaft = new ModelData[2];
mat.getModel(AllBlocks.SHAFT.getDefaultState()
.setValue(ShaftBlock.AXIS, Direction.Axis.X))
.createInstances(secondShaft);
drive = mat.getModel(AllBlockPartials.BOGEY_DRIVE)
.createInstance();
piston = mat.getModel(AllBlockPartials.BOGEY_PISTON)
.createInstance();
wheels = mat.getModel(AllBlockPartials.LARGE_BOGEY_WHEELS)
.createInstance();
pin = mat.getModel(AllBlockPartials.BOGEY_PIN)
.createInstance();
}
@Override
public void beginFrame(float wheelAngle, PoseStack ms) {
super.beginFrame(wheelAngle, ms);
for (int i : Iterate.zeroAndOne)
secondShaft[i].setTransform(ms)
.translate(-.5f, .25f, .5f + i * -2)
.centre()
.rotateX(wheelAngle)
.unCentre();
drive.setTransform(ms);
piston.setTransform(ms)
.translate(0, 0, 1 / 4f * Math.sin(AngleHelper.rad(wheelAngle)));
wheels.setTransform(ms)
.translate(0, 1, 0)
.rotateX(wheelAngle);
pin.setTransform(ms)
.translate(0, 1, 0)
.rotateX(wheelAngle)
.translate(0, 1 / 4f, 0)
.rotateX(-wheelAngle);
}
@Override
public void updateLight(int blockLight, int skyLight) {
super.updateLight(blockLight, skyLight);
for (ModelData shaft : secondShaft)
shaft.setBlockLight(blockLight).setSkyLight(skyLight);
drive.setBlockLight(blockLight).setSkyLight(skyLight);
piston.setBlockLight(blockLight).setSkyLight(skyLight);
wheels.setBlockLight(blockLight).setSkyLight(skyLight);
pin.setBlockLight(blockLight).setSkyLight(skyLight);
}
@Override
public void remove() {
super.remove();
for (ModelData shaft : secondShaft)
shaft.delete();
drive.delete();
piston.delete();
wheels.delete();
pin.delete();
}
}
}

View file

@ -63,6 +63,7 @@ public class Carriage {
updateContraptionAnchors();
bogey1.setLeading();
bogey1.carriage = this;
if (bogey2 != null)
bogey2.carriage = this;

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.logistics.trains.entity;
import javax.annotation.Nullable;
import com.jozufozu.flywheel.api.MaterialManager;
import com.simibubi.create.Create;
import com.simibubi.create.content.logistics.trains.IBogeyBlock;
import com.simibubi.create.content.logistics.trains.TrackGraph;
@ -24,6 +25,8 @@ public class CarriageBogey {
public Carriage carriage;
boolean isLeading;
IBogeyBlock type;
Couple<TravellingPoint> points;
@ -133,4 +136,11 @@ public class CarriageBogey {
return carriageBogey;
}
}
public BogeyInstance createInstance(MaterialManager materialManager) {
return type.createInstance(materialManager, this);
}
void setLeading() {
isLeading = true;
}
}

View file

@ -1,12 +1,18 @@
package com.simibubi.create.content.logistics.trains.entity;
import java.util.Objects;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntityRenderer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.culling.Frustum;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.phys.Vec3;
public class CarriageContraptionEntityRenderer extends ContraptionEntityRenderer<CarriageContraptionEntity> {
@ -39,37 +45,50 @@ public class CarriageContraptionEntityRenderer extends ContraptionEntityRenderer
Vec3 position = entity.getPosition(partialTicks);
ms.pushPose();
carriage.bogeys.forEachWithContext((bogey, first) -> {
if (!first && !carriage.isOnTwoBogeys())
float viewYRot = entity.getViewYRot(partialTicks);
float viewXRot = entity.getViewXRot(partialTicks);
int bogeySpacing = carriage.bogeySpacing;
carriage.bogeys.forEach(bogey -> {
if (bogey == null)
return;
ms.pushPose();
float viewYRot = entity.getViewYRot(partialTicks);
float viewXRot = entity.getViewXRot(partialTicks);
int bogeySpacing = carriage.bogeySpacing;
TransformStack.cast(ms)
if (!Backend.isOn()) {
ms.pushPose();
translateBogey(ms, bogey, bogeySpacing, viewYRot, viewXRot, partialTicks);
int light = getBogeyLightCoords(entity, bogey, partialTicks);
bogey.type.render(null, bogey.wheelAngle.getValue(partialTicks), ms, partialTicks, buffers, light, overlay);
ms.popPose();
}
bogey.updateCouplingAnchor(position, viewXRot, viewYRot, bogeySpacing, partialTicks, bogey.isLeading);
if (!carriage.isOnTwoBogeys())
bogey.updateCouplingAnchor(position, viewXRot, viewYRot, bogeySpacing, partialTicks, !bogey.isLeading);
});
}
public static void translateBogey(PoseStack ms, CarriageBogey bogey, int bogeySpacing, float viewYRot, float viewXRot, float partialTicks) {
TransformStack.cast(ms)
.rotateY(viewYRot + 90)
.rotateX(-viewXRot)
.rotateY(180)
.translate(0, 0, first ? 0 : -bogeySpacing)
.translate(0, 0, bogey.isLeading ? 0 : -bogeySpacing)
.rotateY(-180)
.rotateX(viewXRot)
.rotateY(-viewYRot - 90)
.rotateY(bogey.yaw.getValue(partialTicks))
.rotateX(bogey.pitch.getValue(partialTicks))
.translate(0, .5f, 0);
}
bogey.type.render(null, bogey.wheelAngle.getValue(partialTicks), ms, partialTicks, buffers,
getPackedLightCoords(entity, partialTicks), overlay);
bogey.updateCouplingAnchor(position, viewXRot, viewYRot, bogeySpacing, partialTicks, first);
if (!carriage.isOnTwoBogeys())
bogey.updateCouplingAnchor(position, viewXRot, viewYRot, bogeySpacing, partialTicks, !first);
public static int getBogeyLightCoords(CarriageContraptionEntity entity, CarriageBogey bogey, float partialTicks) {
ms.popPose();
});
ms.popPose();
var lightPos = new BlockPos(Objects.requireNonNullElseGet(bogey.getAnchorPosition(), () -> entity.getLightProbePosition(partialTicks)));
return LightTexture.pack(entity.level.getBrightness(LightLayer.BLOCK, lightPos), entity.level.getBrightness(LightLayer.SKY, lightPos));
}
}

View file

@ -0,0 +1,82 @@
package com.simibubi.create.content.logistics.trains.entity;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.DynamicInstance;
import com.jozufozu.flywheel.backend.instancing.entity.EntityInstance;
import com.jozufozu.flywheel.util.AnimationTickHolder;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.utility.Couple;
public class CarriageContraptionInstance extends EntityInstance<CarriageContraptionEntity> implements DynamicInstance {
private final PoseStack ms = new PoseStack();
private Carriage carriage;
private Couple<BogeyInstance> bogeys;
public CarriageContraptionInstance(MaterialManager materialManager, CarriageContraptionEntity entity) {
super(materialManager, entity);
}
@Override
public void init() {
carriage = entity.getCarriage();
if (carriage == null) return;
bogeys = carriage.bogeys.mapNotNullWithParam(CarriageBogey::createInstance, materialManager);
updateLight();
}
@Override
public void beginFrame() {
if (bogeys == null) {
init();
return;
}
float partialTicks = AnimationTickHolder.getPartialTicks();
float viewYRot = entity.getViewYRot(partialTicks);
float viewXRot = entity.getViewXRot(partialTicks);
int bogeySpacing = carriage.bogeySpacing;
ms.pushPose();
TransformStack.cast(ms)
.translate(getInstancePosition(partialTicks))
.translate(0, -1.5 - 1 / 128f, 0);;
for (BogeyInstance instance : bogeys) {
if (instance != null) {
ms.pushPose();
CarriageBogey bogey = instance.bogey;
CarriageContraptionEntityRenderer.translateBogey(ms, bogey, bogeySpacing, viewYRot, viewXRot, partialTicks);
instance.beginFrame(bogey.wheelAngle.getValue(partialTicks), ms);
ms.popPose();
}
}
ms.popPose();
}
@Override
public void updateLight() {
if (bogeys == null) return;
bogeys.forEach(instance -> {
if (instance != null)
instance.updateLight(world, entity);
});
}
@Override
public void remove() {
bogeys.forEach(BogeyInstance::remove);
}
}

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.logistics.trains.track;
import java.util.EnumSet;
import com.jozufozu.flywheel.api.MaterialManager;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
@ -10,6 +11,8 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock;
import com.simibubi.create.content.logistics.trains.IBogeyBlock;
import com.simibubi.create.content.logistics.trains.entity.BogeyInstance;
import com.simibubi.create.content.logistics.trains.entity.CarriageBogey;
import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.render.CachedBufferer;
import com.simibubi.create.foundation.utility.AngleHelper;
@ -36,7 +39,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public class StandardBogeyBlock extends Block implements IBogeyBlock, ITE<StandardBogeyTileEntity> {
public static final EnumProperty<Axis> AXIS = BlockStateProperties.HORIZONTAL_AXIS;
private boolean large;
private final boolean large;
public StandardBogeyBlock(Properties p_i48440_1_, boolean large) {
super(p_i48440_1_);
@ -114,23 +117,30 @@ public class StandardBogeyBlock extends Block implements IBogeyBlock, ITE<Standa
.light(light)
.renderInto(ms, vb);
if (!large) {
CachedBufferer.partial(AllBlockPartials.BOGEY_FRAME, air)
if (large) {
renderLargeBogey(wheelAngle, ms, light, vb, air);
} else {
renderBogey(wheelAngle, ms, light, vb, air);
}
}
private void renderBogey(float wheelAngle, PoseStack ms, int light, VertexConsumer vb, BlockState air) {
CachedBufferer.partial(AllBlockPartials.BOGEY_FRAME, air)
.light(light)
.renderInto(ms, vb);
for (int side : Iterate.positiveAndNegative) {
ms.pushPose();
CachedBufferer.partial(AllBlockPartials.SMALL_BOGEY_WHEELS, air)
.translate(0, 12 / 16f, side)
.rotateX(wheelAngle)
.light(light)
.renderInto(ms, vb);
for (int side : Iterate.positiveAndNegative) {
ms.pushPose();
CachedBufferer.partial(AllBlockPartials.SMALL_BOGEY_WHEELS, air)
.translate(0, 12 / 16f, side)
.rotateX(wheelAngle)
.light(light)
.renderInto(ms, vb);
ms.popPose();
}
return;
ms.popPose();
}
}
private void renderLargeBogey(float wheelAngle, PoseStack ms, int light, VertexConsumer vb, BlockState air) {
for (int i : Iterate.zeroAndOne)
CachedBufferer.block(AllBlocks.SHAFT.getDefaultState()
.setValue(ShaftBlock.AXIS, Axis.X))
@ -163,18 +173,23 @@ public class StandardBogeyBlock extends Block implements IBogeyBlock, ITE<Standa
.light(light)
.renderInto(ms, vb);
ms.popPose();
}
@Override
public BogeyInstance createInstance(MaterialManager materialManager, CarriageBogey bogey) {
if (large) {
return new BogeyInstance.Drive(bogey, materialManager);
} else {
return new BogeyInstance.Frame(bogey, materialManager);
}
}
@Override
public BlockState rotate(BlockState pState, Rotation pRotation) {
switch (pRotation) {
case COUNTERCLOCKWISE_90:
case CLOCKWISE_90:
return pState.cycle(AXIS);
default:
return pState;
}
return switch (pRotation) {
case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> pState.cycle(AXIS);
default -> pState;
};
}
@Override

View file

@ -212,7 +212,6 @@ public class ClientEvents {
CreateClient.GHOST_BLOCKS.renderAll(ms, buffer);
CreateClient.OUTLINER.renderOutlines(ms, buffer, pt);
// LightVolumeDebugger.render(ms, buffer);
buffer.draw();
RenderSystem.enableCull();

View file

@ -42,7 +42,7 @@ public class CreateEntityBuilder<T extends Entity, P> extends EntityBuilder<T, P
}
public CreateEntityBuilder<T, P> instance(NonNullSupplier<BiFunction<MaterialManager, T, EntityInstance<? super T>>> instanceFactory, boolean renderNormally) {
return instance(instanceFactory, be -> true);
return instance(instanceFactory, be -> renderNormally);
}
public CreateEntityBuilder<T, P> instance(NonNullSupplier<BiFunction<MaterialManager, T, EntityInstance<? super T>>> instanceFactory, NonNullPredicate<T> renderNormally) {

View file

@ -63,10 +63,15 @@ public class Couple<T> extends Pair<T, T> implements Iterable<T> {
return Couple.create(function.apply(first, values.first), function.apply(second, values.second));
}
public <S, R> Couple<S> mapNotNullWithParam(BiFunction<T, R, S> function, R value) {
return Couple.create(first != null ? function.apply(first, value) : null,
second != null ? function.apply(second, value) : null);
}
public boolean both(Predicate<T> test) {
return test.test(getFirst()) && test.test(getSecond());
}
public boolean either(Predicate<T> test) {
return test.test(getFirst()) || test.test(getSecond());
}
@ -125,7 +130,7 @@ public class Couple<T> extends Pair<T, T> implements Iterable<T> {
private static class Couplerator<T> implements Iterator<T> {
int state;
private Couple<T> couple;
private final Couple<T> couple;
public Couplerator(Couple<T> couple) {
this.couple = couple;