diff --git a/build.gradle b/build.gradle index 346e74d..9631048 100644 --- a/build.gradle +++ b/build.gradle @@ -88,6 +88,7 @@ mixin { */ repositories { mavenLocal() + maven { url = "https://maven.createmod.net" } maven { // location of the maven that hosts JEI files before January 2023 name = "Progwml6's maven" @@ -125,8 +126,11 @@ dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation fg.deobf("com.simibubi.create:create-${minecraft_version}:${create_version}:slim") { transitive = false } - implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${minecraft_version}:${flywheel_version}") + implementation(fg.deobf("net.createmod.ponder:Ponder-Forge-${minecraft_version}:${ponder_version}")) + compileOnly(fg.deobf("dev.engine-room.flywheel:flywheel-forge-api-${minecraft_version}:${flywheel_version}")) + runtimeOnly(fg.deobf("dev.engine-room.flywheel:flywheel-forge-${minecraft_version}:${flywheel_version}")) implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}") + implementation("io.github.llamalad7:mixinextras-forge:0.4.1") // compile against the JEI API but do not include it at runtime compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")) diff --git a/gradle.properties b/gradle.properties index 653f5f0..4840365 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ org.gradle.daemon=false # mod version info mod_version = 3.0.2 minecraft_version = 1.20.1 -forge_version = 47.1.43 +forge_version = 47.4.0 # build dependency versions forgegradle_version = 6.0.6 @@ -17,10 +17,11 @@ cursegradle_version = 1.4.0 parchment_version = 2023.06.26 # mod dependency versions -create_version = 0.5.1.f-26 -flywheel_version = 0.6.10-7 +create_version = 6.0.4-79 +ponder_version = 1.0.36 +flywheel_version = 1.0.1 registrate_version = MC1.20-1.3.3 -jei_version = 15.2.0.22 +jei_version = 15.19.5.99 # curseforge information projectId = 534610 diff --git a/src/main/java/com/teammoeg/steampowered/SPStress.java b/src/main/java/com/teammoeg/steampowered/SPStress.java index 7e8728e..638ac04 100644 --- a/src/main/java/com/teammoeg/steampowered/SPStress.java +++ b/src/main/java/com/teammoeg/steampowered/SPStress.java @@ -1,73 +1,46 @@ package com.teammoeg.steampowered; -import com.simibubi.create.content.kinetics.BlockStressDefaults; -import com.simibubi.create.content.kinetics.BlockStressValues; -import com.simibubi.create.foundation.utility.Couple; -import com.simibubi.create.foundation.utility.RegisteredObjects; +import com.simibubi.create.api.stress.BlockStressValues; import com.teammoeg.steampowered.content.alternator.DynamoBlock; -import com.teammoeg.steampowered.oldcreatestuff.OldEngineBlock; -import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlock; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraftforge.registries.ForgeRegistries; -import org.jetbrains.annotations.Nullable; -import java.util.function.Supplier; +import java.util.function.DoubleSupplier; -public class SPStress implements BlockStressValues.IStressValueProvider { +public class SPStress { - @Override - public double getCapacity(Block arg0) { + public DoubleSupplier getCapacity(Block arg0) { ResourceLocation registryName = ForgeRegistries.BLOCKS.getKey(arg0); - if(!(arg0 instanceof OldEngineBlock))return BlockStressDefaults.DEFAULT_CAPACITIES.getOrDefault(registryName,0D); String mat=registryName.getPath().split("_")[0]; switch(mat) { - case "bronze":return SPConfig.COMMON.bronzeFlywheelCapacity.get(); - case "cast":return SPConfig.COMMON.castIronFlywheelCapacity.get(); - case "steel":return SPConfig.COMMON.steelFlywheelCapacity.get(); + case "bronze":return SPConfig.COMMON.bronzeFlywheelCapacity::get; + case "cast":return SPConfig.COMMON.castIronFlywheelCapacity::get; + case "steel":return SPConfig.COMMON.steelFlywheelCapacity::get; } - return BlockStressDefaults.DEFAULT_CAPACITIES.getOrDefault(registryName,0D); + return null; } - @Override - public double getImpact(Block arg0) { + public DoubleSupplier getImpact(Block arg0) { ResourceLocation registryName = ForgeRegistries.BLOCKS.getKey(arg0); - if(arg0 instanceof OldFlywheelBlock)return BlockStressDefaults.DEFAULT_IMPACTS.getOrDefault(registryName,0D); if(arg0 instanceof DynamoBlock) { - return SPConfig.COMMON.dynamoImpact.get(); + return SPConfig.COMMON.dynamoImpact::get; } String[] mat=registryName.getPath().split("_"); if(mat[mat.length-1].equals("cogwheel")) { switch(mat[0]) { - case "bronze":return SPConfig.COMMON.bronzeCogwheelImpact.get(); - case "cast":return SPConfig.COMMON.castIronCogwheelImpact.get(); - case "steel":return SPConfig.COMMON.steelCogwheelImpact.get(); + case "bronze":return SPConfig.COMMON.bronzeCogwheelImpact::get; + case "cast":return SPConfig.COMMON.castIronCogwheelImpact::get; + case "steel":return SPConfig.COMMON.steelCogwheelImpact::get; } } - return BlockStressDefaults.DEFAULT_IMPACTS.getOrDefault(registryName,0D); + return null; } - @Override - public boolean hasCapacity(Block arg0) { - if((arg0 instanceof OldEngineBlock))return true; - return false; - } - - @Override - public Couple getGeneratedRPM(Block block) { - //block = redirectValues(block); - ResourceLocation key = RegisteredObjects.getKeyOrThrow(block); - Supplier> supplier = BlockStressDefaults.GENERATOR_SPEEDS.get(key); - if (supplier == null) - return null; - return supplier.get(); - } - - @Override - public boolean hasImpact(Block arg0) { - if(arg0 instanceof OldEngineBlock)return false; - return true; - } + public void initStress() { + BlockStressValues.IMPACTS.registerProvider(this::getImpact); + BlockStressValues.CAPACITIES.registerProvider(this::getCapacity); + } } diff --git a/src/main/java/com/teammoeg/steampowered/SteamPowered.java b/src/main/java/com/teammoeg/steampowered/SteamPowered.java index 613c4d5..59cf80b 100644 --- a/src/main/java/com/teammoeg/steampowered/SteamPowered.java +++ b/src/main/java/com/teammoeg/steampowered/SteamPowered.java @@ -18,7 +18,6 @@ package com.teammoeg.steampowered; -import com.simibubi.create.content.kinetics.BlockStressValues; import com.simibubi.create.foundation.data.CreateRegistrate; import com.teammoeg.steampowered.client.Particles; import com.teammoeg.steampowered.client.SteamPoweredClient; @@ -71,7 +70,7 @@ public SteamPowered() { SPBlockEntities.register(); SPItems.register(); SPTags.init(); - BlockStressValues.registerProvider(MODID, new SPStress()); + new SPStress().initStress(); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, SPConfig.COMMON_CONFIG); ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SPConfig.SERVER_CONFIG); PacketHandler.register(); diff --git a/src/main/java/com/teammoeg/steampowered/block/SPBlockPartials.java b/src/main/java/com/teammoeg/steampowered/block/SPBlockPartials.java index 0845799..affd72d 100644 --- a/src/main/java/com/teammoeg/steampowered/block/SPBlockPartials.java +++ b/src/main/java/com/teammoeg/steampowered/block/SPBlockPartials.java @@ -18,8 +18,7 @@ package com.teammoeg.steampowered.block; -import com.jozufozu.flywheel.core.PartialModel; - +import dev.engine_room.flywheel.lib.model.baked.PartialModel; import net.minecraft.resources.ResourceLocation; public class SPBlockPartials { @@ -44,7 +43,7 @@ public class SPBlockPartials { public static final PartialModel DYNAMO_SHAFT = get("dynamo/shaft"); private static PartialModel get(String path) { - return new PartialModel(new ResourceLocation("steampowered", "block/" + path)); + return PartialModel.of(new ResourceLocation("steampowered", "block/" + path)); } public static void clientInit() { diff --git a/src/main/java/com/teammoeg/steampowered/block/SPShapes.java b/src/main/java/com/teammoeg/steampowered/block/SPShapes.java index 1e587ed..d5b0e5e 100644 --- a/src/main/java/com/teammoeg/steampowered/block/SPShapes.java +++ b/src/main/java/com/teammoeg/steampowered/block/SPShapes.java @@ -18,8 +18,8 @@ package com.teammoeg.steampowered.block; -import com.simibubi.create.foundation.utility.VoxelShaper; +import net.createmod.catnip.math.VoxelShaper; import net.minecraft.core.Direction; import net.minecraft.world.level.block.Block; import net.minecraft.core.Direction.Axis; diff --git a/src/main/java/com/teammoeg/steampowered/client/SteamPoweredClient.java b/src/main/java/com/teammoeg/steampowered/client/SteamPoweredClient.java index 4de32cb..98c53f1 100644 --- a/src/main/java/com/teammoeg/steampowered/client/SteamPoweredClient.java +++ b/src/main/java/com/teammoeg/steampowered/client/SteamPoweredClient.java @@ -19,10 +19,11 @@ package com.teammoeg.steampowered.client; import com.teammoeg.steampowered.block.SPBlockPartials; -import com.teammoeg.steampowered.network.ponder.SPPonderIndex; +import com.teammoeg.steampowered.network.ponder.SPPonderPlugin; import com.teammoeg.steampowered.registrate.SPBlocks; import com.teammoeg.steampowered.registrate.SPFluids; +import net.createmod.ponder.foundation.PonderIndex; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.ItemBlockRenderTypes; @@ -39,7 +40,7 @@ public static void addClientListeners(IEventBus forgeEventBus, IEventBus modEven } public static void clientInit(FMLClientSetupEvent event) { - SPPonderIndex.register(); + PonderIndex.addPlugin(new SPPonderPlugin()); } public static void registerParticleFactories(RegisterParticleProvidersEvent event) { Minecraft.getInstance().particleEngine.register(Particles.STEAM.get(), SteamParticle.Factory::new); diff --git a/src/main/java/com/teammoeg/steampowered/client/instance/AbstractSPFlywheelInstance.java b/src/main/java/com/teammoeg/steampowered/client/instance/AbstractSPFlywheelInstance.java index 74f1e02..9bb90e1 100644 --- a/src/main/java/com/teammoeg/steampowered/client/instance/AbstractSPFlywheelInstance.java +++ b/src/main/java/com/teammoeg/steampowered/client/instance/AbstractSPFlywheelInstance.java @@ -1,60 +1,65 @@ package com.teammoeg.steampowered.client.instance; import com.google.common.collect.Lists; -import com.jozufozu.flywheel.api.InstanceData; -import com.jozufozu.flywheel.api.Instancer; -import com.jozufozu.flywheel.api.Material; -import com.jozufozu.flywheel.api.MaterialManager; -import com.jozufozu.flywheel.api.instance.DynamicInstance; -import com.jozufozu.flywheel.core.materials.model.ModelData; -import com.jozufozu.flywheel.util.transform.TransformStack; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllPartialModels; -import com.simibubi.create.content.kinetics.base.KineticBlockEntityInstance; -import com.simibubi.create.content.kinetics.base.flwdata.RotatingData; -import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.content.kinetics.base.KineticBlockEntityVisual; +import com.simibubi.create.content.kinetics.base.RotatingInstance; +import com.simibubi.create.foundation.render.AllInstanceTypes; import com.teammoeg.steampowered.block.SPBlockPartials; import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlock; +import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlockEntity; +import dev.engine_room.flywheel.api.instance.Instance; +import dev.engine_room.flywheel.api.instance.Instancer; +import dev.engine_room.flywheel.api.visualization.VisualizationContext; +import dev.engine_room.flywheel.lib.instance.FlatLit; +import dev.engine_room.flywheel.lib.instance.InstanceTypes; +import dev.engine_room.flywheel.lib.instance.TransformedInstance; +import dev.engine_room.flywheel.lib.model.Models; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; +import dev.engine_room.flywheel.lib.transform.PoseTransformStack; +import dev.engine_room.flywheel.lib.transform.TransformStack; +import dev.engine_room.flywheel.lib.visual.SimpleDynamicVisual; +import net.createmod.catnip.math.AngleHelper; import net.minecraft.core.Direction; import net.minecraft.util.Mth; -import net.minecraft.world.level.block.Rotation; -import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; +import java.util.function.Consumer; import static com.simibubi.create.content.kinetics.base.HorizontalKineticBlock.HORIZONTAL_FACING; -public abstract class AbstractSPFlywheelInstance extends KineticBlockEntityInstance implements DynamicInstance { +public abstract class AbstractSPFlywheelInstance extends KineticBlockEntityVisual implements SimpleDynamicVisual { protected final Direction facing; protected final Direction connection; protected boolean connectedLeft; protected float connectorAngleMult; - protected final RotatingData shaft; + protected final RotatingInstance shaft; - protected final ModelData wheel; + protected final TransformedInstance wheel; - protected List connectors; - protected ModelData upperRotating; - protected ModelData lowerRotating; - protected ModelData upperSliding; - protected ModelData lowerSliding; + protected List connectors; + protected TransformedInstance upperRotating; + protected TransformedInstance lowerRotating; + protected TransformedInstance upperSliding; + protected TransformedInstance lowerSliding; protected float lastAngle = Float.NaN; - public AbstractSPFlywheelInstance(MaterialManager modelManager, com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlockEntity tile) { - super(modelManager, tile); + public AbstractSPFlywheelInstance(VisualizationContext modelManager, com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlockEntity tile, float d) { + super(modelManager, tile, d); facing = blockState.getValue(HORIZONTAL_FACING); - shaft = setup(shaftModel().createInstance()); + shaft = shaftModel().createInstance(); - @SuppressWarnings("deprecation") - BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90); - wheel = getTransformMaterial().getModel(SPBlockPartials.BRONZE_FLYWHEEL, referenceState, referenceState.getValue(HORIZONTAL_FACING)).createInstance(); + shaft.setup(tile).setPosition(getVisualPosition()).rotateToFace(facing.getClockWise()).setChanged(); + + wheel = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(getWheelModel(), facing.getClockWise())).createInstance();//, referenceState, referenceState.getValue(HORIZONTAL_FACING)).createInstance(); connection = OldFlywheelBlock.getConnection(blockState); if (connection != null) { @@ -64,12 +69,10 @@ public AbstractSPFlywheelInstance(MaterialManager modelManager, com.teammoeg.ste connectorAngleMult = flipAngle ? -1 : 1; - Material mat = getTransformMaterial(); - - upperRotating = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_ROTATING, blockState).createInstance(); - lowerRotating = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_ROTATING, blockState).createInstance(); - upperSliding = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_SLIDING, blockState).createInstance(); - lowerSliding = mat.getModel(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_SLIDING, blockState).createInstance(); + upperRotating = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(getUpperRotatingModel())).createInstance(); + lowerRotating = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(getLowerRotatingModel())).createInstance(); + upperSliding = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(getUpperSlidingModel())).createInstance(); + lowerSliding = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(getLowerSlidingModel())).createInstance(); connectors = Lists.newArrayList(upperRotating, lowerRotating, upperSliding, lowerSliding); } else { @@ -79,9 +82,10 @@ public AbstractSPFlywheelInstance(MaterialManager modelManager, com.teammoeg.ste } - public void beginFrame() { + @Override + public void beginFrame(Context context) { - float partialTicks = AnimationTickHolder.getPartialTicks(); + float partialTicks = context.partialTick(); float speed = blockEntity.visualSpeed.get(partialTicks) * 3 / 10f; float angle = blockEntity.angle + speed * partialTicks; @@ -95,9 +99,9 @@ public void beginFrame() { private void animate(float angle) { PoseStack ms = new PoseStack(); - TransformStack msr = TransformStack.cast(ms); + PoseTransformStack msr = TransformStack.of(ms); - msr.translate(getInstancePosition()); + msr.translate(getVisualPosition()); if (connection != null) { float rotation = angle * connectorAngleMult; @@ -108,62 +112,72 @@ private void animate(float angle) { ms.pushPose(); transformConnector(msr, true, true, rotation, connectedLeft); upperRotating.setTransform(ms); + upperRotating.setChanged(); ms.popPose(); ms.pushPose(); transformConnector(msr, false, true, rotation, connectedLeft); lowerRotating.setTransform(ms); + lowerRotating.setChanged(); ms.popPose(); ms.pushPose(); transformConnector(msr, true, false, rotation, connectedLeft); upperSliding.setTransform(ms); + upperSliding.setChanged(); ms.popPose(); ms.pushPose(); transformConnector(msr, false, false, rotation, connectedLeft); lowerSliding.setTransform(ms); + lowerSliding.setChanged(); ms.popPose(); ms.popPose(); } - msr.centre() - .rotate(Direction.get(Direction.AxisDirection.POSITIVE, facing.getAxis()), AngleHelper.rad(angle)) - .unCentre(); + msr.center() + .rotate(AngleHelper.rad(angle), Direction.get(Direction.AxisDirection.POSITIVE, rotationAxis()).getAxis()) + .uncenter(); wheel.setTransform(ms); + wheel.setChanged(); } @Override - public void update() { - updateRotation(shaft); + public void update(float ticks) { + shaft.setup(blockEntity).setChanged(); } @Override - public void updateLight() { + public void updateLight(float v) { relight(pos, shaft, wheel); if (connection != null) { - relight(this.pos.relative(connection), connectors.stream()); + relight(this.pos.relative(connection), connectors.stream().map((f) -> (FlatLit)f).iterator()); } } @Override - public void remove() { + public void _delete() { shaft.delete(); wheel.delete(); - connectors.forEach(InstanceData::delete); + connectors.forEach(TransformedInstance::delete); connectors.clear(); } - protected Instancer shaftModel() { + @Override + public void collectCrumblingInstances(Consumer<@Nullable Instance> consumer) { + + } + + protected Instancer shaftModel() { Direction opposite = facing.getOpposite(); - return getRotatingMaterial().getModel(AllPartialModels.SHAFT_HALF, blockState, opposite); + return instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT_HALF, opposite)); } - protected void transformConnector(TransformStack ms, boolean upper, boolean rotating, float angle, boolean flip) { + protected void transformConnector(PoseTransformStack ms, boolean upper, boolean rotating, float angle, boolean flip) { float shift = upper ? 1 / 4f : -1 / 8f; float offset = 1 / 4f; float radians = (float) (angle / 180 * Math.PI); @@ -182,16 +196,22 @@ protected void transformConnector(TransformStack ms, boolean upper, boolean rota ms.translate(pivotX, pivotY, pivotZ + shifting); if (rotating) - ms.rotate(Direction.EAST, AngleHelper.rad(barAngle)); + ms.rotate(AngleHelper.rad(barAngle), Direction.Axis.X); ms.translate(-pivotX, -pivotY, -pivotZ); if (flip && !upper) ms.translate(9 / 16f, 0, 0); } - protected void rotateToFacing(TransformStack buffer, Direction facing) { - buffer.centre() - .rotate(Direction.UP, AngleHelper.rad(AngleHelper.horizontalAngle(facing))) - .unCentre(); + protected void rotateToFacing(PoseTransformStack buffer, Direction facing) { + buffer.center() + .rotate(AngleHelper.rad(AngleHelper.horizontalAngle(facing)), Direction.UP) + .uncenter(); } + + protected abstract PartialModel getWheelModel(); + protected abstract PartialModel getUpperSlidingModel(); + protected abstract PartialModel getLowerSlidingModel(); + protected abstract PartialModel getUpperRotatingModel(); + protected abstract PartialModel getLowerRotatingModel(); } diff --git a/src/main/java/com/teammoeg/steampowered/client/instance/BronzeFlywheelInstance.java b/src/main/java/com/teammoeg/steampowered/client/instance/BronzeFlywheelInstance.java index 632f703..fec05b2 100644 --- a/src/main/java/com/teammoeg/steampowered/client/instance/BronzeFlywheelInstance.java +++ b/src/main/java/com/teammoeg/steampowered/client/instance/BronzeFlywheelInstance.java @@ -18,12 +18,38 @@ package com.teammoeg.steampowered.client.instance; -import com.jozufozu.flywheel.api.MaterialManager; +import com.teammoeg.steampowered.block.SPBlockPartials; import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlockEntity; - +import dev.engine_room.flywheel.api.visualization.VisualizationContext; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; public class BronzeFlywheelInstance extends AbstractSPFlywheelInstance { - public BronzeFlywheelInstance(MaterialManager modelManager, OldFlywheelBlockEntity tile) { - super(modelManager, tile); + public BronzeFlywheelInstance(VisualizationContext modelManager, OldFlywheelBlockEntity tile, float d) { + super(modelManager, tile, d); + } + + @Override + protected PartialModel getWheelModel() { + return SPBlockPartials.BRONZE_FLYWHEEL; + } + + @Override + protected PartialModel getUpperSlidingModel() { + return SPBlockPartials.BRONZE_FLYWHEEL_UPPER_SLIDING; + } + + @Override + protected PartialModel getLowerSlidingModel() { + return SPBlockPartials.BRONZE_FLYWHEEL_LOWER_SLIDING; + } + + @Override + protected PartialModel getUpperRotatingModel() { + return SPBlockPartials.BRONZE_FLYWHEEL_UPPER_ROTATING; + } + + @Override + protected PartialModel getLowerRotatingModel() { + return SPBlockPartials.BRONZE_FLYWHEEL_LOWER_ROTATING; } } diff --git a/src/main/java/com/teammoeg/steampowered/client/instance/CastIronFlywheelInstance.java b/src/main/java/com/teammoeg/steampowered/client/instance/CastIronFlywheelInstance.java index c4fc6e7..ee10ced 100644 --- a/src/main/java/com/teammoeg/steampowered/client/instance/CastIronFlywheelInstance.java +++ b/src/main/java/com/teammoeg/steampowered/client/instance/CastIronFlywheelInstance.java @@ -18,12 +18,39 @@ package com.teammoeg.steampowered.client.instance; -import com.jozufozu.flywheel.api.MaterialManager; +import com.teammoeg.steampowered.block.SPBlockPartials; import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlockEntity; +import dev.engine_room.flywheel.api.visualization.VisualizationContext; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; public class CastIronFlywheelInstance extends AbstractSPFlywheelInstance { - public CastIronFlywheelInstance(MaterialManager modelManager, OldFlywheelBlockEntity tile) { - super(modelManager, tile); + public CastIronFlywheelInstance(VisualizationContext modelManager, OldFlywheelBlockEntity tile, float d) { + super(modelManager, tile, d); + } + + @Override + protected PartialModel getWheelModel() { + return SPBlockPartials.CAST_IRON_FLYWHEEL; + } + + @Override + protected PartialModel getUpperSlidingModel() { + return SPBlockPartials.CAST_IRON_FLYWHEEL_UPPER_SLIDING; + } + + @Override + protected PartialModel getLowerSlidingModel() { + return SPBlockPartials.CAST_IRON_FLYWHEEL_LOWER_SLIDING; + } + + @Override + protected PartialModel getUpperRotatingModel() { + return SPBlockPartials.CAST_IRON_FLYWHEEL_UPPER_ROTATING; + } + + @Override + protected PartialModel getLowerRotatingModel() { + return SPBlockPartials.CAST_IRON_FLYWHEEL_LOWER_ROTATING; } } \ No newline at end of file diff --git a/src/main/java/com/teammoeg/steampowered/client/instance/SteelFlywheelInstance.java b/src/main/java/com/teammoeg/steampowered/client/instance/SteelFlywheelInstance.java index 25a3ff5..82adc0d 100644 --- a/src/main/java/com/teammoeg/steampowered/client/instance/SteelFlywheelInstance.java +++ b/src/main/java/com/teammoeg/steampowered/client/instance/SteelFlywheelInstance.java @@ -18,12 +18,39 @@ package com.teammoeg.steampowered.client.instance; -import com.jozufozu.flywheel.api.MaterialManager; +import com.teammoeg.steampowered.block.SPBlockPartials; import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlockEntity; +import dev.engine_room.flywheel.api.visualization.VisualizationContext; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; public class SteelFlywheelInstance extends AbstractSPFlywheelInstance { - public SteelFlywheelInstance(MaterialManager modelManager, OldFlywheelBlockEntity tile) { - super(modelManager, tile); + public SteelFlywheelInstance(VisualizationContext modelManager, OldFlywheelBlockEntity tile, float d) { + super(modelManager, tile, d); + } + + @Override + protected PartialModel getWheelModel() { + return SPBlockPartials.STEEL_FLYWHEEL; + } + + @Override + protected PartialModel getUpperSlidingModel() { + return SPBlockPartials.STEEL_FLYWHEEL_UPPER_SLIDING; + } + + @Override + protected PartialModel getLowerSlidingModel() { + return SPBlockPartials.STEEL_FLYWHEEL_LOWER_SLIDING; + } + + @Override + protected PartialModel getUpperRotatingModel() { + return SPBlockPartials.STEEL_FLYWHEEL_UPPER_ROTATING; + } + + @Override + protected PartialModel getLowerRotatingModel() { + return SPBlockPartials.STEEL_FLYWHEEL_LOWER_ROTATING; } } \ No newline at end of file diff --git a/src/main/java/com/teammoeg/steampowered/client/render/AbstractSPFlywheelRenderer.java b/src/main/java/com/teammoeg/steampowered/client/render/AbstractSPFlywheelRenderer.java index 00b44ac..4dbf33b 100644 --- a/src/main/java/com/teammoeg/steampowered/client/render/AbstractSPFlywheelRenderer.java +++ b/src/main/java/com/teammoeg/steampowered/client/render/AbstractSPFlywheelRenderer.java @@ -1,18 +1,20 @@ package com.teammoeg.steampowered.client.render; -import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.simibubi.create.AllPartialModels; +import com.simibubi.create.api.stress.BlockStressValues; import com.simibubi.create.content.kinetics.base.HorizontalKineticBlock; import com.simibubi.create.content.kinetics.base.KineticBlockEntity; import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer; -import com.simibubi.create.foundation.render.CachedBufferer; -import com.simibubi.create.foundation.render.SuperByteBuffer; -import com.simibubi.create.foundation.utility.AngleHelper; import com.teammoeg.steampowered.block.SPBlockPartials; import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlock; import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlockEntity; +import dev.engine_room.flywheel.api.backend.Backend; +import dev.engine_room.flywheel.api.visualization.VisualizationManager; +import net.createmod.catnip.math.AngleHelper; +import net.createmod.catnip.render.CachedBuffers; +import net.createmod.catnip.render.SuperByteBuffer; import net.minecraft.client.renderer.LevelRenderer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -30,7 +32,7 @@ public AbstractSPFlywheelRenderer(BlockEntityRendererProvider.Context context) { protected void renderSafe(OldFlywheelBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) { super.renderSafe(te, partialTicks, ms, buffer, light, overlay); - if (!Backend.canUseInstancing(te.getLevel())) { + if (!VisualizationManager.supportsVisualization(te.getLevel())) { BlockState blockState = te.getBlockState(); OldFlywheelBlockEntity wte = te; float speed = wte.visualSpeed.get(partialTicks) * 3.0F / 10.0F; @@ -41,10 +43,10 @@ protected void renderSafe(OldFlywheelBlockEntity te, float partialTicks, PoseSta light = LevelRenderer.getLightColor(te.getLevel(), blockState, te.getBlockPos().relative(connection)); float rotation = connection.getAxis() == Direction.Axis.X ^ connection.getAxisDirection() == Direction.AxisDirection.NEGATIVE ? -angle : angle; boolean flip = blockState.getValue(OldFlywheelBlock.CONNECTION) == OldFlywheelBlock.ConnectionState.LEFT; - this.transformConnector(this.rotateToFacing(CachedBufferer.partial(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_ROTATING, blockState), connection), true, true, rotation, flip).light(light).renderInto(ms, vb); - this.transformConnector(this.rotateToFacing(CachedBufferer.partial(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_ROTATING, blockState), connection), false, true, rotation, flip).light(light).renderInto(ms, vb); - this.transformConnector(this.rotateToFacing(CachedBufferer.partial(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_SLIDING, blockState), connection), true, false, rotation, flip).light(light).renderInto(ms, vb); - this.transformConnector(this.rotateToFacing(CachedBufferer.partial(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_SLIDING, blockState), connection), false, false, rotation, flip).light(light).renderInto(ms, vb); + this.transformConnector(this.rotateToFacing(CachedBuffers.partial(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_ROTATING, blockState), connection), true, true, rotation, flip).light(light).renderInto(ms, vb); + this.transformConnector(this.rotateToFacing(CachedBuffers.partial(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_ROTATING, blockState), connection), false, true, rotation, flip).light(light).renderInto(ms, vb); + this.transformConnector(this.rotateToFacing(CachedBuffers.partial(SPBlockPartials.BRONZE_FLYWHEEL_UPPER_SLIDING, blockState), connection), true, false, rotation, flip).light(light).renderInto(ms, vb); + this.transformConnector(this.rotateToFacing(CachedBuffers.partial(SPBlockPartials.BRONZE_FLYWHEEL_LOWER_SLIDING, blockState), connection), false, false, rotation, flip).light(light).renderInto(ms, vb); } this.renderFlywheel(te, ms, light, blockState, angle, vb); } @@ -54,13 +56,13 @@ private void renderFlywheel(KineticBlockEntity te, PoseStack ms, int light, Bloc @SuppressWarnings("deprecation") BlockState referenceState = blockState.rotate(Rotation.CLOCKWISE_90); Direction facing = (Direction) referenceState.getValue(BlockStateProperties.HORIZONTAL_FACING); - SuperByteBuffer wheel = CachedBufferer.partialFacing(SPBlockPartials.BRONZE_FLYWHEEL, referenceState, facing); + SuperByteBuffer wheel = CachedBuffers.partialFacing(SPBlockPartials.BRONZE_FLYWHEEL, referenceState, facing); kineticRotationTransform(wheel, te, ((Direction) blockState.getValue(HorizontalKineticBlock.HORIZONTAL_FACING)).getAxis(), AngleHelper.rad((double) angle), light); wheel.renderInto(ms, vb); } protected SuperByteBuffer getRotatedModel(KineticBlockEntity te) { - return CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, te.getBlockState(), ((Direction) te.getBlockState().getValue(BlockStateProperties.HORIZONTAL_FACING)).getOpposite()); + return CachedBuffers.partialFacing(AllPartialModels.SHAFT_HALF, te.getBlockState(), ((Direction) te.getBlockState().getValue(BlockStateProperties.HORIZONTAL_FACING)).getOpposite()); } protected SuperByteBuffer transformConnector(SuperByteBuffer buffer, boolean upper, boolean rotating, float angle, boolean flip) { @@ -80,7 +82,7 @@ protected SuperByteBuffer transformConnector(SuperByteBuffer buffer, boolean upp float pivotZ = (upper ? 23.0F : 21.5F) / 16.0F; buffer.translate(pivotX, pivotY, pivotZ + shifting); if (rotating) { - buffer.rotate(Direction.EAST, AngleHelper.rad((double) barAngle)); + buffer.rotate(Direction.Axis.X, AngleHelper.rad((double) barAngle)); } buffer.translate(-pivotX, -pivotY, -pivotZ); @@ -92,7 +94,7 @@ protected SuperByteBuffer transformConnector(SuperByteBuffer buffer, boolean upp } protected SuperByteBuffer rotateToFacing(SuperByteBuffer buffer, Direction facing) { - buffer.rotateCentered(Direction.UP, AngleHelper.rad((double) AngleHelper.horizontalAngle(facing))); + buffer.rotateCentered(AngleHelper.rad((double) AngleHelper.horizontalAngle(facing)), Direction.Axis.Y); return buffer; } } diff --git a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java index edb354c..83067ff 100644 --- a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlock.java @@ -22,10 +22,11 @@ import com.simibubi.create.content.kinetics.base.IRotate; import com.simibubi.create.foundation.block.IBE; import com.simibubi.create.foundation.item.TooltipHelper; -import com.simibubi.create.foundation.utility.Lang; -import com.simibubi.create.foundation.utility.VoxelShaper; +import com.simibubi.create.foundation.utility.CreateLang; import com.teammoeg.steampowered.block.SPShapes; import com.teammoeg.steampowered.registrate.SPBlockEntities; +import net.createmod.catnip.lang.FontHelper; +import net.createmod.catnip.math.VoxelShaper; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.BlockPos; @@ -128,12 +129,12 @@ public void appendHoverText(ItemStack i, BlockGetter w, List t, Toolt if(Screen.hasShiftDown()) { t.add(Component.translatable("tooltip.steampowered.alternator.thanks").withStyle(ChatFormatting.GOLD)); }else { - t.add(TooltipHelper.holdShift(TooltipHelper.Palette.GRAY,false)); + t.add(TooltipHelper.holdShift(FontHelper.Palette.GRAY,false)); } if(Screen.hasControlDown()) { t.add(Component.translatable("tooltip.steampowered.alternator.redstone").withStyle(ChatFormatting.RED)); }else { - t.add(Lang.translate("tooltip.holdForControls", Lang.translate("tooltip.keyCtrl") + t.add(CreateLang.translate("tooltip.holdForControls", CreateLang.translate("tooltip.keyCtrl") .style(ChatFormatting.GRAY)) .style(ChatFormatting.DARK_GRAY).component()); } diff --git a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlockEntity.java b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlockEntity.java index 1f40bc4..97f57a9 100644 --- a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlockEntity.java +++ b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoBlockEntity.java @@ -19,8 +19,9 @@ package com.teammoeg.steampowered.content.alternator; import com.simibubi.create.content.kinetics.base.KineticBlockEntity; -import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.CreateLang; import com.teammoeg.steampowered.SPConfig; +import com.teammoeg.steampowered.oldcreatestuff.IGoggleInformation; import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -42,7 +43,7 @@ * @author MRH0 * @author yuesha-yc */ -public class DynamoBlockEntity extends KineticBlockEntity { +public class DynamoBlockEntity extends KineticBlockEntity implements IGoggleInformation { protected final InternalEnergyStorage energy; private LazyOptional lazyEnergy; @@ -68,7 +69,7 @@ public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneak } tooltip.add(Component.literal(spacing).append(Component.translatable("tooltip.steampowered.energy.production").withStyle(ChatFormatting.GRAY))); tooltip.add(Component.literal(spacing).append(Component.literal(" " + format(getEnergyProductionRate((int) (isSpeedRequirementFulfilled() ? getSpeed() : 0))) + "fe/t ") // fix - .withStyle(ChatFormatting.AQUA)).append(Lang.translate("gui.goggles.at_current_speed").style(ChatFormatting.DARK_GRAY).component())); + .withStyle(ChatFormatting.AQUA)).append(CreateLang.translate("gui.goggles.at_current_speed").style(ChatFormatting.DARK_GRAY).component())); return super.addToGoggleTooltip(tooltip, isPlayerSneaking); } diff --git a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoShaftInstance.java b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoShaftInstance.java index 696766b..956a67c 100644 --- a/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoShaftInstance.java +++ b/src/main/java/com/teammoeg/steampowered/content/alternator/DynamoShaftInstance.java @@ -1,17 +1,20 @@ package com.teammoeg.steampowered.content.alternator; -import com.jozufozu.flywheel.api.MaterialManager; -import com.simibubi.create.content.kinetics.base.HalfShaftInstance; +import com.simibubi.create.AllPartialModels; +import com.simibubi.create.content.kinetics.base.SingleAxisRotatingVisual; +import dev.engine_room.flywheel.api.visualization.VisualizationContext; +import dev.engine_room.flywheel.lib.model.Models; import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.BlockState; -public class DynamoShaftInstance extends HalfShaftInstance { +public class DynamoShaftInstance extends SingleAxisRotatingVisual { - public DynamoShaftInstance(MaterialManager modelManager, DynamoBlockEntity tile) { - super(modelManager, tile); + public DynamoShaftInstance(VisualizationContext modelManager, DynamoBlockEntity tile, float d) { + super(modelManager, tile, d, Models.partial(AllPartialModels.SHAFT, Direction.UP)); + } + + protected static Direction getShaftDirection(BlockState blockState) { + return blockState.getValue(DynamoBlock.FACING).getOpposite(); } - @Override - protected Direction getShaftDirection() { - return blockState.getValue(DynamoBlock.FACING).getOpposite(); - } } diff --git a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java index 48f79a4..29bfcb3 100644 --- a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerBlock.java @@ -19,8 +19,9 @@ package com.teammoeg.steampowered.content.boiler; import com.simibubi.create.foundation.item.TooltipHelper; -import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.CreateLang; import com.teammoeg.steampowered.client.ClientUtils; +import net.createmod.catnip.lang.FontHelper; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.BlockPos; @@ -92,14 +93,14 @@ public void appendHoverText(ItemStack i, BlockGetter w, List t, Toolt .withStyle(ChatFormatting.GOLD)); } } else { - t.add(TooltipHelper.holdShift(TooltipHelper.Palette.GRAY, false)); + t.add(TooltipHelper.holdShift(FontHelper.Palette.GRAY, false)); } if (Screen.hasControlDown()) { t.add(Component.translatable("tooltip.steampowered.boiler.redstone").withStyle(ChatFormatting.RED)); } else { - t.add(Lang + t.add(CreateLang .translate("tooltip.holdForControls", - Lang.translate("tooltip.keyCtrl").style(ChatFormatting.GRAY)) + CreateLang.translate("tooltip.keyCtrl").style(ChatFormatting.GRAY)) .style(ChatFormatting.DARK_GRAY).component()); } super.appendHoverText(i, w, t, f); diff --git a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java index 2930b07..663b724 100644 --- a/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java +++ b/src/main/java/com/teammoeg/steampowered/content/boiler/BoilerTileEntity.java @@ -18,11 +18,14 @@ package com.teammoeg.steampowered.content.boiler; -import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation; +import com.simibubi.create.api.boiler.BoilerHeater; +import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation; +import com.simibubi.create.content.fluids.tank.BoilerHeaters; import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour; import com.teammoeg.steampowered.SPConfig; import com.teammoeg.steampowered.client.Particles; +import com.teammoeg.steampowered.content.burner.BurnerBlock; import com.teammoeg.steampowered.content.burner.IHeatReceiver; import com.teammoeg.steampowered.registrate.SPFluids; import net.minecraft.core.BlockPos; @@ -163,6 +166,7 @@ public void tick() { if (this.level == null) return; if (!this.level.isClientSide) { + getHeatFromHeater(); lastheat = heatreceived; if (heatreceived != 0) { int consume = Math.min(getHUPerTick(), heatreceived); @@ -209,6 +213,16 @@ public void commitHeat(float value) { } + protected void getHeatFromHeater() { + BlockPos below = this.getBlockPos().below(); + BlockState belowState = this.level.getBlockState(below); + if (belowState.getBlock() instanceof BurnerBlock) return; + float heat = BoilerHeater.findHeat(this.level, below, belowState); + if (heat > 0) { + commitHeat(Math.max(heat, 3f) * getHUPerTick() * 0.75f); + } + } + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { this.containedFluidTooltip(tooltip, isPlayerSneaking, LazyOptional.of(() -> input)); this.containedFluidTooltip(tooltip, isPlayerSneaking, LazyOptional.of(() -> output)); diff --git a/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java b/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java index 4d5f23d..8f4f420 100644 --- a/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlock.java @@ -19,8 +19,9 @@ package com.teammoeg.steampowered.content.burner; import com.simibubi.create.foundation.item.TooltipHelper; -import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.CreateLang; import com.teammoeg.steampowered.client.ClientUtils; +import net.createmod.catnip.lang.FontHelper; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.BlockPos; @@ -121,12 +122,12 @@ public void appendHoverText(ItemStack i, BlockGetter w, List t, t.add(Component.translatable("tooltip.steampowered.burner.danger").withStyle(ChatFormatting.RED)); } }else { - t.add(TooltipHelper.holdShift(TooltipHelper.Palette.GRAY,false)); + t.add(TooltipHelper.holdShift(FontHelper.Palette.GRAY,false)); } if(Screen.hasControlDown()) { t.add(Component.translatable("tooltip.steampowered.burner.redstone").withStyle(ChatFormatting.RED)); }else { - t.add(Lang.translate("tooltip.holdForControls", Lang.translate("tooltip.keyCtrl") + t.add(CreateLang.translate("tooltip.holdForControls", CreateLang.translate("tooltip.keyCtrl") .style(ChatFormatting.GRAY)) .style(ChatFormatting.DARK_GRAY).component()); } diff --git a/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlockEntity.java b/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlockEntity.java index 12333c7..70e5945 100644 --- a/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlockEntity.java +++ b/src/main/java/com/teammoeg/steampowered/content/burner/BurnerBlockEntity.java @@ -20,12 +20,14 @@ import java.util.List; -import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation; +import com.simibubi.create.api.boiler.BoilerHeater; import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour; import com.teammoeg.steampowered.SPConfig; +import com.teammoeg.steampowered.oldcreatestuff.IGoggleInformation; import net.minecraft.core.BlockPos; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeType; @@ -42,7 +44,7 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; -public abstract class BurnerBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation { +public abstract class BurnerBlockEntity extends SmartBlockEntity implements IGoggleInformation { private ItemStackHandler inv = new ItemStackHandler() { @Override @@ -165,4 +167,14 @@ public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneak * */ protected abstract int getHuPerTick(); protected abstract double getEfficiency(); + + public static float getBoilerHeat(Level level, BlockPos pos, BlockState state) { + BlockEntity tile = level.getBlockEntity(pos); + if (tile instanceof BurnerBlockEntity burner) { + if (burner.HURemain > 0 || state.getValue(BurnerBlock.LIT)) { + return 1; + } + } + return BoilerHeater.NO_HEAT; + } } diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java b/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java index a729934..870a40d 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/BronzeSteamEngineBlock.java @@ -25,6 +25,7 @@ import com.teammoeg.steampowered.SPConfig; import com.teammoeg.steampowered.client.ClientUtils; import com.teammoeg.steampowered.registrate.SPBlockEntities; +import net.createmod.catnip.lang.FontHelper; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.client.gui.screens.Screen; import net.minecraft.world.item.TooltipFlag; @@ -59,7 +60,7 @@ public void appendHoverText(ItemStack i, BlockGetter w, List t, if(ClientUtils.hasGoggles()) t.add(Component.translatable("tooltip.steampowered.engine.steamconsume",SPConfig.COMMON.bronzeFlywheelSteamConsumptionPerTick.get()).withStyle(ChatFormatting.GOLD)); }else { - t.add(TooltipHelper.holdShift(TooltipHelper.Palette.GRAY,false)); + t.add(TooltipHelper.holdShift(FontHelper.Palette.GRAY,false)); } super.appendHoverText(i,w,t,f); } diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java b/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java index 41d2af3..452092e 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/CastIronSteamEngineBlock.java @@ -23,6 +23,7 @@ import com.teammoeg.steampowered.SPConfig; import com.teammoeg.steampowered.client.ClientUtils; import com.teammoeg.steampowered.registrate.SPBlockEntities; +import net.createmod.catnip.lang.FontHelper; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -53,7 +54,7 @@ public void appendHoverText(ItemStack i, BlockGetter w, List t, if(ClientUtils.hasGoggles()) t.add(Component.translatable("tooltip.steampowered.engine.steamconsume",SPConfig.COMMON.castIronFlywheelSteamConsumptionPerTick.get()).withStyle(ChatFormatting.GOLD)); }else { - t.add(TooltipHelper.holdShift(TooltipHelper.Palette.GRAY,false)); + t.add(TooltipHelper.holdShift(FontHelper.Palette.GRAY,false)); } super.appendHoverText(i,w,t,f); } diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineBlock.java b/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineBlock.java index 56ee39d..9507383 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineBlock.java @@ -18,12 +18,12 @@ package com.teammoeg.steampowered.content.engine; -import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.AllShapes; import com.teammoeg.steampowered.oldcreatestuff.OldBlockPartials; import com.teammoeg.steampowered.oldcreatestuff.OldEngineBlock; import com.teammoeg.steampowered.registrate.SPFluids; import com.teammoeg.steampowered.registrate.SPItems; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineTileEntity.java b/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineTileEntity.java index 07ca9cb..bd60c8f 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineTileEntity.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/SteamEngineTileEntity.java @@ -18,12 +18,12 @@ package com.teammoeg.steampowered.content.engine; -import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation; import com.teammoeg.steampowered.SPTags; import com.teammoeg.steampowered.client.Particles; import com.teammoeg.steampowered.content.boiler.BoilerTileEntity; import com.teammoeg.steampowered.content.flywheel.SteamFlywheelBlock; import com.teammoeg.steampowered.content.flywheel.SteamFlywheelTileEntity; +import com.teammoeg.steampowered.oldcreatestuff.IGoggleInformation; import com.teammoeg.steampowered.oldcreatestuff.OldEngineBlock; import com.teammoeg.steampowered.oldcreatestuff.OldEngineBlockEntity; import com.teammoeg.steampowered.registrate.SPFluids; @@ -50,7 +50,7 @@ import javax.annotation.Nullable; import java.util.List; -public abstract class SteamEngineTileEntity extends OldEngineBlockEntity implements IHaveGoggleInformation { +public abstract class SteamEngineTileEntity extends OldEngineBlockEntity implements IGoggleInformation { private FluidTank tank; private IFluidHandler handler=new IFluidHandler() { diff --git a/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java b/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java index 2310f0d..5d62c81 100644 --- a/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/content/engine/SteelSteamEngineBlock.java @@ -23,6 +23,7 @@ import com.teammoeg.steampowered.SPConfig; import com.teammoeg.steampowered.client.ClientUtils; import com.teammoeg.steampowered.registrate.SPBlockEntities; +import net.createmod.catnip.lang.FontHelper; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; @@ -53,7 +54,7 @@ public void appendHoverText(ItemStack i, BlockGetter w, List t, if(ClientUtils.hasGoggles()) t.add(Component.translatable("tooltip.steampowered.engine.steamconsume",SPConfig.COMMON.steelFlywheelSteamConsumptionPerTick.get()).withStyle(ChatFormatting.GOLD)); }else { - t.add(TooltipHelper.holdShift(TooltipHelper.Palette.GRAY,false)); + t.add(TooltipHelper.holdShift(FontHelper.Palette.GRAY,false)); } super.appendHoverText(i,w,t,f); } diff --git a/src/main/java/com/teammoeg/steampowered/network/ponder/SPPonderIndex.java b/src/main/java/com/teammoeg/steampowered/network/ponder/SPPonderIndex.java deleted file mode 100644 index 0a8189c..0000000 --- a/src/main/java/com/teammoeg/steampowered/network/ponder/SPPonderIndex.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021 TeamMoeg - * - * This file is part of Steam Powered. - * - * Steam Powered is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3. - * - * Steam Powered is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Steam Powered. If not, see . - */ - -package com.teammoeg.steampowered.network.ponder; - -import com.simibubi.create.Create; -import com.simibubi.create.foundation.ponder.PonderRegistrationHelper; -import com.simibubi.create.foundation.ponder.PonderTag; -import com.simibubi.create.infrastructure.ponder.AllPonderTags; -import com.simibubi.create.infrastructure.ponder.scenes.KineticsScenes; -import com.teammoeg.steampowered.SteamPowered; -import com.teammoeg.steampowered.registrate.SPBlocks; - -import net.minecraft.resources.ResourceLocation; - - -public class SPPonderIndex { - static final PonderRegistrationHelper CREATE_HELPER = new PonderRegistrationHelper(Create.ID); - static final PonderRegistrationHelper STEAM_HELPER = new PonderRegistrationHelper(SteamPowered.MODID); - - public static final PonderTag STEAM = new PonderTag(new ResourceLocation(SteamPowered.MODID, "steam")).item(SPBlocks.BRONZE_STEAM_ENGINE.get(), true, false) - .defaultLang("Steam", "Components related to steam production and usage"); - - public static void register() { - CREATE_HELPER.forComponents(SPBlocks.BRONZE_COGWHEEL, SPBlocks.CAST_IRON_COGWHEEL, SPBlocks.STEEL_COGWHEEL) - .addStoryBoard(new ResourceLocation("create", "cog/small"), KineticsScenes::cogAsRelay, AllPonderTags.KINETIC_RELAYS) - .addStoryBoard(new ResourceLocation("create", "cog/speedup"), KineticsScenes::cogsSpeedUp); - - CREATE_HELPER.forComponents(SPBlocks.BRONZE_LARGE_COGWHEEL, SPBlocks.CAST_IRON_LARGE_COGWHEEL, SPBlocks.STEEL_LARGE_COGWHEEL) - .addStoryBoard(new ResourceLocation("create", "cog/speedup"), KineticsScenes::cogsSpeedUp) - .addStoryBoard(new ResourceLocation("create", "cog/large"), KineticsScenes::largeCogAsRelay, AllPonderTags.KINETIC_RELAYS); - - STEAM_HELPER.forComponents(SPBlocks.BRONZE_STEAM_ENGINE, SPBlocks.CAST_IRON_STEAM_ENGINE, SPBlocks.STEEL_STEAM_ENGINE) - .addStoryBoard("steam_engine", SPScenes::steamEngine, AllPonderTags.KINETIC_SOURCES, STEAM); - - STEAM_HELPER.forComponents(SPBlocks.BRONZE_STEAM_ENGINE, SPBlocks.CAST_IRON_STEAM_ENGINE, SPBlocks.STEEL_STEAM_ENGINE) - .addStoryBoard("boiler", SPScenes::steamBoiler, AllPonderTags.KINETIC_SOURCES, STEAM); - - STEAM_HELPER.forComponents(SPBlocks.BRONZE_BOILER, SPBlocks.BRONZE_BURNER, SPBlocks.CAST_IRON_BURNER, SPBlocks.CAST_IRON_BOILER, SPBlocks.STEEL_BURNER, SPBlocks.STEEL_BOILER) - .addStoryBoard("boiler", SPScenes::steamBoiler, AllPonderTags.KINETIC_SOURCES, STEAM); - - STEAM_HELPER.forComponents(SPBlocks.BRONZE_FLYWHEEL, SPBlocks.CAST_IRON_FLYWHEEL, SPBlocks.STEEL_FLYWHEEL) - .addStoryBoard("steam_engine", SPScenes::steamFlywheel, AllPonderTags.KINETIC_SOURCES, STEAM); - - STEAM_HELPER.forComponents(SPBlocks.DYNAMO) - .addStoryBoard("dynamo", SPScenes::dynamo, AllPonderTags.KINETIC_APPLIANCES, STEAM); - - } -} diff --git a/src/main/java/com/teammoeg/steampowered/network/ponder/SPPonderPlugin.java b/src/main/java/com/teammoeg/steampowered/network/ponder/SPPonderPlugin.java new file mode 100644 index 0000000..b417b19 --- /dev/null +++ b/src/main/java/com/teammoeg/steampowered/network/ponder/SPPonderPlugin.java @@ -0,0 +1,66 @@ +package com.teammoeg.steampowered.network.ponder; + +import com.simibubi.create.foundation.ponder.PonderWorldBlockEntityFix; +import com.simibubi.create.infrastructure.ponder.AllCreatePonderTags; +import com.teammoeg.steampowered.SteamPowered; +import com.teammoeg.steampowered.registrate.SPBlocks; +import com.tterrag.registrate.util.entry.ItemProviderEntry; +import com.tterrag.registrate.util.entry.RegistryEntry; +import net.createmod.ponder.api.level.PonderLevel; +import net.createmod.ponder.api.registration.*; +import net.minecraft.resources.ResourceLocation; + +public class SPPonderPlugin implements PonderPlugin { + + public static final ResourceLocation STEAM = SteamPowered.rl("steam"); + + @Override + public String getModId() { + return SteamPowered.MODID; + } + + @Override + public void registerScenes(PonderSceneRegistrationHelper helper) { + PonderSceneRegistrationHelper> HELPER = helper.withKeyFunction(RegistryEntry::getId); + + HELPER.forComponents(SPBlocks.BRONZE_STEAM_ENGINE, SPBlocks.CAST_IRON_STEAM_ENGINE, SPBlocks.STEEL_STEAM_ENGINE) + .addStoryBoard("steam_engine", SPScenes::steamEngine, AllCreatePonderTags.KINETIC_SOURCES, STEAM); + + HELPER.forComponents(SPBlocks.BRONZE_STEAM_ENGINE, SPBlocks.CAST_IRON_STEAM_ENGINE, SPBlocks.STEEL_STEAM_ENGINE) + .addStoryBoard("boiler", SPScenes::steamBoiler, AllCreatePonderTags.KINETIC_SOURCES, STEAM); + + HELPER.forComponents(SPBlocks.BRONZE_BOILER, SPBlocks.BRONZE_BURNER, SPBlocks.CAST_IRON_BURNER, SPBlocks.CAST_IRON_BOILER, SPBlocks.STEEL_BURNER, SPBlocks.STEEL_BOILER) + .addStoryBoard("boiler", SPScenes::steamBoiler, AllCreatePonderTags.KINETIC_SOURCES, STEAM); + + HELPER.forComponents(SPBlocks.BRONZE_FLYWHEEL, SPBlocks.CAST_IRON_FLYWHEEL, SPBlocks.STEEL_FLYWHEEL) + .addStoryBoard("steam_engine", SPScenes::steamFlywheel, AllCreatePonderTags.KINETIC_SOURCES, STEAM); + + HELPER.forComponents(SPBlocks.DYNAMO) + .addStoryBoard("dynamo", SPScenes::dynamo, AllCreatePonderTags.KINETIC_APPLIANCES, STEAM); + } + + @Override + public void registerTags(PonderTagRegistrationHelper helper) { + helper.registerTag(STEAM) + .addToIndex() + .item(SPBlocks.BRONZE_STEAM_ENGINE.get(), true, false) + .title("Steam") + .description("Components related to steam production and usage") + .register(); + } + + @Override + public void registerSharedText(SharedTextRegistrationHelper helper) { + + } + + @Override + public void onPonderLevelRestore(PonderLevel ponderLevel) { + PonderWorldBlockEntityFix.fixControllerBlockEntities(ponderLevel); + } + + @Override + public void indexExclusions(IndexExclusionHelper helper) { + + } +} diff --git a/src/main/java/com/teammoeg/steampowered/network/ponder/SPScenes.java b/src/main/java/com/teammoeg/steampowered/network/ponder/SPScenes.java index 139e047..ffccd3d 100644 --- a/src/main/java/com/teammoeg/steampowered/network/ponder/SPScenes.java +++ b/src/main/java/com/teammoeg/steampowered/network/ponder/SPScenes.java @@ -18,14 +18,7 @@ package com.teammoeg.steampowered.network.ponder; -import com.simibubi.create.foundation.ponder.ElementLink; -import com.simibubi.create.foundation.ponder.SceneBuilder; -import com.simibubi.create.foundation.ponder.SceneBuildingUtil; -import com.simibubi.create.foundation.ponder.Selection; -import com.simibubi.create.foundation.ponder.PonderPalette; -import com.simibubi.create.foundation.ponder.element.InputWindowElement; -import com.simibubi.create.foundation.ponder.element.WorldSectionElement; -import com.simibubi.create.foundation.utility.Pointing; +import com.simibubi.create.foundation.ponder.CreateSceneBuilder; import com.teammoeg.steampowered.SPConfig; import com.teammoeg.steampowered.content.alternator.DynamoBlock; import com.teammoeg.steampowered.content.burner.BurnerBlock; @@ -33,6 +26,14 @@ import com.teammoeg.steampowered.oldcreatestuff.OldFlywheelBlock; import com.teammoeg.steampowered.registrate.SPBlocks; +import net.createmod.catnip.math.Pointing; +import net.createmod.ponder.api.PonderPalette; +import net.createmod.ponder.api.element.ElementLink; +import net.createmod.ponder.api.element.WorldSectionElement; +import net.createmod.ponder.api.scene.SceneBuilder; +import net.createmod.ponder.api.scene.SceneBuildingUtil; +import net.createmod.ponder.api.scene.Selection; +import net.createmod.ponder.foundation.element.InputWindowElement; import net.minecraft.world.level.block.LeverBlock; import net.minecraft.world.level.block.RedStoneWireBlock; import net.minecraft.world.item.ItemStack; @@ -50,267 +51,272 @@ public static void steamFlywheel(SceneBuilder scene, SceneBuildingUtil util) { steamEngine(scene, util, true); } - public static void steamBoiler(SceneBuilder scene, SceneBuildingUtil util) { + public static void steamBoiler(SceneBuilder builder, SceneBuildingUtil util) { + CreateSceneBuilder scene = new CreateSceneBuilder(builder); scene.title("boiler", "Generating Steam through Boilers and Burning Chambers"); scene.configureBasePlate(0, 0, 6); - BlockPos burner = util.grid.at(3, 1, 2); - BlockPos boiler = util.grid.at(3, 2, 2); - BlockPos engine = util.grid.at(2, 2, 2); - //BlockPos steamPump = util.grid.at(1, 2, 2); - BlockPos waterPump = util.grid.at(5, 3, 2); + BlockPos burner = util.grid().at(3, 1, 2); + BlockPos boiler = util.grid().at(3, 2, 2); + BlockPos engine = util.grid().at(2, 2, 2); + //BlockPos steamPump = util.grid().at(1, 2, 2); + BlockPos waterPump = util.grid().at(5, 3, 2); // show the whole structure - scene.world.showSection(util.select.layer(0), Direction.UP); + scene.world().showSection(util.select().layer(0), Direction.UP); scene.idle(10); - scene.world.showSection(util.select.layers(1, 3), Direction.NORTH); + scene.world().showSection(util.select().layers(1, 3), Direction.NORTH); scene.idle(50); // water pumps - scene.world.setKineticSpeed(util.select.position(waterPump), 32.0F); - scene.world.setKineticSpeed(util.select.fromTo(5, 2, 1,6, 2, 1), -16.0F); + scene.world().setKineticSpeed(util.select().position(waterPump), 32.0F); + scene.world().setKineticSpeed(util.select().fromTo(5, 2, 1,6, 2, 1), -16.0F); scene.idle(30); // boiler text - scene.overlay.showText(50) + scene.overlay().showText(50) .attachKeyFrame() .text("The Boiler needs water to produce Steam") .placeNearTarget() - .pointAt(util.vector.centerOf(boiler)); + .pointAt(util.vector().centerOf(boiler)); scene.idle(100); // burner text - scene.overlay.showText(80) + scene.overlay().showText(80) .attachKeyFrame() .text("The Burning Chamber needs furnace fuel to heat the Boiler") .placeNearTarget() - .pointAt(util.vector.centerOf(burner)); + .pointAt(util.vector().centerOf(burner)); scene.idle(100); - scene.overlay.showText(80) + scene.overlay().showText(80) .attachKeyFrame() .text("Right click with fuel item such as Coal or Planks to provide it with fuel") .placeNearTarget() - .pointAt(util.vector.centerOf(burner)); + .pointAt(util.vector().centerOf(burner)); scene.idle(100); // add fuel - scene.overlay.showControls(new InputWindowElement(util.vector.centerOf(burner), Pointing.UP).rightClick() - .withItem(new ItemStack(Items.COAL)), 30); + InputWindowElement inputWindowElement = new InputWindowElement(util.vector().centerOf(burner), Pointing.UP); + inputWindowElement.builder().rightClick() + .withItem(new ItemStack(Items.COAL)); + // scene.overlay().showControls(inputWindowElement, 30); scene.idle(40); - scene.overlay.showControls(new InputWindowElement(util.vector.centerOf(burner), Pointing.UP).rightClick() - .withItem(new ItemStack(Items.OAK_PLANKS)), 30); + //scene.overlay().showControls(new InputWindowElement(util.vector().centerOf(burner), Pointing.UP).rightClick() + // .withItem(new ItemStack(Items.OAK_PLANKS)), 30); scene.idle(40); - scene.world.modifyBlock(burner, s -> s.setValue(BurnerBlock.LIT, true), false); + scene.world().modifyBlock(burner, s -> s.setValue(BurnerBlock.LIT, true), false); scene.idle(20); - scene.overlay.showText(80) + scene.overlay().showText(80) .attachKeyFrame() .text("Right click with empty hand to take out the remaining fuel") .placeNearTarget() - .pointAt(util.vector.centerOf(burner)); + .pointAt(util.vector().centerOf(burner)); scene.idle(100); // steam pumps - //scene.world.setKineticSpeed(util.select.position(steamPump), 64.0F); - scene.world.setKineticSpeed(util.select.fromTo(0,2,2,1,2,3), -32.0F); - scene.world.modifyBlock(engine, s -> s.setValue(SteamEngineBlock.LIT, true), false); + //scene.world().setKineticSpeed(util.select().position(steamPump), 64.0F); + scene.world().setKineticSpeed(util.select().fromTo(0,2,2,1,2,3), -32.0F); + scene.world().modifyBlock(engine, s -> s.setValue(SteamEngineBlock.LIT, true), false); scene.idle(50); // engine text - scene.overlay.showText(100) + scene.overlay().showText(100) .attachKeyFrame() .text("Steam Engines would withdraw steam from boilers") .placeNearTarget() - .pointAt(util.vector.centerOf(engine)); + .pointAt(util.vector().centerOf(engine)); scene.idle(100); } - public static void steamEngine(SceneBuilder scene, SceneBuildingUtil util, boolean flywheel) { + public static void steamEngine(SceneBuilder builder, SceneBuildingUtil util, boolean flywheel) { + CreateSceneBuilder scene = new CreateSceneBuilder(builder); scene.title(flywheel ? "flywheel" : "steam_engine", "Generating Rotational Force using the " + (flywheel ? "Flywheel" : "Steam Engine")); scene.configureBasePlate(0, 0, 6); - BlockPos cogPos = util.grid.at(1, 1, 2); - BlockPos wheelPos = util.grid.at(1, 2, 3); - BlockPos gaugePos = util.grid.at(1, 2, 1); - BlockPos enginePos = util.grid.at(3, 2, 3); - - Selection f2Select = util.select.fromTo(1, 2, 3, 3, 2, 3); - Selection b2Select=util.select.fromTo(5,1,3,5,2,3); - scene.world.showSection(util.select.layer(0), Direction.DOWN); + BlockPos cogPos = util.grid().at(1, 1, 2); + BlockPos wheelPos = util.grid().at(1, 2, 3); + BlockPos gaugePos = util.grid().at(1, 2, 1); + BlockPos enginePos = util.grid().at(3, 2, 3); + + Selection f2Select = util.select().fromTo(1, 2, 3, 3, 2, 3); + Selection b2Select=util.select().fromTo(5,1,3,5,2,3); + scene.world().showSection(util.select().layer(0), Direction.DOWN); scene.idle(10); - scene.world.showSection(util.select.fromTo(4,1,3,4,2,3), Direction.EAST); + scene.world().showSection(util.select().fromTo(4,1,3,4,2,3), Direction.EAST); scene.idle(10); - scene.world.cycleBlockProperty(util.grid.at(4, 1, 3), SteamEngineBlock.LIT); + scene.world().cycleBlockProperty(util.grid().at(4, 1, 3), SteamEngineBlock.LIT); scene.idle(10); - scene.world.showSection(util.select.fromTo(1,1,3,3,2,3), Direction.EAST); + scene.world().showSection(util.select().fromTo(1,1,3,3,2,3), Direction.EAST); scene.idle(10); - scene.world.showSection(util.select.fromTo(0,1,0,1,3,2), Direction.SOUTH); + scene.world().showSection(util.select().fromTo(0,1,0,1,3,2), Direction.SOUTH); String text = flywheel ? "Flywheels are required for generating rotational force with the Steam Engine" : "Steam Engines generate Rotational Force while Steam is provided"; - scene.overlay.showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(enginePos.west(flywheel ? 2 : 0))).text(text); + scene.overlay().showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector().topOf(enginePos.west(flywheel ? 2 : 0))).text(text); scene.idle(100); - scene.world.cycleBlockProperty(enginePos, SteamEngineBlock.LIT); - scene.world.setKineticSpeed(util.select.fromTo(0,1,0,1,3,3), -32F); - scene.overlay.showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(enginePos)).text("You can attach engines directly onto active boilers to run it at reduced stress capacity."); + scene.world().cycleBlockProperty(enginePos, SteamEngineBlock.LIT); + scene.world().setKineticSpeed(util.select().fromTo(0,1,0,1,3,3), -32F); + scene.overlay().showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector().topOf(enginePos)).text("You can attach engines directly onto active boilers to run it at reduced stress capacity."); scene.idle(100); - scene.overlay.showText(80).attachKeyFrame().placeNearTarget().colored(PonderPalette.GREEN).pointAt(util.vector.blockSurface(gaugePos, Direction.WEST)).text("The provided Rotational Force has a very large stress capacity"); + scene.overlay().showText(80).attachKeyFrame().placeNearTarget().colored(PonderPalette.GREEN).pointAt(util.vector().blockSurface(gaugePos, Direction.WEST)).text("The provided Rotational Force has a very large stress capacity"); scene.idle(100); - scene.world.hideSection(util.select.fromTo(4,1,0,6,3,6), Direction.UP); + scene.world().hideSection(util.select().fromTo(4,1,0,6,3,6), Direction.UP); scene.idle(20); - //scene.world.replaceBlocks(util.select.fromTo(0,0,0,6,4,6), Blocks.AIR.defaultBlockState(), false); - ElementLink bbsction=scene.world.showIndependentSectionImmediately(util.select.fromTo(5,3,0,5,6,5)); - scene.world.moveSection(bbsction,util.vector.of(0, -3, 0), 20); - scene.world.moveSection(scene.world.showIndependentSectionImmediately(util.select.fromTo(4,3,0,4,6,6)),util.vector.of(0, -3, 0), 20); - scene.world.moveSection(scene.world.showIndependentSectionImmediately(util.select.fromTo(3,6,0,3,6,6)),util.vector.of(0, -3, 0), 20); - scene.world.cycleBlockProperty(util.grid.at(5, 4,3), SteamEngineBlock.LIT); - //scene.world.showSection(util.select.fromTo(3,2,3,4,3,4), Direction.WEST); + //scene.world().replaceBlocks(util.select().fromTo(0,0,0,6,4,6), Blocks.AIR.defaultBlockState(), false); + ElementLink bbsction=scene.world().showIndependentSectionImmediately(util.select().fromTo(5,3,0,5,6,5)); + scene.world().moveSection(bbsction,util.vector().of(0, -3, 0), 20); + scene.world().moveSection(scene.world().showIndependentSectionImmediately(util.select().fromTo(4,3,0,4,6,6)),util.vector().of(0, -3, 0), 20); + scene.world().moveSection(scene.world().showIndependentSectionImmediately(util.select().fromTo(3,6,0,3,6,6)),util.vector().of(0, -3, 0), 20); + scene.world().cycleBlockProperty(util.grid().at(5, 4,3), SteamEngineBlock.LIT); + //scene.world().showSection(util.select().fromTo(3,2,3,4,3,4), Direction.WEST); scene.idle(40); - scene.world.setKineticSpeed(util.select.position(4,5,3), 64F); - scene.world.setKineticSpeed(util.select.fromTo(3,6,4,4,6,4), -32F); - scene.overlay.showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(enginePos)).text("You may use pumps to pump steam so that you will get max stress capacity."); + scene.world().setKineticSpeed(util.select().position(4,5,3), 64F); + scene.world().setKineticSpeed(util.select().fromTo(3,6,4,4,6,4), -32F); + scene.overlay().showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector().topOf(enginePos)).text("You may use pumps to pump steam so that you will get max stress capacity."); scene.idle(100); - scene.world.hideSection(util.select.fromTo(0,2,2,6,2,2), Direction.UP); + scene.world().hideSection(util.select().fromTo(0,2,2,6,2,2), Direction.UP); scene.idle(20); - ElementLink section=scene.world.showIndependentSectionImmediately(util.select.fromTo(0,8,2,6,8,2)); - scene.world.setKineticSpeed(util.select.fromTo(0,8,2,6,8,2), -64F); - scene.world.moveSection(section,util.vector.of(0, -6, 0), 20); + ElementLink section=scene.world().showIndependentSectionImmediately(util.select().fromTo(0,8,2,6,8,2)); + scene.world().setKineticSpeed(util.select().fromTo(0,8,2,6,8,2), -64F); + scene.world().moveSection(section,util.vector().of(0, -6, 0), 20); scene.idle(40); - scene.overlay.showText(80).attachKeyFrame().placeNearTarget().colored(PonderPalette.RED).pointAt(util.vector.topOf(1,2,2)).text("You can build a structure to make flywheels driving pumps itself."); + scene.overlay().showText(80).attachKeyFrame().placeNearTarget().colored(PonderPalette.RED).pointAt(util.vector().topOf(1,2,2)).text("You can build a structure to make flywheels driving pumps itself."); scene.idle(100); - //scene.world.moveSection(section,util.vector.of(0, 6, 0), 20); - scene.world.hideIndependentSection(section, Direction.UP); - //scene.world.hideSection(util.select.fromTo(0,8,2,6,8,2), Direction.UP); + //scene.world().moveSection(section,util.vector().of(0, 6, 0), 20); + scene.world().hideIndependentSection(section, Direction.UP); + //scene.world().hideSection(util.select().fromTo(0,8,2,6,8,2), Direction.UP); scene.idle(20); - scene.world.showSection(util.select.fromTo(0,2,2,6,2,2), Direction.UP); + scene.world().showSection(util.select().fromTo(0,2,2,6,2,2), Direction.UP); scene.idle(30); - //scene.world.replaceBlocks(util.select.fromTo(5,3,4,5,6,4),Blocks.AIR.defaultBlockState(),false); - scene.world.hideSection(f2Select, Direction.DOWN); - scene.world.hideIndependentSection(bbsction, Direction.DOWN); + //scene.world().replaceBlocks(util.select().fromTo(5,3,4,5,6,4),Blocks.AIR.defaultBlockState(),false); + scene.world().hideSection(f2Select, Direction.DOWN); + scene.world().hideIndependentSection(bbsction, Direction.DOWN); scene.idle(30); - /* scene.world.showSection(b2Select, Direction.UP); - scene.world.modifyBlock(util.grid.at(5, 1, 3),state->state.setValue(BurnerBlock.LIT,true),false); + /* scene.world().showSection(b2Select, Direction.UP); + scene.world().modifyBlock(util.grid().at(5, 1, 3),state->state.setValue(BurnerBlock.LIT,true),false); scene.idle(10); scene.idle(7); scene.idle(90); - scene.world.setKineticSpeed(util.select.fromTo(1, 1, 3, 1, 1, 1), 32.0F); + scene.world().setKineticSpeed(util.select().fromTo(1, 1, 3, 1, 1, 1), 32.0F); scene.idle(40); - scene.world.showSection(util.select.position(cogPos), Direction.SOUTH); + scene.world().showSection(util.select().position(cogPos), Direction.SOUTH); scene.idle(15); - scene.effects.rotationSpeedIndicator(cogPos); - scene.world.showSection(util.select.position(gaugePos), Direction.SOUTH); + scene.effects().rotationSpeedIndicator(cogPos); + scene.world().showSection(util.select().position(gaugePos), Direction.SOUTH); scene.idle(15); scene.idle(90); - scene.world.hideSection(f2Select, Direction.DOWN); - scene.world.hideSection(b2Select, Direction.DOWN); + scene.world().hideSection(f2Select, Direction.DOWN); + scene.world().hideSection(b2Select, Direction.DOWN); scene.idle(15);*/ - scene.world.setBlock(util.grid.at(5, 1, 3),SPBlocks.CAST_IRON_BURNER.getDefaultState().setValue(BurnerBlock.LIT,true),false); - scene.world.setBlock(util.grid.at(5, 2, 3),SPBlocks.CAST_IRON_BOILER.getDefaultState(),false); - scene.world.setBlock(enginePos, SPBlocks.CAST_IRON_STEAM_ENGINE.getDefaultState().setValue(SteamEngineBlock.FACING, Direction.WEST).setValue(SteamEngineBlock.LIT, true), false); - scene.world.setBlock(wheelPos, SPBlocks.CAST_IRON_FLYWHEEL.getDefaultState().setValue(SteamEngineBlock.FACING, Direction.SOUTH).setValue(OldFlywheelBlock.CONNECTION,OldFlywheelBlock.ConnectionState.LEFT), false); - scene.world.showSection(f2Select, Direction.DOWN); - scene.world.showSection(b2Select, Direction.DOWN); + scene.world().setBlock(util.grid().at(5, 1, 3),SPBlocks.CAST_IRON_BURNER.getDefaultState().setValue(BurnerBlock.LIT,true),false); + scene.world().setBlock(util.grid().at(5, 2, 3),SPBlocks.CAST_IRON_BOILER.getDefaultState(),false); + scene.world().setBlock(enginePos, SPBlocks.CAST_IRON_STEAM_ENGINE.getDefaultState().setValue(SteamEngineBlock.FACING, Direction.WEST).setValue(SteamEngineBlock.LIT, true), false); + scene.world().setBlock(wheelPos, SPBlocks.CAST_IRON_FLYWHEEL.getDefaultState().setValue(SteamEngineBlock.FACING, Direction.SOUTH).setValue(OldFlywheelBlock.CONNECTION,OldFlywheelBlock.ConnectionState.LEFT), false); + scene.world().showSection(f2Select, Direction.DOWN); + scene.world().showSection(b2Select, Direction.DOWN); scene.idle(30); - scene.world.setKineticSpeed(util.select.fromTo(1, 2, 3, 1, 2, 1),-SPConfig.COMMON.castIronFlywheelSpeed.get()); + scene.world().setKineticSpeed(util.select().fromTo(1, 2, 3, 1, 2, 1),-SPConfig.COMMON.castIronFlywheelSpeed.get()); scene.idle(50); - scene.world.hideSection(f2Select, Direction.DOWN); - scene.world.hideSection(b2Select, Direction.DOWN); + scene.world().hideSection(f2Select, Direction.DOWN); + scene.world().hideSection(b2Select, Direction.DOWN); scene.idle(15); - scene.world.setBlock(util.grid.at(5, 1, 3),SPBlocks.STEEL_BURNER.getDefaultState().setValue(BurnerBlock.LIT,true),false); - scene.world.setBlock(util.grid.at(5, 2, 3),SPBlocks.STEEL_BOILER.getDefaultState(),false); - scene.world.setBlock(enginePos, SPBlocks.STEEL_STEAM_ENGINE.get().defaultBlockState().setValue(SteamEngineBlock.FACING, Direction.WEST).setValue(SteamEngineBlock.LIT, true), false); - scene.world.setBlock(wheelPos, SPBlocks.STEEL_FLYWHEEL.get().defaultBlockState().setValue(SteamEngineBlock.FACING, Direction.SOUTH).setValue(OldFlywheelBlock.CONNECTION,OldFlywheelBlock.ConnectionState.LEFT), false); - scene.world.showSection(f2Select, Direction.DOWN); - scene.world.showSection(b2Select, Direction.DOWN); + scene.world().setBlock(util.grid().at(5, 1, 3),SPBlocks.STEEL_BURNER.getDefaultState().setValue(BurnerBlock.LIT,true),false); + scene.world().setBlock(util.grid().at(5, 2, 3),SPBlocks.STEEL_BOILER.getDefaultState(),false); + scene.world().setBlock(enginePos, SPBlocks.STEEL_STEAM_ENGINE.get().defaultBlockState().setValue(SteamEngineBlock.FACING, Direction.WEST).setValue(SteamEngineBlock.LIT, true), false); + scene.world().setBlock(wheelPos, SPBlocks.STEEL_FLYWHEEL.get().defaultBlockState().setValue(SteamEngineBlock.FACING, Direction.SOUTH).setValue(OldFlywheelBlock.CONNECTION,OldFlywheelBlock.ConnectionState.LEFT), false); + scene.world().showSection(f2Select, Direction.DOWN); + scene.world().showSection(b2Select, Direction.DOWN); scene.idle(30); - scene.world.setKineticSpeed(util.select.fromTo(1, 2, 3, 1, 2, 1),-SPConfig.COMMON.steelFlywheelSpeed.get()); + scene.world().setKineticSpeed(util.select().fromTo(1, 2, 3, 1, 2, 1),-SPConfig.COMMON.steelFlywheelSpeed.get()); scene.idle(5); - scene.effects.rotationSpeedIndicator(cogPos); + scene.effects().rotationSpeedIndicator(cogPos); scene.idle(5); String text3 = flywheel ? "Using Flywheels made of Steel or Cast Iron will increase efficiency and generated capacity of the Flywheel" : "Using Steam Engines made of Steel or Cast Iron will increase efficiency and generated capacity of the Flywheel"; - scene.overlay.showOutline(PonderPalette.MEDIUM,new Object(),f2Select,80); - scene.overlay.showText(80).attachKeyFrame().placeNearTarget().colored(PonderPalette.MEDIUM).pointAt(util.vector.topOf(enginePos.west())).text(text3); + scene.overlay().showOutline(PonderPalette.MEDIUM,new Object(),f2Select,80); + scene.overlay().showText(80).attachKeyFrame().placeNearTarget().colored(PonderPalette.MEDIUM).pointAt(util.vector().topOf(enginePos.west())).text(text3); scene.idle(80); String text4 = "However, power up higher level of "+(flywheel?"flywheel":"engine")+" require higher amount of steam, boiler and burner should match the level."; - scene.overlay.showText(80).placeNearTarget().colored(PonderPalette.RED).text(text4).pointAt(util.vector.topOf(5,2,3)); + scene.overlay().showText(80).placeNearTarget().colored(PonderPalette.RED).text(text4).pointAt(util.vector().topOf(5,2,3)); scene.idle(80); } - public static void dynamo(SceneBuilder scene, SceneBuildingUtil util) { + public static void dynamo(SceneBuilder builder, SceneBuildingUtil util) { + CreateSceneBuilder scene = new CreateSceneBuilder(builder); scene.title("dynamo", "Generating Electric energy using a Dynamo"); scene.configureBasePlate(1, 0, 4); - scene.world.showSection(util.select.layer(0), Direction.DOWN); + scene.world().showSection(util.select().layer(0), Direction.DOWN); scene.idle(10); - scene.world.showSection(util.select.layer(1), Direction.DOWN); + scene.world().showSection(util.select().layer(1), Direction.DOWN); scene.idle(10); - scene.world.showSection(util.select.layer(2), Direction.DOWN); + scene.world().showSection(util.select().layer(2), Direction.DOWN); scene.idle(10); - BlockPos generator = util.grid.at(3, 1, 2); - BlockPos shaft = util.grid.at(2, 1, 2); - BlockPos gauge = util.grid.at(1, 1, 2); - BlockPos cogwheel = util.grid.at(0, 1, 2); - BlockPos largecog = util.grid.at(0, 2, 3); - BlockPos redstone = util.grid.at(3, 1, 1); - BlockPos lever = util.grid.at(3, 1, 0); - - scene.world.setKineticSpeed(util.select.position(largecog), -16.0F); - scene.world.setKineticSpeed(util.select.position(cogwheel), 32.0F); - scene.world.setKineticSpeed(util.select.position(shaft), 32.0F); - scene.world.setKineticSpeed(util.select.position(gauge), 32.0F); - scene.world.setKineticSpeed(util.select.position(generator), 32.0F); + BlockPos generator = util.grid().at(3, 1, 2); + BlockPos shaft = util.grid().at(2, 1, 2); + BlockPos gauge = util.grid().at(1, 1, 2); + BlockPos cogwheel = util.grid().at(0, 1, 2); + BlockPos largecog = util.grid().at(0, 2, 3); + BlockPos redstone = util.grid().at(3, 1, 1); + BlockPos lever = util.grid().at(3, 1, 0); + + scene.world().setKineticSpeed(util.select().position(largecog), -16.0F); + scene.world().setKineticSpeed(util.select().position(cogwheel), 32.0F); + scene.world().setKineticSpeed(util.select().position(shaft), 32.0F); + scene.world().setKineticSpeed(util.select().position(gauge), 32.0F); + scene.world().setKineticSpeed(util.select().position(generator), 32.0F); scene.idle(5); - scene.overlay.showText(50) + scene.overlay().showText(50) .attachKeyFrame() .text("The Dynamo generates electric energy (fe) from rotational force") .placeNearTarget() - .pointAt(util.vector.topOf(generator)); + .pointAt(util.vector().topOf(generator)); scene.idle(60); - scene.effects.rotationSpeedIndicator(cogwheel); + scene.effects().rotationSpeedIndicator(cogwheel); scene.idle(60); - scene.overlay.showText(50) + scene.overlay().showText(50) .text("It requires at least 32 RPM to operate") .placeNearTarget() - .pointAt(util.vector.topOf(cogwheel)); + .pointAt(util.vector().topOf(cogwheel)); scene.idle(60); - scene.overlay.showText(50) + scene.overlay().showText(50) .text("The Dynamos energy production is determined by the input RPM") .placeNearTarget() - .pointAt(util.vector.topOf(generator)); + .pointAt(util.vector().topOf(generator)); scene.idle(60); - scene.overlay.showText(50) + scene.overlay().showText(50) .text("It has conversion efficiency of 75 Percent") .placeNearTarget() - .pointAt(util.vector.topOf(generator)); + .pointAt(util.vector().topOf(generator)); scene.idle(60); - scene.overlay.showText(50) + scene.overlay().showText(50) .attachKeyFrame() .text("You can lock the Dynamo with redstone signal so it will not apply stress to the network") .placeNearTarget() - .pointAt(util.vector.centerOf(lever)); + .pointAt(util.vector().centerOf(lever)); scene.idle(60); - scene.world.modifyBlock(lever, s -> s.setValue(LeverBlock.POWERED, true), false); - scene.world.modifyBlock(redstone, s -> s.setValue(RedStoneWireBlock.POWER, 15), false); - scene.world.modifyBlock(generator, s -> s.setValue(DynamoBlock.REDSTONE_LOCKED, true), false); + scene.world().modifyBlock(lever, s -> s.setValue(LeverBlock.POWERED, true), false); + scene.world().modifyBlock(redstone, s -> s.setValue(RedStoneWireBlock.POWER, 15), false); + scene.world().modifyBlock(generator, s -> s.setValue(DynamoBlock.REDSTONE_LOCKED, true), false); scene.idle(60); } } diff --git a/src/main/java/com/teammoeg/steampowered/oldcreatestuff/IGoggleInformation.java b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/IGoggleInformation.java new file mode 100644 index 0000000..2f05bd4 --- /dev/null +++ b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/IGoggleInformation.java @@ -0,0 +1,13 @@ +package com.teammoeg.steampowered.oldcreatestuff; + +import com.simibubi.create.api.equipment.goggles.IHaveGoggleInformation; +import net.minecraft.network.chat.Component; + +public interface IGoggleInformation extends IHaveGoggleInformation { + + String spacing = " "; + + + Component componentSpacing = Component.literal(spacing); + +} diff --git a/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldBlockPartials.java b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldBlockPartials.java index b6e7eca..8205abe 100644 --- a/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldBlockPartials.java +++ b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldBlockPartials.java @@ -1,9 +1,9 @@ package com.teammoeg.steampowered.oldcreatestuff; -import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.Create; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; import net.minecraft.resources.ResourceLocation; public class OldBlockPartials { - public static final PartialModel FURNACE_GENERATOR_FRAME = new PartialModel(new ResourceLocation("createold", "block/furnace_engine/frame")); + public static final PartialModel FURNACE_GENERATOR_FRAME = PartialModel.of(ResourceLocation.fromNamespaceAndPath("createold", "block/furnace_engine/frame")); } diff --git a/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldEngineBlock.java b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldEngineBlock.java index 8bdf62c..d75fedd 100644 --- a/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldEngineBlock.java +++ b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldEngineBlock.java @@ -1,8 +1,8 @@ package com.teammoeg.steampowered.oldcreatestuff; -import com.jozufozu.flywheel.core.PartialModel; import com.simibubi.create.content.equipment.wrench.IWrenchable; -import com.simibubi.create.foundation.utility.Iterate; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; +import net.createmod.catnip.data.Iterate; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionResult; diff --git a/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldFlywheelBlock.java b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldFlywheelBlock.java index a95db7a..b2ac13f 100644 --- a/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldFlywheelBlock.java +++ b/src/main/java/com/teammoeg/steampowered/oldcreatestuff/OldFlywheelBlock.java @@ -3,7 +3,7 @@ import com.simibubi.create.content.kinetics.base.HorizontalKineticBlock; import com.simibubi.create.content.kinetics.base.KineticBlockEntity; import com.simibubi.create.foundation.block.IBE; -import com.simibubi.create.foundation.utility.Lang; +import net.createmod.catnip.lang.Lang; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.util.StringRepresentable; diff --git a/src/main/java/com/teammoeg/steampowered/registrate/SPBlockEntities.java b/src/main/java/com/teammoeg/steampowered/registrate/SPBlockEntities.java index 4ef6768..6bcc1d8 100644 --- a/src/main/java/com/teammoeg/steampowered/registrate/SPBlockEntities.java +++ b/src/main/java/com/teammoeg/steampowered/registrate/SPBlockEntities.java @@ -19,7 +19,7 @@ package com.teammoeg.steampowered.registrate; import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer; -import com.simibubi.create.content.kinetics.base.SingleRotatingInstance; +import com.simibubi.create.content.kinetics.base.SingleAxisRotatingVisual; import com.teammoeg.steampowered.client.instance.BronzeFlywheelInstance; import com.teammoeg.steampowered.client.instance.CastIronFlywheelInstance; import com.teammoeg.steampowered.client.instance.SteelFlywheelInstance; @@ -95,34 +95,34 @@ public class SPBlockEntities { public static final BlockEntityEntry METAL_COGWHEEL = REGISTRATE .blockEntity("metal_cogwheel", MetalCogwheelBlockEntity::new) - .instance(() -> SingleRotatingInstance::new) + .visual(() -> SingleAxisRotatingVisual::shaft) .validBlocks(SPBlocks.STEEL_COGWHEEL, SPBlocks.STEEL_LARGE_COGWHEEL, SPBlocks.CAST_IRON_COGWHEEL, SPBlocks.CAST_IRON_LARGE_COGWHEEL, SPBlocks.BRONZE_COGWHEEL, SPBlocks.BRONZE_LARGE_COGWHEEL) .renderer(() -> KineticBlockEntityRenderer::new) .register(); public static final BlockEntityEntry DYNAMO = REGISTRATE .blockEntity("alternator", DynamoBlockEntity::new) - .instance(() -> com.teammoeg.steampowered.content.alternator.DynamoShaftInstance::new) + .visual(() -> com.teammoeg.steampowered.content.alternator.DynamoShaftInstance::new) .validBlocks(SPBlocks.DYNAMO) .register(); public static final BlockEntityEntry BRONZE_STEAM_FLYWHEEL = REGISTRATE .blockEntity("bronze_steam_flywheel", SteamFlywheelTileEntity::new) - .instance(() -> BronzeFlywheelInstance::new) + .visual(() -> BronzeFlywheelInstance::new) .validBlocks(SPBlocks.BRONZE_FLYWHEEL) .renderer(() -> BronzeFlywheelRenderer::new) .register(); public static final BlockEntityEntry CAST_IRON_STEAM_FLYWHEEL = REGISTRATE .blockEntity("cast_iron_steam_flywheel", SteamFlywheelTileEntity::new) - .instance(() -> CastIronFlywheelInstance::new) + .visual(() -> CastIronFlywheelInstance::new) .validBlocks(SPBlocks.CAST_IRON_FLYWHEEL) .renderer(() -> CastIronFlywheelRenderer::new) .register(); public static final BlockEntityEntry STEEL_STEAM_FLYWHEEL = REGISTRATE .blockEntity("steel_steam_flywheel", SteamFlywheelTileEntity::new) - .instance(() -> SteelFlywheelInstance::new) + .visual(() -> SteelFlywheelInstance::new) .validBlocks(SPBlocks.STEEL_FLYWHEEL) .renderer(() -> SteelFlywheelRenderer::new) .register(); diff --git a/src/main/java/com/teammoeg/steampowered/registrate/SPBlocks.java b/src/main/java/com/teammoeg/steampowered/registrate/SPBlocks.java index da20242..dfc1bfe 100644 --- a/src/main/java/com/teammoeg/steampowered/registrate/SPBlocks.java +++ b/src/main/java/com/teammoeg/steampowered/registrate/SPBlocks.java @@ -19,17 +19,20 @@ package com.teammoeg.steampowered.registrate; import com.simibubi.create.AllTags; -import com.simibubi.create.content.kinetics.BlockStressDefaults; +import com.simibubi.create.api.boiler.BoilerHeater; +import com.simibubi.create.api.stress.BlockStressValues; import com.simibubi.create.content.kinetics.simpleRelays.BracketedKineticBlockModel; import com.simibubi.create.content.kinetics.simpleRelays.CogwheelBlockItem; import com.simibubi.create.foundation.data.BlockStateGen; import com.simibubi.create.foundation.data.CreateRegistrate; import com.simibubi.create.foundation.data.SharedProperties; +import com.simibubi.create.infrastructure.config.CStress; import com.teammoeg.steampowered.content.alternator.DynamoBlock; import com.teammoeg.steampowered.content.boiler.BronzeBoilerBlock; import com.teammoeg.steampowered.content.boiler.CastIronBoilerBlock; import com.teammoeg.steampowered.content.boiler.SteelBoilerBlock; import com.teammoeg.steampowered.content.burner.BronzeBurnerBlock; +import com.teammoeg.steampowered.content.burner.BurnerBlockEntity; import com.teammoeg.steampowered.content.burner.CastIronBurnerBlock; import com.teammoeg.steampowered.content.burner.SteelBurnerBlock; import com.teammoeg.steampowered.content.cogwheel.MetalCogwheelBlock; @@ -125,7 +128,6 @@ public class SPBlocks { public static final BlockEntry STEEL_COGWHEEL = REGISTRATE.block("steel_cogwheel", MetalCogwheelBlock::small) .initialProperties(SPBlocks::hardMetal) .transform(pickaxeOnly()) - .transform(BlockStressDefaults.setNoImpact()) .properties(p -> p.sound(SoundType.METAL)) .blockstate(BlockStateGen.axisBlockProvider(false)) .onRegister(CreateRegistrate.blockModel(() -> BracketedKineticBlockModel::new)) @@ -136,7 +138,6 @@ public class SPBlocks { public static final BlockEntry STEEL_LARGE_COGWHEEL = REGISTRATE.block("steel_large_cogwheel", MetalCogwheelBlock::large) .initialProperties(SPBlocks::hardMetal) .transform(pickaxeOnly()) - .transform(BlockStressDefaults.setNoImpact()) .properties(p -> p.sound(SoundType.METAL)) .blockstate(BlockStateGen.axisBlockProvider(false)) .onRegister(CreateRegistrate.blockModel(() -> BracketedKineticBlockModel::new)) @@ -147,7 +148,6 @@ public class SPBlocks { public static final BlockEntry CAST_IRON_COGWHEEL = REGISTRATE.block("cast_iron_cogwheel", MetalCogwheelBlock::small) .initialProperties(SPBlocks::hardMetal) .transform(pickaxeOnly()) - .transform(BlockStressDefaults.setNoImpact()) .properties(p -> p.sound(SoundType.METAL)) .blockstate(BlockStateGen.axisBlockProvider(false)) .onRegister(CreateRegistrate.blockModel(() -> BracketedKineticBlockModel::new)) @@ -158,7 +158,6 @@ public class SPBlocks { public static final BlockEntry CAST_IRON_LARGE_COGWHEEL = REGISTRATE.block("cast_iron_large_cogwheel", MetalCogwheelBlock::large) .initialProperties(SPBlocks::hardMetal) .transform(pickaxeOnly()) - .transform(BlockStressDefaults.setNoImpact()) .properties(p -> p.sound(SoundType.METAL)) .blockstate(BlockStateGen.axisBlockProvider(false)) .onRegister(CreateRegistrate.blockModel(() -> BracketedKineticBlockModel::new)) @@ -169,7 +168,6 @@ public class SPBlocks { public static final BlockEntry BRONZE_COGWHEEL = REGISTRATE.block("bronze_cogwheel", MetalCogwheelBlock::small) .initialProperties(SharedProperties::softMetal) .transform(pickaxeOnly()) - .transform(BlockStressDefaults.setNoImpact()) .properties(p -> p.sound(SoundType.METAL)) .blockstate(BlockStateGen.axisBlockProvider(false)) .onRegister(CreateRegistrate.blockModel(() -> BracketedKineticBlockModel::new)) @@ -180,7 +178,6 @@ public class SPBlocks { public static final BlockEntry BRONZE_LARGE_COGWHEEL = REGISTRATE.block("bronze_large_cogwheel", MetalCogwheelBlock::large) .initialProperties(SharedProperties::softMetal) .transform(pickaxeOnly()) - .transform(BlockStressDefaults.setNoImpact()) .properties(p -> p.sound(SoundType.METAL)) .blockstate(BlockStateGen.axisBlockProvider(false)) .onRegister(CreateRegistrate.blockModel(() -> BracketedKineticBlockModel::new)) @@ -191,7 +188,6 @@ public class SPBlocks { public static final BlockEntry DYNAMO = REGISTRATE.block("alternator", DynamoBlock::new) .initialProperties(SPBlocks::hardMetal) .transform(pickaxeOnly()) - .transform(BlockStressDefaults.setImpact(4.0)) .tag(AllTags.AllBlockTags.SAFE_NBT.tag) //Dono what this tag means (contraption safe?). .item() .transform(customItemModel()) @@ -201,7 +197,6 @@ public class SPBlocks { .initialProperties(SharedProperties::softMetal) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) - .transform(BlockStressDefaults.setNoImpact()) .blockstate(new OldFlywheelGenerator()::generate) .item() .transform(customItemModel()) @@ -211,7 +206,6 @@ public class SPBlocks { .initialProperties(SPBlocks::hardMetal) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) - .transform(BlockStressDefaults.setNoImpact()) .blockstate(new OldFlywheelGenerator()::generate) .item() .transform(customItemModel()) @@ -221,13 +215,20 @@ public class SPBlocks { .initialProperties(SPBlocks::hardMetal) .properties(BlockBehaviour.Properties::noOcclusion) .transform(axeOrPickaxe()) - .transform(BlockStressDefaults.setNoImpact()) .blockstate(new OldFlywheelGenerator()::generate) .item() .transform(customItemModel()) .register(); public static void register() { + BoilerHeater.REGISTRY.registerProvider(SPBlocks::getHeater); + } + + public static BoilerHeater getHeater(Block block) { + if (BRONZE_BURNER.is(block) || CAST_IRON_BURNER.is(block) || STEEL_BURNER.is(block)) { + return BurnerBlockEntity::getBoilerHeat; + } + return null; } @Nonnull diff --git a/src/main/java/com/teammoeg/steampowered/registrate/SPFluids.java b/src/main/java/com/teammoeg/steampowered/registrate/SPFluids.java index 64f26f1..96ef59d 100644 --- a/src/main/java/com/teammoeg/steampowered/registrate/SPFluids.java +++ b/src/main/java/com/teammoeg/steampowered/registrate/SPFluids.java @@ -20,10 +20,10 @@ import com.simibubi.create.AllFluids; import com.simibubi.create.AllTags; -import com.simibubi.create.foundation.utility.Color; import com.teammoeg.steampowered.SPTags; import com.tterrag.registrate.builders.FluidBuilder; import com.tterrag.registrate.util.entry.FluidEntry; +import net.createmod.catnip.theme.Color; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.BlockAndTintGetter; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index bc3c0f8..8bde682 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -34,13 +34,13 @@ MRH0, SpottyTheTurtle, jetpacker06, and all Contributors on GitHub. [[dependencies.steampowered]] modId="create" mandatory=true - versionRange="[0.5.1.f,)" + versionRange="[6.0.0,)" ordering="NONE" side="BOTH" [[dependencies.steampowered]] modId="flywheel" mandatory=true - versionRange="[0.6.10,)" + versionRange="[1.0.0,)" ordering="AFTER" side="CLIENT"