diff options
Diffstat (limited to 'src/main/java/net/cshift/mc/sparkt/block/entity/WireEntity.java')
-rw-r--r-- | src/main/java/net/cshift/mc/sparkt/block/entity/WireEntity.java | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/src/main/java/net/cshift/mc/sparkt/block/entity/WireEntity.java b/src/main/java/net/cshift/mc/sparkt/block/entity/WireEntity.java new file mode 100644 index 0000000..208a84f --- /dev/null +++ b/src/main/java/net/cshift/mc/sparkt/block/entity/WireEntity.java @@ -0,0 +1,82 @@ +package net.cshift.mc.sparkt.block.entity; + +import net.cshift.mc.sparkt.netcode.payload.DeliveryPayload; +import net.cshift.mc.transit.network.*; +import net.cshift.mc.transit.network.packet.IStaticPacket; +import net.fabricmc.fabric.api.networking.v1.PlayerLookup; +import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BlockEntity; +import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +public class WireEntity extends BlockEntity implements INode { + public static final int COOLDOWN = 40; + private int ticks = COOLDOWN; + + + public WireEntity(BlockPos pos, BlockState state) { + super(BlockEntityTypes.WIRE_ENTITY, pos, state); + + } + + @Override + public <T> IStaticPacket<T> accept(IStaticPacket<T> arg0, Channel<T> arg1) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'accept'"); + } + + @Override + public <T> Channel<T> connect(int arg0, String arg1, INode arg2) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'connect'"); + } + + @Override + public <T> Channel<T> connectDefault(String arg0, INode arg1) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'connectDefault'"); + } + + @Override + public PoolManifest getManifest() { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getManifest'"); + } + + @Override + public <T> Number getPressure(Channel<T> arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getPressure'"); + } + + @Override + public <T> Number getRate(Channel<T> arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'getRate'"); + } + + @Override + public <T> void onTerminate(Channel<T> arg0) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'onTerminate'"); + } + + public static void tick(World world, BlockPos pos, BlockState state, WireEntity blockEntity) { + if (world.isClient) + return; + + blockEntity.ticks--; + + if (blockEntity.ticks > 0) + return; + + for (ServerPlayerEntity player : PlayerLookup.world((ServerWorld) world)) + ServerPlayNetworking.send(player, new DeliveryPayload("lmao")); + + blockEntity.ticks = COOLDOWN; + } + +} |