use of com.simibubi.create.content.contraptions.base.flwdata.RotatingData in project Create by Creators-of-Create.
the class EncasedCogInstance method init.
@Override
public void init() {
rotatingModel = setup(getCogModel().createInstance());
Block block = blockState.getBlock();
if (!(block instanceof IRotate))
return;
IRotate def = (IRotate) block;
rotatingTopShaft = Optional.empty();
rotatingBottomShaft = Optional.empty();
for (Direction d : Iterate.directionsInAxis(axis)) {
if (!def.hasShaftTowards(blockEntity.getLevel(), blockEntity.getBlockPos(), blockState, d))
continue;
RotatingData data = setup(getRotatingMaterial().getModel(AllBlockPartials.SHAFT_HALF, blockState, d).createInstance());
if (d.getAxisDirection() == AxisDirection.POSITIVE)
rotatingTopShaft = Optional.of(data);
else
rotatingBottomShaft = Optional.of(data);
}
}
use of com.simibubi.create.content.contraptions.base.flwdata.RotatingData in project Create by Creators-of-Create.
the class GearboxInstance method update.
@Override
public void update() {
updateSourceFacing();
for (Map.Entry<Direction, RotatingData> key : keys.entrySet()) {
Direction direction = key.getKey();
Direction.Axis axis = direction.getAxis();
updateRotation(key.getValue(), axis, getSpeed(direction));
}
}
use of com.simibubi.create.content.contraptions.base.flwdata.RotatingData in project Create by Creators-of-Create.
the class BracketedKineticTileInstance method init.
@Override
public void init() {
super.init();
if (!ICogWheel.isLargeCog(blockEntity.getBlockState()))
return;
// Large cogs sometimes have to offset their teeth by 11.25 degrees in order to
// mesh properly
float speed = blockEntity.getSpeed();
Axis axis = KineticTileEntityRenderer.getRotationAxisOf(blockEntity);
BlockPos pos = blockEntity.getBlockPos();
float offset = BracketedKineticTileRenderer.getShaftAngleOffset(axis, pos);
Direction facing = Direction.fromAxisAndDirection(axis, AxisDirection.POSITIVE);
Instancer<RotatingData> half = getRotatingMaterial().getModel(AllBlockPartials.COGWHEEL_SHAFT, blockState, facing, () -> this.rotateToAxis(axis));
additionalShaft = setup(half.createInstance(), speed);
additionalShaft.setRotationOffset(offset);
}
Aggregations