diff options
author | syeyoung <cyong06@naver.com> | 2021-01-31 01:21:11 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-31 01:21:11 +0900 |
commit | 432f59f875eff0a30c3eb1f7a9914eab52688505 (patch) | |
tree | 960c2e623e1b815568a5fe982245816a3a316b80 /src | |
parent | 473ad9613d6c40a35994b2303c00bfb8e87a6b2b (diff) | |
download | Skyblock-Dungeons-Guide-432f59f875eff0a30c3eb1f7a9914eab52688505.tar.gz Skyblock-Dungeons-Guide-432f59f875eff0a30c3eb1f7a9914eab52688505.tar.bz2 Skyblock-Dungeons-Guide-432f59f875eff0a30c3eb1f7a9914eab52688505.zip |
asdjaskld
Diffstat (limited to 'src')
7 files changed, 364 insertions, 1 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java index 6c072340..d39418bd 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDataProvider.java @@ -87,6 +87,8 @@ public class CatacombDataProvider implements DungeonSpecificDataProvider { return new BossfightProcessorLivid(); } else if (floor.equals("F6")) { return new BossfightProcessorSadan(); + } else if (floor.equals("F7")) { + return new BossfightProcessorNecron(); } return null; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java index e8c71fe9..d2c9abd9 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/gui/GuiDungeonRoomEdit.java @@ -37,6 +37,7 @@ public class GuiDungeonRoomEdit extends GuiScreen { tabbedPane.addTab("Match", new RoomDataDisplayPane(room)); tabbedPane.addTab("Secrets", new SecretEditPane(room)); tabbedPane.addTab("Actions", new ActionDisplayPane(room)); + tabbedPane.addTab("Test", new RoommatchingPane(room)); tabbedPane.addTab("Proc.Params", new ProcessorParameterEditPane(room)); this.tabbedPane = tabbedPane; } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java index 84b92d38..06cfca2e 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java @@ -2,13 +2,30 @@ package kr.syeyoung.dungeonsguide.roomedit.panes; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.roomedit.EditingContext; import kr.syeyoung.dungeonsguide.roomedit.MPanel; import kr.syeyoung.dungeonsguide.roomedit.elements.*; import kr.syeyoung.dungeonsguide.roomprocessor.ProcessorFactory; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import scala.collection.immutable.List; import java.awt.*; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.ArrayList; +import java.util.UUID; +import java.util.zip.GZIPOutputStream; public class GeneralEditPane extends MPanel { private DungeonRoom dungeonRoom; @@ -22,6 +39,7 @@ public class GeneralEditPane extends MPanel { private MButton save; private MButton end; + private MButton schematic; private MLabelAndElement roomProcessor; @@ -97,6 +115,32 @@ public class GeneralEditPane extends MPanel { add(end); } { + schematic = new MButton(); + schematic.setText("Save Schematic"); + schematic.setOnActionPerformed(new Runnable() { + @Override + public void run() { + try { + NBTTagCompound nbtTagCompound2 = createNBT(); + NBTTagCompound real = new NBTTagCompound(); + real.setTag("Schematic", nbtTagCompound2); + + File f=new File(e.getDungeonsGuide().getConfigDir(), "schematics/"+ + dungeonRoom.getDungeonRoomInfo().getName()+"-"+dungeonRoom.getDungeonRoomInfo().getUuid().toString()+"-"+ UUID.randomUUID()+".schematic"); + + CompressedStreamTools.write(nbtTagCompound2, f); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSaved to "+f.getName())); + } catch (Throwable e) { + e.printStackTrace(); + } + + } + }); + schematic.setBackgroundColor(Color.orange); + schematic.setBounds(new Rectangle(0,160,getBounds().width, 20)); + add(schematic); + } + { if (dungeonRoom.getDungeonRoomInfo().isRegistered()) return; save = new MButton(); save.setText("Save RoomData"); @@ -123,5 +167,73 @@ public class GeneralEditPane extends MPanel { if (save != null) save.setBounds(new Rectangle(0,140,getBounds().width, 20)); end.setBounds(new Rectangle(1,120,getBounds().width-2, 20)); + if (schematic != null) + schematic.setBounds(new Rectangle(0,160,getBounds().width, 20)); + } + + private NBTTagCompound createNBT() { + NBTTagCompound compound = new NBTTagCompound(); + compound.setShort("Width", (short) (dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 1)); + compound.setShort("Height", (short) 255); + compound.setShort("Length", (short) (dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1)); + int size =compound.getShort("Width") * compound.getShort("Height") * compound.getShort("Length"); + + byte[] blocks = new byte[size]; + byte[] meta = new byte[size]; + byte[] extra = new byte[size]; + byte[] extranibble = new byte[(int) Math.ceil(size / 2.0)]; + + boolean extraEx = false; + NBTTagList tileEntitiesList = new NBTTagList(); + for (int x = 0; x < compound.getShort("Width"); x++) { + for (int y = 0; y < compound.getShort("Height"); y++) { + for (int z = 0; z < compound.getShort("Length"); z++) { + int index = x + (y * compound.getShort("Length") + z) * compound.getShort("Width"); + BlockPos pos = dungeonRoom.getRelativeBlockPosAt(x,y - 70,z); + IBlockState blockState = dungeonRoom.getContext().getWorld().getBlockState(pos); + boolean acc = dungeonRoom.canAccessRelative(x,z); + int id = Block.getIdFromBlock(blockState.getBlock()); + blocks[index] = acc ? (byte) id : 0; + meta[index] = acc ? (byte) blockState.getBlock().getMetaFromState(blockState) : 0; + if ((extra[index] = (byte) ((acc ? id : 0) >> 8)) > 0) { + extraEx = true; + } + + if (blockState.getBlock().hasTileEntity(blockState)) { + TileEntity tileEntity = dungeonRoom.getContext().getWorld().getTileEntity(pos); + try { + final NBTTagCompound tileEntityCompound = new NBTTagCompound(); + tileEntity.writeToNBT(tileEntityCompound); + tileEntitiesList.appendTag(tileEntityCompound); + } catch (final Exception e) { + final BlockPos tePos = tileEntity.getPos(); + + blocks[index] = (byte) 7; + meta[index] = 0; + extra[index] = 0; + } + } + } + } + } + for (int i = 0; i < extranibble.length; i++) { + if (i * 2 + 1 < extra.length) { + extranibble[i] = (byte) ((extra[i * 2 + 0] << 4) | extra[i * 2 + 1]); + } else { + extranibble[i] = (byte) (extra[i * 2 + 0] << 4); + } + } + + + compound.setByteArray("Blocks", blocks); + compound.setByteArray("Data", meta); + compound.setString("Materials", "Classic"); + if (extraEx) { + compound.setByteArray("AddBlocks", extranibble); + } + compound.setTag("Entities", new NBTTagList()); + compound.setTag("TileEntities", tileEntitiesList); + + return compound; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java new file mode 100755 index 00000000..7188c8a7 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoomMatchDisplayPane.java @@ -0,0 +1,119 @@ +package kr.syeyoung.dungeonsguide.roomedit.panes; + +import kr.syeyoung.dungeonsguide.config.guiconfig.FeatureEditPane; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.roomedit.MPanel; +import kr.syeyoung.dungeonsguide.utils.ArrayUtils; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import scala.actors.threadpool.Arrays; + +import java.awt.*; +import java.util.UUID; + +public class RoomMatchDisplayPane extends MPanel { + + private int offsetX = 0; + private int offsetY = 0; + + private DungeonRoom dungeonRoom; + + private int[][] currentBlocks, targetBlocks; + public RoomMatchDisplayPane(DungeonRoom dungeonRoom, UUID uid, int rotation) { + this.dungeonRoom = dungeonRoom; + + currentBlocks = dungeonRoom.getDungeonRoomInfo().getBlocks(); + targetBlocks = DungeonRoomInfoRegistry.getByUUID(uid).getBlocks(); + for (int i = 0; i < rotation; i++) + targetBlocks = ArrayUtils.rotateCounterClockwise(targetBlocks); + } + + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + + int height = Math.max(currentBlocks.length, targetBlocks.length); + int width = Math.max(currentBlocks[0].length, targetBlocks[0].length); + + // draw Axis; + Gui.drawRect(0,0,10,10,0x77777777); + clip(sr, clip.x + 10, clip.y, clip.width - 10, 10); + Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); + for (int x = 0; x < width; x++) { + fr.drawString(x+"", x * 16 +10 + offsetX, 0, 0xFFFFFFFF); + } + clip(sr, clip.x, clip.y +10, 10, clip.height-10); + Gui.drawRect(0,0,getBounds().width, getBounds().height, 0x77777777); + for (int z = 0; z < height; z++) { + fr.drawString(z+"", 2, z * 16 + 10 + offsetY, 0xFFFFFFFF); + } + + int hoverX = (relMousex0 - offsetX - 10) / 16; + int hoverY = (relMousey0 - offsetY - 10) / 16; + // draw Content + clip(sr, clip.x + 10, clip.y +10, clip.width - 10, clip.height - 10); + for (int z = 0; z < height; z++) { + for (int x = 0; x < width; x++) { + int data1; + try { data1 = currentBlocks[z][x]; } catch (Exception e) { + data1 = -2; + } + int data2; + try { data2 = targetBlocks[z][x]; } catch (Exception e) { + data2 = -2; + } + + if (z == hoverY && x == hoverX) { + Gui.drawRect(x *16 +10+offsetX, z *16 +10 + offsetY, x *16 +26 +offsetX, z *16 +26 + offsetY, 0xAA505050); + } + + if (data1 == data2) drawItemStack(new ItemStack(Item.getItemFromBlock(Block.getBlockById(data1)), 1), x * 16 +10 + offsetX, z *16 +10 + offsetY); + else if (data2 == -1 || data1 == -1) { + drawItemStack(new ItemStack(Item.getItemFromBlock(Block.getBlockById(data1 == -1 ? data2 : data1)), 1), x * 16 +10 + offsetX, z *16 +10 + offsetY); + fr.drawString("S", x *16 +10 + offsetX, z *16 +10 + offsetY,0xFFFFFF00); + } else { + fr.drawString("N", x *16 +10 + offsetX, z *16 +10 + offsetY,0xFFFF0000); + } + if (z == hoverY && x == hoverX) { + FeatureEditPane.drawHoveringText(Arrays.asList(new String[] {"Expected "+data2 +" But found "+data1}), relMousex0, relMousey0, fr); + } + } + } + + } + private void drawItemStack(ItemStack stack, int x, int y) + { + Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(stack, x, y); + } + + @Override + public void resize(int parentWidth, int parentHeight) { + this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); + } + + private int lastX; + private int lastY; + @Override + public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { + lastX = absMouseX; + lastY = absMouseY; + } + + @Override + public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { + int dX = absMouseX - lastX; + int dY = absMouseY - lastY; + offsetX += dX; + offsetY += dY; + lastX = absMouseX; + lastY = absMouseY; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java new file mode 100755 index 00000000..5369f40a --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/RoommatchingPane.java @@ -0,0 +1,68 @@ +package kr.syeyoung.dungeonsguide.roomedit.panes; + +import kr.syeyoung.dungeonsguide.dungeon.actions.ActionChangeState; +import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionTree; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.roomedit.MPanel; +import kr.syeyoung.dungeonsguide.roomedit.elements.MButton; +import kr.syeyoung.dungeonsguide.roomedit.elements.MTextField; + +import java.awt.*; +import java.util.UUID; + +public class RoommatchingPane extends MPanel { + private DungeonRoom dungeonRoom; + + private RoomMatchDisplayPane displayPane; + + private MTextField textField; + private MButton calculate; + public RoommatchingPane(final DungeonRoom dungeonRoom) { + this.dungeonRoom = dungeonRoom; + + { + textField = new MTextField(); + textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); + add(textField); + } + { + calculate = new MButton(); + calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); + calculate.setText("match"); + calculate.setOnActionPerformed(new Runnable() { + @Override + public void run() { + try { + remove(displayPane); + + String text = textField.getText(); + String target = text.split(":")[0]; + String state = text.split(":")[1]; + + UUID uid = UUID.fromString(target); + int rotation = Integer.parseInt(state) % 4; + + + displayPane = new RoomMatchDisplayPane(dungeonRoom, uid, rotation); + displayPane.setBounds(new Rectangle(0,25,getBounds().width,getBounds().height-25)); + add(displayPane); + } catch (Throwable t) { + t.printStackTrace(); + } + } + }); + add(calculate); + } + } + + @Override + public void resize(int parentWidth, int parentHeight) { + this.setBounds(new Rectangle(5,5,parentWidth-10,parentHeight-10)); + } + + @Override + public void onBoundsUpdate() { + textField.setBounds(new Rectangle(0,0,getBounds().width - 100, 20)); + calculate.setBounds(new Rectangle(getBounds().width - 100,0,100, 20)); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java new file mode 100644 index 00000000..85277e76 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/bossfight/BossfightProcessorNecron.java @@ -0,0 +1,61 @@ +package kr.syeyoung.dungeonsguide.roomprocessor.bossfight; + +import kr.syeyoung.dungeonsguide.utils.TextUtils; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraftforge.event.entity.living.LivingEvent; + +import java.util.ArrayList; +import java.util.List; + +public class BossfightProcessorNecron extends GeneralBossfightProcessor { + public BossfightProcessorNecron() { + addPhase(PhaseData.builder() + .phase("start") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Gratz for making it this far, but I’m basically unbeatable.§r") + .nextPhase("fight-1").build() + ); + addPhase(PhaseData.builder() + .phase("fight-1") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: I can summon lots of undead! Check this out.§r") + .nextPhase("first-defeat").build() + ); + addPhase(PhaseData.builder() + .phase("first-defeat") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Oh I'm dead!§r").signatureMsg("§r§c[BOSS] Bonzo§r§f: Hoho, looks like you killed me!§r") + .nextPhase("fight-2").build() + ); + addPhase(PhaseData.builder() + .phase("fight-2") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Sike§r").signatureMsg("§r§c[BOSS] Bonzo§r§f: I can revive myself and become much stronger!§r") + .nextPhase("final-defeat").build() + ); + addPhase(PhaseData.builder() + .phase("final-defeat") + .signatureMsg("§r§c[BOSS] Bonzo§r§f: Alright, maybe I'm just weak after all..§r").build() + ); + } + + + @Override + public List<HealthData> getHealths() { + List<HealthData> healths = new ArrayList<HealthData>(); + long health = 0; + if (bonzoStand != null) { + String name = TextUtils.stripColor(bonzoStand.getName()); + String healthPart = name.split(" ")[2]; + health = TextUtils.reverseFormat(healthPart.substring(0, healthPart.length() - 1)); + } + healths.add(new HealthData("Bonzo", (int) health,250000 , this.getCurrentPhase().startsWith("fight-"))); + return healths; + } + + private EntityArmorStand bonzoStand; + @Override + // §e﴾ §c§lBonzo§r §e71k§c❤ §e﴿ + // §e﴾ §c§lBonzo§r §a250k§c❤ §e﴿ + public void onEntitySpawn(LivingEvent.LivingUpdateEvent updateEvent) { + if (updateEvent.entityLiving.getName().contains("❤") && updateEvent.entityLiving instanceof EntityArmorStand) { + System.out.println(updateEvent.entityLiving.getName()); + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java index 78c605d4..ea08c8b6 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java @@ -19,7 +19,7 @@ public class MapUtils { public static void record(byte[] colors, int x, int y, Color c) { MapUtils.colors = colors; - colorMasks[y *128 +x] = new Color(255, 255, 255, 50); + colorMasks[y *128 +x] = c; } public static byte getMapColorAt(byte[] colors, int x, int y) { |