blob: b1f1530012d7693270b51a60c7f331684a47e20c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
package kr.syeyoung.dungeonsguide.commands;
import kr.syeyoung.dungeonsguide.DungeonsGuide;
import kr.syeyoung.dungeonsguide.SkyblockStatus;
import kr.syeyoung.dungeonsguide.dungeon.DungeonContext;
import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
import kr.syeyoung.dungeonsguide.roomedit.GuiDungeonRoomEdit;
import kr.syeyoung.dungeonsguide.utils.MapUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.relauncher.Side;
import java.awt.*;
public class CommandEditRoom extends CommandBase {
@Override
public String getCommandName() {
return "editroom";
}
@Override
public String getCommandUsage(ICommandSender sender) {
return "editroom";
}
@Override
public void processCommand(ICommandSender sender, String[] args) {
SkyblockStatus skyblockStatus = DungeonsGuide.getDungeonsGuide().getSkyblockStatus();
if (!skyblockStatus.isOnDungeon()) {
sender.addChatMessage(new ChatComponentText("You're not in dungeons"));
return;
}
if (skyblockStatus.getContext() == null) {
sender.addChatMessage(new ChatComponentText("Dungeon Context is null"));
return;
}
DungeonContext context = skyblockStatus.getContext();
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
Point roomPt = context.getMapProcessor().worldPointToRoomPoint(thePlayer.getPosition());
DungeonRoom dungeonRoom = context.getRoomMapper().get(roomPt);
if (dungeonRoom == null) {
sender.addChatMessage(new ChatComponentText("Can't determine the dungeon room you're in"));
return;
}
openit = new GuiDungeonRoomEdit(dungeonRoom);
}
GuiScreen openit = null;
@SubscribeEvent
public void tick(TickEvent.ClientTickEvent tick){
if ( openit != null &&tick.phase == TickEvent.Phase.END && tick.side == Side.CLIENT && tick.type == TickEvent.Type.CLIENT) {
Minecraft.getMinecraft().displayGuiScreen(openit);
openit = null;
}
}
@Override
public int getRequiredPermissionLevel() {
return 0;
}
}
|