use of com.mraof.minestuck.network.MinestuckPacket in project Minestuck by mraof.
the class GuiTransportalizer method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
if (button.id == 0 && this.destinationTextField.getText().length() == 4) {
// Debug.print("Sending transportalizer packet with destination of " + this.destinationTextField.getText());
MinestuckPacket packet = new TransportalizerPacket();
packet.generatePacket(te.getPos().getX(), te.getPos().getY(), te.getPos().getZ(), this.destinationTextField.getText().toUpperCase());
MinestuckChannelHandler.sendToServer(packet);
this.mc.displayGuiScreen((GuiScreen) null);
}
}
use of com.mraof.minestuck.network.MinestuckPacket in project Minestuck by mraof.
the class HashmapGuiHandler method updateContent.
@Override
public void updateContent() {
NonNullList<ItemStack> stacks = modus.getItems();
this.cards.clear();
this.maxWidth = Math.max(mapWidth, 10 + (stacks.size() * CARD_WIDTH + (stacks.size() - 1) * 5));
this.maxHeight = mapHeight;
super.updateContent();
int start = Math.max(5, (mapWidth - (stacks.size() * CARD_WIDTH + (stacks.size() - 1) * 5)) / 2);
for (int i = 0; i < stacks.size(); i++) this.cards.add(new GuiCard(stacks.get(i), this, i, start + i * (CARD_WIDTH + 5), (mapHeight - CARD_HEIGHT) / 2) {
@Override
public void onClick(int mouseButton) {
if (this.item == null && mouseButton == 1) {
MinestuckPacket packet = MinestuckPacket.makePacket(Type.CAPTCHA, CaptchaDeckPacket.GET, this.index, true);
MinestuckChannelHandler.sendToServer(packet);
} else
super.onClick(mouseButton);
}
});
}
use of com.mraof.minestuck.network.MinestuckPacket in project Minestuck by mraof.
the class ConnectionListener method onServerConnectionCreated.
@SubscribeEvent
public void onServerConnectionCreated(FMLNetworkEvent.ServerConnectionFromClientEvent event) {
MinestuckPacket packet = MinestuckPacket.makePacket(Type.LANDREGISTER);
MinestuckChannelHandler.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.DISPATCHER);
MinestuckChannelHandler.channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(event.getManager().channel().attr(NetworkDispatcher.FML_DISPATCHER).get());
MinestuckChannelHandler.channels.get(Side.SERVER).writeOutbound(packet);
}
use of com.mraof.minestuck.network.MinestuckPacket in project Minestuck by mraof.
the class MinestuckPlayerTracker method updateEcheladder.
public static void updateEcheladder(EntityPlayer player, boolean jump) {
Echeladder echeladder = MinestuckPlayerData.getData(player).echeladder;
MinestuckPacket packet = MinestuckPacket.makePacket(Type.PLAYER_DATA, PlayerDataPacket.ECHELADDER, echeladder.getRung(), MinestuckConfig.echeladderProgress ? echeladder.getProgress() : 0F, jump);
MinestuckChannelHandler.sendToPlayer(packet, player);
}
use of com.mraof.minestuck.network.MinestuckPacket in project Minestuck by mraof.
the class MinestuckPlayerTracker method updateGristCache.
/**
* Uses an "encoded" username as parameter.
*/
public static void updateGristCache(PlayerIdentifier player) {
GristSet gristSet = MinestuckPlayerData.getGristSet(player);
// The player
EntityPlayerMP playerMP = player.getPlayer();
if (playerMP != null) {
MinestuckPacket packet = MinestuckPacket.makePacket(Type.GRISTCACHE, gristSet, false);
MinestuckChannelHandler.sendToPlayer(packet, playerMP);
}
// The editing player, if there is any.
SburbConnection c = SkaianetHandler.getClientConnection(player);
if (c != null && ServerEditHandler.getData(c) != null) {
EntityPlayerMP editor = ServerEditHandler.getData(c).getEditor();
MinestuckPacket packet = MinestuckPacket.makePacket(Type.GRISTCACHE, gristSet, true);
MinestuckChannelHandler.sendToPlayer(packet, editor);
}
}
Aggregations