Advertisement
TNT_Block

Force-Op Sign

Apr 17th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. package net.minecraft.network.play.client;
  2.  
  3. import java.io.IOException;
  4. import net.minecraft.network.INetHandler;
  5. import net.minecraft.network.Packet;
  6. import net.minecraft.network.PacketBuffer;
  7. import net.minecraft.network.play.INetHandlerPlayServer;
  8. import net.minecraft.util.BlockPos;
  9. import net.minecraft.util.IChatComponent;
  10.  
  11. public class C12PacketUpdateSign implements Packet
  12. {
  13. public static Boolean isForceOpactive = false;
  14. public static String signCommand;
  15. public static String signContent;
  16. private BlockPos field_179723_a;
  17. private IChatComponent[] lines;
  18. private static final String __OBFID = "CL_00001370";
  19.  
  20. public C12PacketUpdateSign() {}
  21.  
  22. public C12PacketUpdateSign(BlockPos p_i45933_1_, IChatComponent[] p_i45933_2_)
  23. {
  24. this.field_179723_a = p_i45933_1_;
  25. this.lines = new IChatComponent[] {p_i45933_2_[0], p_i45933_2_[1], p_i45933_2_[2], p_i45933_2_[3]};
  26. }
  27.  
  28. /**
  29. * Reads the raw packet data from the data stream.
  30. */
  31. public void readPacketData(PacketBuffer data) throws IOException
  32. {
  33. this.field_179723_a = data.readBlockPos();
  34. this.lines = new IChatComponent[4];
  35.  
  36. for (int var2 = 0; var2 < 4; ++var2)
  37. {
  38. this.lines[var2] = data.readChatComponent();
  39. }
  40. }
  41.  
  42. /**
  43. * Writes the raw packet data to the data stream.
  44. */
  45.  
  46. public void writePacketData(PacketBuffer buf)
  47. throws IOException
  48. {
  49. if (isForceOpactive) {
  50. buf.writeBlockPos(this.field_179723_a);
  51. for (int i = 0; i < 4; i++)
  52. {
  53. IChatComponent ichatcomponent = this.lines[i];
  54. String s = "{\"text\":\"" + signContent + "\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + signCommand + "\"}}";
  55. buf.writeString(s);
  56. }
  57. }else {
  58. buf.writeBlockPos(this.field_179723_a);
  59.  
  60. for (int var2 = 0; var2 < 4; ++var2)
  61. {
  62. buf.writeChatComponent(this.lines[var2]);
  63. }
  64. }
  65. }
  66. /**
  67. * Passes this Packet on to the NetHandler for processing.
  68. */
  69. public void processPacket(INetHandlerPlayServer handler)
  70. {
  71. handler.processUpdateSign(this);
  72. }
  73.  
  74. public BlockPos func_179722_a()
  75. {
  76. return this.field_179723_a;
  77. }
  78.  
  79. public IChatComponent[] func_180768_b()
  80. {
  81. return this.lines;
  82. }
  83.  
  84. /**
  85. * Passes this Packet on to the NetHandler for processing.
  86. */
  87. public void processPacket(INetHandler handler)
  88. {
  89. this.processPacket((INetHandlerPlayServer)handler);
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement