mirror of
https://github.com/XevianLight/Aphelion.git
synced 2026-05-11 01:50:56 +01:00
added gravity test block with gui and debug renderer
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package net.xevianlight.aphelion.network;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
import net.xevianlight.aphelion.block.entity.custom.GravityTestBlockEntity;
|
||||
import net.xevianlight.aphelion.network.packet.UpdateGravityTestBlockPacket;
|
||||
|
||||
public class UpdateGravityTestBlockHandler {
|
||||
public static void handleDataOnMain(UpdateGravityTestBlockPacket packet, IPayloadContext context) {
|
||||
context.enqueueWork(() -> {
|
||||
BlockPos pos = packet.pos();
|
||||
float radius = packet.radius();
|
||||
float strength = packet.strength();
|
||||
|
||||
Level level = context.player().level();
|
||||
if (level.getBlockEntity(pos) instanceof GravityTestBlockEntity blockEntity) {
|
||||
blockEntity.setRadius(radius);
|
||||
blockEntity.setStrength(strength);
|
||||
blockEntity.sendUpdate();
|
||||
level.sendBlockUpdated(pos, level.getBlockState(pos), level.getBlockState(pos), Block.UPDATE_ALL);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user