use of com.simibubi.create.content.contraptions.particle.RotationIndicatorParticleData in project Create by Creators-of-Create.
the class KineticEffectHandler method spawnRotationIndicators.
public void spawnRotationIndicators() {
float speed = kte.getSpeed();
if (speed == 0)
return;
BlockState state = kte.getBlockState();
Block block = state.getBlock();
if (!(block instanceof KineticBlock))
return;
KineticBlock kb = (KineticBlock) block;
float radius1 = kb.getParticleInitialRadius();
float radius2 = kb.getParticleTargetRadius();
Axis axis = kb.getRotationAxis(state);
BlockPos pos = kte.getBlockPos();
Level world = kte.getLevel();
if (axis == null)
return;
if (world == null)
return;
char axisChar = axis.name().charAt(0);
Vec3 vec = VecHelper.getCenterOf(pos);
SpeedLevel speedLevel = SpeedLevel.of(speed);
int color = speedLevel.getColor();
int particleSpeed = speedLevel.getParticleSpeed();
particleSpeed *= Math.signum(speed);
if (world instanceof ServerLevel) {
AllTriggers.triggerForNearbyPlayers(AllTriggers.ROTATION, world, pos, 5);
RotationIndicatorParticleData particleData = new RotationIndicatorParticleData(color, particleSpeed, radius1, radius2, 10, axisChar);
((ServerLevel) world).sendParticles(particleData, vec.x, vec.y, vec.z, 20, 0, 0, 0, 1);
}
}
use of com.simibubi.create.content.contraptions.particle.RotationIndicatorParticleData in project Create by Creators-of-Create.
the class DebugScenes method particleScene.
public static void particleScene(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("debug_particles", "Emitting particles");
scene.showBasePlate();
scene.idle(10);
scene.world.showSection(util.select.layersFrom(1), Direction.DOWN);
scene.idle(10);
Vec3 emitterPos = util.vector.of(2.5, 2.25, 2.5);
Emitter emitter = Emitter.simple(ParticleTypes.LAVA, util.vector.of(0, .1, 0));
Emitter rotation = Emitter.simple(new RotationIndicatorParticleData(SpeedLevel.MEDIUM.getColor(), 12, 1, 1, 20, 'Y'), util.vector.of(0, .1, 0));
scene.overlay.showText(20).text("Incoming...").pointAt(emitterPos);
scene.idle(30);
scene.effects.emitParticles(emitterPos, emitter, 1, 60);
scene.effects.emitParticles(emitterPos, rotation, 20, 1);
scene.idle(30);
scene.rotateCameraY(180);
}
Aggregations