Public Access
This commit is contained in:
1 parent
a9390c3e4c
commit
0de817b28a
3 files changed
+17
-2
No files matched your search
@@ -18,6 +18,7 @@ import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
@@ -160,10 +161,21 @@ public final class ModNetworking {
|
||||
pos.subtract(origin).offset(negativeRadius, negativeRadius, negativeRadius), state));
|
||||
}
|
||||
}
|
||||
int skyColor = level.getBiome(origin).value().getSkyColor();
|
||||
int skyColor = previewSkyColor(level, origin);
|
||||
PacketDistributor.sendToPlayer(player, new LinkPreviewPayload(skyColor, List.copyOf(blocks)));
|
||||
}
|
||||
|
||||
/** Vanilla Nether and End renderers do not use their biomes' blue Overworld sky tint. */
|
||||
private static int previewSkyColor(ServerLevel level, BlockPos origin) {
|
||||
if (level.dimension().equals(Level.NETHER)) {
|
||||
return 0xFF6B2725;
|
||||
}
|
||||
if (level.dimension().equals(Level.END)) {
|
||||
return 0xFF211835;
|
||||
}
|
||||
return level.getBiome(origin).value().getSkyColor();
|
||||
}
|
||||
|
||||
private static InteractionHand hand(boolean offhand) {
|
||||
return offhand ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user