Client only flywheel

- Mark off everything using PartialModel or ContraptionLighter as client-only
 - Likely needs more testing
This commit is contained in:
Jozufozu 2022-01-24 13:41:34 -08:00
parent 3a8a0fa9e1
commit 746d9867db
21 changed files with 74 additions and 19 deletions

View file

@ -73,12 +73,6 @@ minecraft {
create { create {
source sourceSets.main source sourceSets.main
} }
if (inWorkspace) {
flywheel {
source project(":Flywheel").sourceSets.main
}
}
} }
} }

View file

@ -15,11 +15,11 @@ mixin_version = 0.8.5
librarian_version = 1.+ librarian_version = 1.+
shadow_version = 7.1.0 shadow_version = 7.1.0
cursegradle_version = 1.4.0 cursegradle_version = 1.4.0
parchment_version = 2021.12.19 parchment_version = 2022.01.23
# dependency versions # dependency versions
registrate_version = MC1.18-1.0.21 registrate_version = MC1.18-1.0.21
flywheel_version = 1.18-0.6.0.48 flywheel_version = 1.18-0.6.0.50
jei_minecraft_version = 1.18.1 jei_minecraft_version = 1.18.1
jei_version = 9.2.1.69 jei_version = 9.2.1.69

View file

@ -12,6 +12,6 @@ public class BackHalfShaftInstance extends HalfShaftInstance {
@Override @Override
protected Direction getShaftDirection() { protected Direction getShaftDirection() {
return blockEntity.getBlockState().getValue(BlockStateProperties.FACING).getOpposite(); return blockState.getValue(BlockStateProperties.FACING).getOpposite();
} }
} }

View file

@ -48,6 +48,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
@ -379,6 +381,7 @@ public class DeployerTileEntity extends KineticTileEntity {
sendData(); sendData();
} }
@OnlyIn(Dist.CLIENT)
public PartialModel getHandPose() { public PartialModel getHandPose() {
return mode == Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING return mode == Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING
: heldItem.isEmpty() ? AllBlockPartials.DEPLOYER_HAND_POINTING : AllBlockPartials.DEPLOYER_HAND_HOLDING; : heldItem.isEmpty() ? AllBlockPartials.DEPLOYER_HAND_POINTING : AllBlockPartials.DEPLOYER_HAND_HOLDING;
@ -424,6 +427,7 @@ public class DeployerTileEntity extends KineticTileEntity {
return true; return true;
} }
@OnlyIn(Dist.CLIENT)
public float getHandOffset(float partialTicks) { public float getHandOffset(float partialTicks) {
if (isVirtual()) if (isVirtual())
return animatedOffset.getValue(partialTicks); return animatedOffset.getValue(partialTicks);

View file

@ -19,6 +19,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock;
import net.minecraftforge.eventbus.api.Event.Result; import net.minecraftforge.eventbus.api.Event.Result;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -42,6 +44,7 @@ public class FurnaceEngineBlock extends EngineBlock implements ITE<FurnaceEngine
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public PartialModel getFrameModel() { public PartialModel getFrameModel() {
return AllBlockPartials.FURNACE_GENERATOR_FRAME; return AllBlockPartials.FURNACE_GENERATOR_FRAME;
} }

View file

@ -1247,6 +1247,7 @@ public abstract class Contraption {
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() { public ContraptionLighter<?> makeLighter() {
// TODO: move lighters to registry
return new EmptyLighter(this); return new EmptyLighter(this);
} }

View file

@ -16,6 +16,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class ClockworkContraption extends Contraption { public class ClockworkContraption extends Contraption {
@ -81,7 +83,7 @@ public class ClockworkContraption extends Contraption {
} }
return Pair.of(hourArm, minuteArm); return Pair.of(hourArm, minuteArm);
} }
@Override @Override
public boolean assemble(Level world, BlockPos pos) throws AssemblyException { public boolean assemble(Level world, BlockPos pos) throws AssemblyException {
return searchMovedStructure(world, pos, facing); return searchMovedStructure(world, pos, facing);
@ -125,12 +127,13 @@ public class ClockworkContraption extends Contraption {
return false; return false;
return facing.getAxis() == this.facing.getAxis(); return facing.getAxis() == this.facing.getAxis();
} }
public static enum HandType { public static enum HandType {
HOUR, MINUTE HOUR, MINUTE
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() { public ContraptionLighter<?> makeLighter() {
return new AnchoredLighter(this); return new AnchoredLighter(this);
} }

View file

@ -7,8 +7,10 @@ import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.mojang.math.Quaternion; import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.contraptions.base.flwdata.RotatingData;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance;
import com.simibubi.create.foundation.render.AllMaterialSpecs;
import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
@ -18,6 +20,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
public class StabilizedBearingInstance extends ActorInstance { public class StabilizedBearingInstance extends ActorInstance {
final OrientedData topInstance; final OrientedData topInstance;
final RotatingData shaft;
final Direction facing; final Direction facing;
final Vector3f rotationAxis; final Vector3f rotationAxis;
@ -35,11 +38,22 @@ public class StabilizedBearingInstance extends ActorInstance {
topInstance = materialManager.defaultSolid() topInstance = materialManager.defaultSolid()
.material(Materials.ORIENTED) .material(Materials.ORIENTED)
.getModel(AllBlockPartials.BEARING_TOP, blockState).createInstance(); .getModel(AllBlockPartials.BEARING_TOP, blockState)
.createInstance();
int blockLight = localBlockLight();
topInstance.setPosition(context.localPos) topInstance.setPosition(context.localPos)
.setRotation(blockOrientation) .setRotation(blockOrientation)
.setBlockLight(localBlockLight()); .setBlockLight(blockLight);
shaft = materialManager.defaultSolid()
.material(AllMaterialSpecs.ROTATING)
.getModel(AllBlockPartials.SHAFT_HALF, blockState, blockState.getValue(BlockStateProperties.FACING).getOpposite())
.createInstance();
// not rotating so no need to set speed, axis, etc.
shaft.setPosition(context.localPos)
.setBlockLight(blockLight);
} }
@Override @Override

View file

@ -10,6 +10,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class StabilizedContraption extends Contraption { public class StabilizedContraption extends Contraption {
@ -41,7 +43,7 @@ public class StabilizedContraption extends Contraption {
protected ContraptionType getType() { protected ContraptionType getType() {
return ContraptionType.STABILIZED; return ContraptionType.STABILIZED;
} }
@Override @Override
public CompoundTag writeNBT(boolean spawnPacket) { public CompoundTag writeNBT(boolean spawnPacket) {
CompoundTag tag = super.writeNBT(spawnPacket); CompoundTag tag = super.writeNBT(spawnPacket);
@ -54,17 +56,18 @@ public class StabilizedContraption extends Contraption {
facing = Direction.from3DDataValue(tag.getInt("Facing")); facing = Direction.from3DDataValue(tag.getInt("Facing"));
super.readNBT(world, tag, spawnData); super.readNBT(world, tag, spawnData);
} }
@Override @Override
public boolean canBeStabilized(Direction facing, BlockPos localPos) { public boolean canBeStabilized(Direction facing, BlockPos localPos) {
return false; return false;
} }
public Direction getFacing() { public Direction getFacing() {
return facing; return facing;
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() { public ContraptionLighter<?> makeLighter() {
return new NonStationaryLighter<>(this); return new NonStationaryLighter<>(this);
} }

View file

@ -12,6 +12,8 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class GantryContraption extends TranslatingContraption { public class GantryContraption extends TranslatingContraption {
@ -64,6 +66,7 @@ public class GantryContraption extends TranslatingContraption {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() { public ContraptionLighter<?> makeLighter() {
return new NonStationaryLighter<>(this); return new NonStationaryLighter<>(this);
} }

View file

@ -32,6 +32,8 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.RailShape; import net.minecraft.world.level.block.state.properties.RailShape;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.InvWrapper; import net.minecraftforge.items.wrapper.InvWrapper;
@ -163,6 +165,7 @@ public class MountedContraption extends Contraption {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() { public ContraptionLighter<?> makeLighter() {
return new NonStationaryLighter<>(this); return new NonStationaryLighter<>(this);
} }

View file

@ -8,6 +8,8 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Tra
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PulleyContraption extends TranslatingContraption { public class PulleyContraption extends TranslatingContraption {
@ -56,6 +58,7 @@ public class PulleyContraption extends TranslatingContraption {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() { public ContraptionLighter<?> makeLighter() {
return new PulleyLighter(this); return new PulleyLighter(this);
} }

View file

@ -11,6 +11,8 @@ import net.minecraft.core.Direction;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class AbstractBellTileEntity extends SmartTileEntity { public abstract class AbstractBellTileEntity extends SmartTileEntity {
@ -48,6 +50,7 @@ public abstract class AbstractBellTileEntity extends SmartTileEntity {
} }
} }
@OnlyIn(Dist.CLIENT)
public abstract PartialModel getBellModel(); public abstract PartialModel getBellModel();
} }

View file

@ -14,6 +14,8 @@ import net.minecraft.sounds.SoundSource;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class HauntedBellTileEntity extends AbstractBellTileEntity { public class HauntedBellTileEntity extends AbstractBellTileEntity {
@ -28,6 +30,7 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public PartialModel getBellModel() { public PartialModel getBellModel() {
return AllBlockPartials.HAUNTED_BELL; return AllBlockPartials.HAUNTED_BELL;
} }

View file

@ -6,6 +6,8 @@ import com.simibubi.create.AllBlockPartials;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PeculiarBellTileEntity extends AbstractBellTileEntity { public class PeculiarBellTileEntity extends AbstractBellTileEntity {
@ -14,6 +16,7 @@ public class PeculiarBellTileEntity extends AbstractBellTileEntity {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public PartialModel getBellModel() { public PartialModel getBellModel() {
return AllBlockPartials.PECULIAR_BELL; return AllBlockPartials.PECULIAR_BELL;
} }

View file

@ -16,6 +16,8 @@ import net.minecraft.network.chat.Component;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class CrossPlaneMirror extends SymmetryMirror { public class CrossPlaneMirror extends SymmetryMirror {
@ -87,6 +89,7 @@ public class CrossPlaneMirror extends SymmetryMirror {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public PartialModel getModel() { public PartialModel getModel() {
return AllBlockPartials.SYMMETRY_CROSSPLANE; return AllBlockPartials.SYMMETRY_CROSSPLANE;
} }

View file

@ -12,6 +12,8 @@ import net.minecraft.network.chat.Component;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class EmptyMirror extends SymmetryMirror { public class EmptyMirror extends SymmetryMirror {
@ -50,6 +52,7 @@ public class EmptyMirror extends SymmetryMirror {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public PartialModel getModel() { public PartialModel getModel() {
return null; return null;
} }

View file

@ -16,6 +16,8 @@ import net.minecraft.network.chat.Component;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PlaneMirror extends SymmetryMirror { public class PlaneMirror extends SymmetryMirror {
@ -83,6 +85,7 @@ public class PlaneMirror extends SymmetryMirror {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public PartialModel getModel() { public PartialModel getModel() {
return AllBlockPartials.SYMMETRY_PLANE; return AllBlockPartials.SYMMETRY_PLANE;
} }

View file

@ -23,6 +23,8 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class SymmetryMirror { public abstract class SymmetryMirror {
@ -80,6 +82,7 @@ public abstract class SymmetryMirror {
public abstract String typeName(); public abstract String typeName();
@OnlyIn(Dist.CLIENT)
public abstract PartialModel getModel(); public abstract PartialModel getModel();
public void applyModelTransform(PoseStack ms) {} public void applyModelTransform(PoseStack ms) {}

View file

@ -14,6 +14,8 @@ import net.minecraft.network.chat.Component;
import net.minecraft.util.StringRepresentable; import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class TriplePlaneMirror extends SymmetryMirror { public class TriplePlaneMirror extends SymmetryMirror {
@ -44,6 +46,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
} }
@Override @Override
@OnlyIn(Dist.CLIENT)
public PartialModel getModel() { public PartialModel getModel() {
return AllBlockPartials.SYMMETRY_TRIPLEPLANE; return AllBlockPartials.SYMMETRY_TRIPLEPLANE;
} }

View file

@ -18,14 +18,14 @@ Technology that empowers the player.'''
[[dependencies.create]] [[dependencies.create]]
modId="forge" modId="forge"
mandatory=true mandatory=true
versionRange="[38.0.46,)" versionRange="[39.0.46,)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
[[dependencies.create]] [[dependencies.create]]
modId="minecraft" modId="minecraft"
mandatory=true mandatory=true
versionRange="[1.18,1.19)" versionRange="[1.18.1,1.19)"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
@ -34,4 +34,4 @@ Technology that empowers the player.'''
mandatory=true mandatory=true
versionRange="[1.18-0.6.0,1.18-0.6.1)" versionRange="[1.18-0.6.0,1.18-0.6.1)"
ordering="AFTER" ordering="AFTER"
side="BOTH" side="CLIENT"