diff options
| author | syeyoung <cyong06@naver.com> | 2021-02-26 14:57:15 +0900 | 
|---|---|---|
| committer | syeyoung <cyong06@naver.com> | 2021-02-26 14:57:15 +0900 | 
| commit | e429287b83904d4d0576c3cf292a85eabb48c888 (patch) | |
| tree | 7d239c05934460dabb8c7a44a8de94fe966efc1e | |
| parent | 0e2ae080900bcb9c34d2013848bd9d2c5bae1e28 (diff) | |
| download | Skyblock-Dungeons-Guide-e429287b83904d4d0576c3cf292a85eabb48c888.tar.gz Skyblock-Dungeons-Guide-e429287b83904d4d0576c3cf292a85eabb48c888.tar.bz2 Skyblock-Dungeons-Guide-e429287b83904d4d0576c3cf292a85eabb48c888.zip | |
schematics bruh
| -rwxr-xr-x | options.txt | 8 | ||||
| -rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java | 41 | ||||
| -rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java | 31 | 
3 files changed, 71 insertions, 9 deletions
| diff --git a/options.txt b/options.txt index 6bf51f5b..046d6bf2 100755 --- a/options.txt +++ b/options.txt @@ -10,13 +10,13 @@ bobView:true  anaglyph3d:false  maxFps:120  fboEnable:true -difficulty:3 +difficulty:1  fancyGraphics:true  ao:2  renderClouds:fast  resourcePacks:[]  incompatibleResourcePacks:[] -lastServer:mc.hyp +lastServer:localhost  lang:en_US  chatVisibility:0  chatColors:true @@ -38,7 +38,7 @@ chatHeightFocused:1.0  chatHeightUnfocused:0.44366196  chatScale:1.0  chatWidth:1.0 -showInventoryAchievementHint:true +showInventoryAchievementHint:false  mipmapLevels:4  streamBytesPerPixel:0.5  streamMicVolume:1.0 @@ -70,7 +70,7 @@ key_key.drop:0  key_key.inventory:18  key_key.chat:20  key_key.playerlist:15 -key_key.pickItem:-98 +key_key.pickItem:35  key_key.command:53  key_key.screenshot:60  key_key.togglePerspective:63 diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index b53917ee..e329beb6 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -16,20 +16,25 @@ import net.minecraft.client.Minecraft;  import net.minecraft.client.entity.EntityPlayerSP;  import net.minecraft.command.CommandBase;  import net.minecraft.command.ICommandSender; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound;  import net.minecraft.util.ChatComponentText;  import net.minecraftforge.common.MinecraftForge;  import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;  import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.relauncher.ReflectionHelper;  import javax.crypto.BadPaddingException;  import javax.crypto.IllegalBlockSizeException;  import javax.crypto.NoSuchPaddingException;  import java.awt.*;  import java.io.*; +import java.lang.reflect.Method;  import java.security.*;  import java.security.cert.CertificateException;  import java.text.SimpleDateFormat;  import java.util.Date; +import java.util.zip.GZIPOutputStream;  public class CommandDungeonsGuide extends CommandBase {      @Override @@ -191,6 +196,42 @@ public class CommandDungeonsGuide extends CommandBase {              } catch (Throwable t) {                  t.printStackTrace();              } +//        } else if (args[0].equals("fixschematic")) { +//            File root = new File(e.getDungeonsGuide().getConfigDir(), "schematics"); +//            Method method = null; +//            try { +//                method = NBTTagCompound.class.getDeclaredMethod("write", DataOutput.class); +//                method.setAccessible(true); +//            } catch (NoSuchMethodException e) { +//                e.printStackTrace(); +//                return; +//            } +//            for (File f : root.listFiles()) { +//                try { +//                    NBTTagCompound nbtTagCompound = CompressedStreamTools.readCompressed(new FileInputStream(f)); +//                    if (nbtTagCompound.getKeySet().isEmpty()) { +//                        System.out.println("ah"); +//                        return; +//                    } +//                    nbtTagCompound.setString("Materials","Alpha"); +//                    FileOutputStream fos = new FileOutputStream(f); +//                    DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(fos))); +// +//                    try +//                    { +//                        dataoutputstream.writeByte(nbtTagCompound.getId()); +// +//                            dataoutputstream.writeUTF("Schematic"); +//                            method.invoke(nbtTagCompound, dataoutputstream); +//                    } +//                    finally +//                    { +//                        dataoutputstream.close(); +//                    } +//                } catch (Exception e) { +//                    e.printStackTrace(); +//                } +//            }          } else {              sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg §7-§fOpens configuration gui"));              sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e/dg gui §7-§fOpens configuration gui")); 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 f4450bd2..c23d7c0d 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/panes/GeneralEditPane.java @@ -18,9 +18,11 @@ import net.minecraft.util.BlockPos;  import net.minecraft.util.ChatComponentText;  import java.awt.*; -import java.io.File; +import java.io.*; +import java.lang.reflect.Method;  import java.util.ArrayList;  import java.util.UUID; +import java.util.zip.GZIPOutputStream;  public class GeneralEditPane extends MPanel {      private DungeonRoom dungeonRoom; @@ -130,13 +132,32 @@ public class GeneralEditPane extends MPanel {                  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); +                        Method method = null; +                        try { +                            method = NBTTagCompound.class.getDeclaredMethod("write", DataOutput.class); +                            method.setAccessible(true); +                        } catch (NoSuchMethodException e) { +                            e.printStackTrace(); +                            return; +                        } +                        FileOutputStream fos = new FileOutputStream(f); +                        DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(fos))); + +                        try +                        { +                            dataoutputstream.writeByte(nbtTagCompound2.getId()); + +                            dataoutputstream.writeUTF("Schematic"); +                            method.invoke(nbtTagCompound2, dataoutputstream); +                        } +                        finally +                        { +                            dataoutputstream.close(); +                        }                          Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSaved to "+f.getName()));                      } catch (Throwable e) {                          e.printStackTrace(); @@ -235,7 +256,7 @@ public class GeneralEditPane extends MPanel {          compound.setByteArray("Blocks", blocks);          compound.setByteArray("Data", meta); -        compound.setString("Materials", "Classic"); +        compound.setString("Materials", "Alpha");          if (extraEx) {              compound.setByteArray("AddBlocks", extranibble);          } | 
