Advertisement
Olivki

ek is love

Sep 23rd, 2014
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.04 KB | None | 0 0
  1. package se.proxus.owari.mods.list.world;
  2.  
  3. import net.minecraft.client.gui.GuiScreen;
  4. import net.minecraft.client.gui.inventory.GuiEditSign;
  5. import net.minecraft.network.play.client.C12PacketUpdateSign;
  6. import net.minecraft.tileentity.TileEntitySign;
  7. import se.proxus.owari.Client;
  8. import se.proxus.owari.events.EventHandler;
  9. import se.proxus.owari.events.EventManager;
  10. import se.proxus.owari.events.list.client.EventDisplayGuiScreen;
  11. import se.proxus.owari.mods.Mod;
  12. import se.proxus.owari.mods.ModCategory;
  13. import se.proxus.owari.tools.Tools;
  14.  
  15. public class SignFiller extends Mod {
  16.  
  17.     public SignFiller(final Client client) {
  18.         super("Sign Filler", ModCategory.WORLD, false, client);
  19.     }
  20.  
  21.     @Override
  22.     public void init() {
  23.         addValue("Line 1", "EK", "First line of the text displayed on the sign.", 15, true, true);
  24.         addValue("Line 2", "IS", "Second line of the text displayed on the sign.", 15, true, true);
  25.         addValue("Line 3", "LOVE", "Third line of the text displayed on the sign.", 15, true, true);
  26.         addValue("Line 4", "<333", "Fourth line of the text displayed on the sign.", 15, true, true);
  27.         setValue("Description", "Fills signs you place down with the set text.", false);
  28.         checkState();
  29.     }
  30.  
  31.     @Override
  32.     public void onEnable() {
  33.         EventManager.registerListener(this);
  34.     }
  35.  
  36.     @Override
  37.     public void onDisable() {
  38.         EventManager.unregisterListener(this);
  39.     }
  40.  
  41.     @EventHandler
  42.     public void onDisplayGuiScreen(final EventDisplayGuiScreen event) {
  43.         GuiScreen screen = event.getScreen();
  44.  
  45.         if (!(screen instanceof GuiEditSign)) {
  46.             return;
  47.         }
  48.  
  49.         GuiEditSign guiSign = (GuiEditSign) screen;
  50.         TileEntitySign entitySign = guiSign.field_146848_f;
  51.         int x = entitySign.field_145851_c;
  52.         int y = entitySign.field_145848_d;
  53.         int z = entitySign.field_145849_e;
  54.         String[] signText = new String[] { getValue("Line 1").getString(),
  55.                 getValue("Line 2").getString(), getValue("Line 3").getString(),
  56.                 getValue("Line 4").getString() };
  57.         Tools.sendPacket(new C12PacketUpdateSign(x, y, z, signText));
  58.         event.setScreen(null);
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement