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 {
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.+
shadow_version = 7.1.0
cursegradle_version = 1.4.0
parchment_version = 2021.12.19
parchment_version = 2022.01.23
# dependency versions
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_version = 9.2.1.69

View file

@ -12,6 +12,6 @@ public class BackHalfShaftInstance extends HalfShaftInstance {
@Override
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.BlockHitResult;
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.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
@ -379,6 +381,7 @@ public class DeployerTileEntity extends KineticTileEntity {
sendData();
}
@OnlyIn(Dist.CLIENT)
public PartialModel getHandPose() {
return mode == Mode.PUNCH ? AllBlockPartials.DEPLOYER_HAND_PUNCHING
: heldItem.isEmpty() ? AllBlockPartials.DEPLOYER_HAND_POINTING : AllBlockPartials.DEPLOYER_HAND_HOLDING;
@ -424,6 +427,7 @@ public class DeployerTileEntity extends KineticTileEntity {
return true;
}
@OnlyIn(Dist.CLIENT)
public float getHandOffset(float partialTicks) {
if (isVirtual())
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.phys.shapes.CollisionContext;
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.eventbus.api.Event.Result;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -42,6 +44,7 @@ public class FurnaceEngineBlock extends EngineBlock implements ITE<FurnaceEngine
}
@Override
@OnlyIn(Dist.CLIENT)
public PartialModel getFrameModel() {
return AllBlockPartials.FURNACE_GENERATOR_FRAME;
}

View file

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

View file

@ -16,6 +16,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class ClockworkContraption extends Contraption {
@ -131,6 +133,7 @@ public class ClockworkContraption extends Contraption {
}
@Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() {
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.Vector3f;
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.render.ActorInstance;
import com.simibubi.create.foundation.render.AllMaterialSpecs;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.core.Direction;
@ -18,6 +20,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
public class StabilizedBearingInstance extends ActorInstance {
final OrientedData topInstance;
final RotatingData shaft;
final Direction facing;
final Vector3f rotationAxis;
@ -35,11 +38,22 @@ public class StabilizedBearingInstance extends ActorInstance {
topInstance = materialManager.defaultSolid()
.material(Materials.ORIENTED)
.getModel(AllBlockPartials.BEARING_TOP, blockState).createInstance();
.getModel(AllBlockPartials.BEARING_TOP, blockState)
.createInstance();
int blockLight = localBlockLight();
topInstance.setPosition(context.localPos)
.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

View file

@ -10,6 +10,8 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class StabilizedContraption extends Contraption {
@ -65,6 +67,7 @@ public class StabilizedContraption extends Contraption {
}
@Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() {
return new NonStationaryLighter<>(this);
}

View file

@ -12,6 +12,8 @@ import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level;
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 {
@ -64,6 +66,7 @@ public class GantryContraption extends TranslatingContraption {
}
@Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() {
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.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo;
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.wrapper.InvWrapper;
@ -163,6 +165,7 @@ public class MountedContraption extends Contraption {
}
@Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() {
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.nbt.CompoundTag;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PulleyContraption extends TranslatingContraption {
@ -56,6 +58,7 @@ public class PulleyContraption extends TranslatingContraption {
}
@Override
@OnlyIn(Dist.CLIENT)
public ContraptionLighter<?> makeLighter() {
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.block.entity.BlockEntityType;
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 {
@ -48,6 +50,7 @@ public abstract class AbstractBellTileEntity extends SmartTileEntity {
}
}
@OnlyIn(Dist.CLIENT)
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.block.entity.BlockEntityType;
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 {
@ -28,6 +30,7 @@ public class HauntedBellTileEntity extends AbstractBellTileEntity {
}
@Override
@OnlyIn(Dist.CLIENT)
public PartialModel getBellModel() {
return AllBlockPartials.HAUNTED_BELL;
}

View file

@ -6,6 +6,8 @@ import com.simibubi.create.AllBlockPartials;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntityType;
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 {
@ -14,6 +16,7 @@ public class PeculiarBellTileEntity extends AbstractBellTileEntity {
}
@Override
@OnlyIn(Dist.CLIENT)
public PartialModel getBellModel() {
return AllBlockPartials.PECULIAR_BELL;
}

View file

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

View file

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

View file

@ -16,6 +16,8 @@ import net.minecraft.network.chat.Component;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class PlaneMirror extends SymmetryMirror {
@ -83,6 +85,7 @@ public class PlaneMirror extends SymmetryMirror {
}
@Override
@OnlyIn(Dist.CLIENT)
public PartialModel getModel() {
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.Property;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class SymmetryMirror {
@ -80,6 +82,7 @@ public abstract class SymmetryMirror {
public abstract String typeName();
@OnlyIn(Dist.CLIENT)
public abstract PartialModel getModel();
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.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public class TriplePlaneMirror extends SymmetryMirror {
@ -44,6 +46,7 @@ public class TriplePlaneMirror extends SymmetryMirror {
}
@Override
@OnlyIn(Dist.CLIENT)
public PartialModel getModel() {
return AllBlockPartials.SYMMETRY_TRIPLEPLANE;
}

View file

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