mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
parent
16582e6d25
commit
3ae1246ec6
2 changed files with 20 additions and 16 deletions
|
@ -42,22 +42,26 @@ public class PacketClient implements CustomPacketPayload {
|
||||||
return PacketClient.ID;
|
return PacketClient.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("Convert2Lambda")
|
||||||
public static void onMessage(PacketClient message, PlayPayloadContext ctx) {
|
public static void onMessage(PacketClient message, PlayPayloadContext ctx) {
|
||||||
ctx.workHandler().execute(() -> {
|
ctx.workHandler().execute(new Runnable() {
|
||||||
var mc = Minecraft.getInstance();
|
@Override
|
||||||
if (mc.level != null) {
|
public void run() {
|
||||||
switch (message.type) {
|
var mc = Minecraft.getInstance();
|
||||||
case 0: // dimension rail visualization
|
if (mc.level != null) {
|
||||||
var goalDim = new ResourceLocation(message.data.getString("dim"));
|
switch (message.type) {
|
||||||
var goalPos = BlockPos.of(message.data.getLong("pos"));
|
case 0: // dimension rail visualization
|
||||||
ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, goalDim, goalPos);
|
var goalDim = new ResourceLocation(message.data.getString("dim"));
|
||||||
case 1:
|
var goalPos = BlockPos.of(message.data.getLong("pos"));
|
||||||
var entity = mc.level.getEntity(message.data.getInt("id"));
|
ItemRangeVisualizer.visualize(mc.player, ItemRangeVisualizer.VISUALIZED_RAILS, goalDim, goalPos);
|
||||||
mc.particleEngine.createTrackingEmitter(entity, ParticleTypes.TOTEM_OF_UNDYING, 30);
|
case 1:
|
||||||
mc.level.playLocalSound(entity.getX(), entity.getY(), entity.getZ(), SoundEvents.TOTEM_USE, entity.getSoundSource(), 1.0F, 1.0F, false);
|
var entity = mc.level.getEntity(message.data.getInt("id"));
|
||||||
if (entity == mc.player) {
|
mc.particleEngine.createTrackingEmitter(entity, ParticleTypes.TOTEM_OF_UNDYING, 30);
|
||||||
mc.gameRenderer.displayItemActivation(new ItemStack(ModItems.DEATH_RING));
|
mc.level.playLocalSound(entity.getX(), entity.getY(), entity.getZ(), SoundEvents.TOTEM_USE, entity.getSoundSource(), 1.0F, 1.0F, false);
|
||||||
}
|
if (entity == mc.player) {
|
||||||
|
mc.gameRenderer.displayItemActivation(new ItemStack(ModItems.DEATH_RING));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class PacketParticles implements CustomPacketPayload {
|
||||||
|
|
||||||
public static void onMessage(PacketParticles message, PlayPayloadContext ctx) {
|
public static void onMessage(PacketParticles message, PlayPayloadContext ctx) {
|
||||||
ctx.workHandler().execute(() -> {
|
ctx.workHandler().execute(() -> {
|
||||||
Level level = Minecraft.getInstance().level;
|
var level = ctx.level().orElseThrow();
|
||||||
if (level != null)
|
if (level != null)
|
||||||
message.type.action.accept(message, level);
|
message.type.action.accept(message, level);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue