No more material spec, everything is StructType
This commit is contained in:
parent
ef5afd42c3
commit
2efbcdbd6b
16 changed files with 96 additions and 64 deletions
|
@ -19,7 +19,7 @@ parchment_version = 2021.10.31
|
|||
|
||||
# dependency versions
|
||||
registrate_version = MC1.18-1.0.21
|
||||
flywheel_version = 1.18-0.4.0.9
|
||||
flywheel_version = 1.18-0.4.0.11
|
||||
jei_version = 9.0.0.40
|
||||
|
||||
# curseforge information
|
||||
|
|
|
@ -2,14 +2,17 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.api.struct.Batched;
|
||||
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||
import com.jozufozu.flywheel.core.model.Model;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||
|
||||
public class BeltType implements Writeable<BeltData>, Batched<BeltData> {
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class BeltType implements Instanced<BeltData>, Batched<BeltData> {
|
||||
@Override
|
||||
public BeltData create() {
|
||||
return new BeltData();
|
||||
|
@ -25,6 +28,11 @@ public class BeltType implements Writeable<BeltData>, Batched<BeltData> {
|
|||
return new UnsafeBeltWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getProgramSpec() {
|
||||
return AllProgramSpecs.BELT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<BeltData> getTransformer(Model model) {
|
||||
return null;
|
||||
|
|
|
@ -2,14 +2,17 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.api.struct.Batched;
|
||||
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||
import com.jozufozu.flywheel.core.model.Model;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||
|
||||
public class RotatingType implements Writeable<RotatingData>, Batched<RotatingData> {
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class RotatingType implements Instanced<RotatingData>, Batched<RotatingData> {
|
||||
@Override
|
||||
public RotatingData create() {
|
||||
return new RotatingData();
|
||||
|
@ -25,6 +28,11 @@ public class RotatingType implements Writeable<RotatingData>, Batched<RotatingDa
|
|||
return new UnsafeRotatingWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getProgramSpec() {
|
||||
return AllProgramSpecs.ROTATING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<RotatingData> getTransformer(Model model) {
|
||||
return null;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
|||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructType;
|
||||
import com.jozufozu.flywheel.api.struct.StructType;
|
||||
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
|
||||
|
||||
public class UnsafeBeltWriter extends UnsafeBufferWriter<BeltData> {
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.base.flwdata;
|
|||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructType;
|
||||
import com.jozufozu.flywheel.api.struct.StructType;
|
||||
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
|
||||
|
||||
public class UnsafeRotatingWriter extends UnsafeBufferWriter<RotatingData> {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault
|
||||
package com.simibubi.create.content.contraptions.base.flwdata;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
@ -2,14 +2,17 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.api.struct.Batched;
|
||||
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||
import com.jozufozu.flywheel.core.model.Model;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||
|
||||
public class ActorType implements Writeable<ActorData>, Batched<ActorData> {
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class ActorType implements Instanced<ActorData>, Batched<ActorData> {
|
||||
@Override
|
||||
public ActorData create() {
|
||||
return new ActorData();
|
||||
|
@ -25,6 +28,11 @@ public class ActorType implements Writeable<ActorData>, Batched<ActorData> {
|
|||
return new UnsafeActorWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getProgramSpec() {
|
||||
return AllProgramSpecs.ACTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<ActorData> getTransformer(Model model) {
|
||||
return null;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata;
|
|||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructType;
|
||||
import com.jozufozu.flywheel.api.struct.StructType;
|
||||
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
|
||||
|
||||
public class UnsafeActorWriter extends UnsafeBufferWriter<ActorData> {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault
|
||||
package com.simibubi.create.content.contraptions.components.actors.flwdata;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
@ -141,14 +141,9 @@ public class SuperGlueEntity extends Entity
|
|||
double depth = 2 - 1 / 128f;
|
||||
|
||||
switch (axis) {
|
||||
case X:
|
||||
w = depth;
|
||||
break;
|
||||
case Y:
|
||||
h = depth;
|
||||
break;
|
||||
case Z:
|
||||
l = depth;
|
||||
case X -> w = depth;
|
||||
case Y -> h = depth;
|
||||
case Z -> l = depth;
|
||||
}
|
||||
|
||||
w = w / 32.0D;
|
||||
|
@ -423,16 +418,12 @@ public class SuperGlueEntity extends Entity
|
|||
}
|
||||
|
||||
float f = Mth.wrapDegrees(this.getYRot());
|
||||
switch (transformRotation) {
|
||||
case CLOCKWISE_180:
|
||||
return f + 180.0F;
|
||||
case COUNTERCLOCKWISE_90:
|
||||
return f + 90.0F;
|
||||
case CLOCKWISE_90:
|
||||
return f + 270.0F;
|
||||
default:
|
||||
return f;
|
||||
}
|
||||
return switch (transformRotation) {
|
||||
case CLOCKWISE_180 -> f + 180.0F;
|
||||
case COUNTERCLOCKWISE_90 -> f + 90.0F;
|
||||
case CLOCKWISE_90 -> f + 270.0F;
|
||||
default -> f;
|
||||
};
|
||||
}
|
||||
|
||||
public BlockPos getHangingPosition() {
|
||||
|
@ -490,9 +481,4 @@ public class SuperGlueEntity extends Entity
|
|||
public boolean isIgnoringBlockTriggers() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Level getWorld() {
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class ToolboxInventory extends ItemStackHandler {
|
|||
|
||||
@Override
|
||||
protected void onContentsChanged(int slot) {
|
||||
if (!settling && !te.getWorld().isClientSide)
|
||||
if (!settling && !te.getLevel().isClientSide)
|
||||
settle(slot / STACKS_PER_COMPARTMENT);
|
||||
te.sendData();
|
||||
super.onContentsChanged(slot);
|
||||
|
|
|
@ -2,14 +2,17 @@ package com.simibubi.create.content.logistics.block.flap;
|
|||
|
||||
import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat;
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.Batched;
|
||||
import com.jozufozu.flywheel.backend.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.backend.struct.Writeable;
|
||||
import com.jozufozu.flywheel.api.struct.Batched;
|
||||
import com.jozufozu.flywheel.api.struct.BatchingTransformer;
|
||||
import com.jozufozu.flywheel.api.struct.StructWriter;
|
||||
import com.jozufozu.flywheel.api.struct.Instanced;
|
||||
import com.jozufozu.flywheel.core.model.Model;
|
||||
import com.simibubi.create.foundation.render.AllInstanceFormats;
|
||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||
|
||||
public class FlapType implements Writeable<FlapData>, Batched<FlapData> {
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class FlapType implements Instanced<FlapData>, Batched<FlapData> {
|
||||
@Override
|
||||
public FlapData create() {
|
||||
return new FlapData();
|
||||
|
@ -25,6 +28,11 @@ public class FlapType implements Writeable<FlapData>, Batched<FlapData> {
|
|||
return new UnsafeFlapWriter(backing, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getProgramSpec() {
|
||||
return AllProgramSpecs.FLAPS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BatchingTransformer<FlapData> getTransformer(Model model) {
|
||||
return null;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.block.flap;
|
|||
import org.lwjgl.system.MemoryUtil;
|
||||
|
||||
import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer;
|
||||
import com.jozufozu.flywheel.backend.struct.StructType;
|
||||
import com.jozufozu.flywheel.api.struct.StructType;
|
||||
import com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter;
|
||||
|
||||
public class UnsafeFlapWriter extends UnsafeBufferWriter<FlapData> {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault
|
||||
package com.simibubi.create.content.logistics.block.flap;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.foundation.render;
|
||||
|
||||
import com.jozufozu.flywheel.api.MaterialSpec;
|
||||
import com.jozufozu.flywheel.api.struct.StructType;
|
||||
import com.jozufozu.flywheel.event.GatherContextEvent;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.base.flwdata.BeltData;
|
||||
|
@ -22,16 +22,16 @@ public class AllMaterialSpecs {
|
|||
// noop, make sure the static field are loaded.
|
||||
}
|
||||
|
||||
public static final MaterialSpec<RotatingData> ROTATING = new MaterialSpec<>(Locations.ROTATING, AllProgramSpecs.ROTATING, new RotatingType());
|
||||
public static final MaterialSpec<BeltData> BELTS = new MaterialSpec<>(Locations.BELTS, AllProgramSpecs.BELT, new BeltType());
|
||||
public static final MaterialSpec<ActorData> ACTORS = new MaterialSpec<>(Locations.ACTORS, AllProgramSpecs.ACTOR, new ActorType());
|
||||
public static final MaterialSpec<FlapData> FLAPS = new MaterialSpec<>(Locations.FLAPS, AllProgramSpecs.FLAPS, new FlapType());
|
||||
public static final StructType<RotatingData> ROTATING = new RotatingType();
|
||||
public static final StructType<BeltData> BELTS = new BeltType();
|
||||
public static final StructType<ActorData> ACTORS = new ActorType();
|
||||
public static final StructType<FlapData> FLAPS = new FlapType();
|
||||
|
||||
public static void flwInit(GatherContextEvent event) {
|
||||
event.getBackend().register(ROTATING);
|
||||
event.getBackend().register(BELTS);
|
||||
event.getBackend().register(ACTORS);
|
||||
event.getBackend().register(FLAPS);
|
||||
event.getBackend().register(Locations.ROTATING, ROTATING);
|
||||
event.getBackend().register(Locations.BELTS, BELTS);
|
||||
event.getBackend().register(Locations.ACTORS, ACTORS);
|
||||
event.getBackend().register(Locations.FLAPS, FLAPS);
|
||||
}
|
||||
|
||||
public static class Locations {
|
||||
|
|
|
@ -226,8 +226,4 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements IParti
|
|||
public void refreshBlockState() {
|
||||
setBlockState(getLevel().getBlockState(getBlockPos()));
|
||||
}
|
||||
|
||||
public Level getWorld() {
|
||||
return getLevel();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue