Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package se.proxus.owari.mods.list.world;
- import net.minecraft.client.gui.GuiScreen;
- import net.minecraft.client.gui.inventory.GuiEditSign;
- import net.minecraft.network.play.client.C12PacketUpdateSign;
- import net.minecraft.tileentity.TileEntitySign;
- import se.proxus.owari.Client;
- import se.proxus.owari.events.EventHandler;
- import se.proxus.owari.events.EventManager;
- import se.proxus.owari.events.list.client.EventDisplayGuiScreen;
- import se.proxus.owari.mods.Mod;
- import se.proxus.owari.mods.ModCategory;
- import se.proxus.owari.tools.Tools;
- public class SignFiller extends Mod {
- public SignFiller(final Client client) {
- super("Sign Filler", ModCategory.WORLD, false, client);
- }
- @Override
- public void init() {
- addValue("Line 1", "EK", "First line of the text displayed on the sign.", 15, true, true);
- addValue("Line 2", "IS", "Second line of the text displayed on the sign.", 15, true, true);
- addValue("Line 3", "LOVE", "Third line of the text displayed on the sign.", 15, true, true);
- addValue("Line 4", "<333", "Fourth line of the text displayed on the sign.", 15, true, true);
- setValue("Description", "Fills signs you place down with the set text.", false);
- checkState();
- }
- @Override
- public void onEnable() {
- EventManager.registerListener(this);
- }
- @Override
- public void onDisable() {
- EventManager.unregisterListener(this);
- }
- @EventHandler
- public void onDisplayGuiScreen(final EventDisplayGuiScreen event) {
- GuiScreen screen = event.getScreen();
- if (!(screen instanceof GuiEditSign)) {
- return;
- }
- GuiEditSign guiSign = (GuiEditSign) screen;
- TileEntitySign entitySign = guiSign.field_146848_f;
- int x = entitySign.field_145851_c;
- int y = entitySign.field_145848_d;
- int z = entitySign.field_145849_e;
- String[] signText = new String[] { getValue("Line 1").getString(),
- getValue("Line 2").getString(), getValue("Line 3").getString(),
- getValue("Line 4").getString() };
- Tools.sendPacket(new C12PacketUpdateSign(x, y, z, signText));
- event.setScreen(null);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement